DM8配置异步备库

配置异步备库
先搭建实时主备
下列机器事先都安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为实时主备,主库命名为“hy1”,备库命名为“hy2”。

机器名     IP地址                  初始状态                         操作系统
dm222     10.10.13.222(对外)     主库 hy1                         redhat 7.8
          10.10.13.222(mal对内)


dm223    10.10.13.223(对外)
         10.10.13.223(mal对内)     备库 hy2                       redhat 7.8

dm225    10.10.13.225            确认监视器                       redhat 7.8


实例名       port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port
hy1          5236                 5239                10.10.13.222          5237            5238
hy2          5236                 5239                10.10.13.223          5237            5238

数据准备
在主库机器上初始化数据库到目录/dm8/data:

[dmdba@dm222 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy1 port_num=5236 page_size=8 charset=0
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-10-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-14 16:20:46

注册服务用于启动数据库

[root@dm222 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/hy/dm.ini -p hy1 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicehy1.service to /usr/lib/systemd/system/DmServicehy1.service.
Finished to create the service (DmServicehy1)

正常启动数据库并正常关闭

[root@dm222 ~]# service DmServicehy1 start
Redirecting to /bin/systemctl start DmServicehy1.service
[root@dm222 ~]# ps -ef | grep dmserver
dmdba     8282     1 17 16:22 ?        00:00:02 /dm8/bin/dmserver path=/dm8/data/hy/dm.ini -noconsole
root      8373  8033  0 16:23 pts/2    00:00:00 grep --color=auto dmserver

[root@dm222 ~]# su - dmdba
Last login: Mon Feb 14 16:20:29 CST 2022 on pts/1
[dmdba@dm222 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 2.616(ms)
disql V8
SQL>

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

备份主库
1. 正常关闭数据库

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

2.使用dmrman来进行冷备份

[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full backupset  '/dm8/hy1_full_bak_1'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full backupset '/dm8/hy1_full_bak_1'
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[25300], file_lsn[25300]
Processing backupset /dm8/hy1_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.717

将主库的备份复制到备库:

[dmdba@dm222 dm8]$ scp -r hy1_full_bak_1 10.10.13.223:/dm8
The authenticity of host '10.10.13.223 (10.10.13.223)' can't be established.
ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4.
ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.13.223' (ECDSA) to the list of known hosts.
dmdba@10.10.13.223's password:
hy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  12.8MB/s   00:00
hy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   1.6MB/s   00:00
[dmdba@dm222 dm8]$

创建备库备库并恢复

[dmdba@dm223 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy2 port_num=5236 page_size=8 charset=0
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-10-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-14 16:35:20

恢复备库:

[dmdba@dm223 dm8]$ dmrman CTLSTMT="RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'"
dmrman V8
RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:06][Remaining:00:00:00]
restore successfully.
time used: 00:00:06.384


[dmdba@dm223 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[25300], file_lsn[25300]
no log generates while the backupset [/dm8/hy1_full_bak_1] created
recover successfully!
time used: 359.697(ms)


[dmdba@dm223 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[25300], file_lsn[25300]
recover successfully!
time used: 00:00:01.074

配置操作
一.主库
配置dm.ini文件,配置以下参数:

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5           #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5       #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = HY1              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.222          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.222     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = HY2              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.223          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.223     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm222 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
修改dmarch.ini,配置本地归档和实时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例HY1是主库,需要向HY2(实时备库)同步数据,因此实时归档的ARCH_DEST配置为HY2。

[ARCHIVE_REALTIME]                                #实时归档
ARCH_TYPE = REALTIME                              #实时归档类型
ARCH_DEST = HY2                                   #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                                 #本地归档类型
ARCH_DEST = /dm8/data/hy/arch                     #本地归档文件存放路径
ARCH_FILE_SIZE = 128                              #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0                              #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm222 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 555555                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/hy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm222 hy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 555555
INST_INI = /dm8/data/hy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

以mount模式启动主库

[root@dm222 ~]# su - dmdba
Last login: Mon Feb 14 16:23:39 CST 2022 on pts/2
[dmdba@dm222 ~]$ dmserver /dm8/data/hy/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-10-21
file lsn: 25300
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.

设置主库 OGUID

[dmdba@dm222 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 2.975(ms)
disql V8
SQL> sp_set_oguid(555555);
DMSQL executed successfully
used time: 115.785(ms). Execute id is 0.

修改主数据库模式

SQL> alter database primary;
executed successfully
used time: 185.004(ms). Execute id is 0.

将主库的dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini文件复制到备库

[dmdba@dm222 hy]$ scp dm*.ini 10.10.13.223:/dm8/data/hy
dmdba@10.10.13.223's password:
dmarch.ini                                                                                                                                                                                               100%  338    11.0KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   52KB  20.4MB/s   00:00
dmmal.ini                                                                                                                                                                                                100%  545    60.2KB/s   00:00
dmwatcher.ini                                                                                                                                                                                            100%  613    77.0KB/s   00:00
[dmdba@dm222 hy]$

二.备库
备机修改相关配置
修改dm.ini

INSTANCE_NAME = HY2

修改dmarch.ini

[dmdba@dm223 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

dmwatcher.ini 和主库一致

注册服务用于启动数据库

[root@dm223 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/hy/dm.ini -p hy2 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicehy2.service to /usr/lib/systemd/system/DmServicehy2.service.
Finished to create the service (DmServicehy2)

以mount方式启动备库

[dmdba@dm223 ~]$ dmserver /dm8/data/hy/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-10-21
file lsn: 25300
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.

设置备库 OGUID

[dmdba@dm223 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 3.781(ms)
disql V8
SQL> sp_set_oguid(555555);
DMSQL executed successfully
used time: 53.436(ms). Execute id is 0.

修改备数据库模式

SQL> alter database standby;
executed successfully
used time: 130.946(ms). Execute id is 0.

注册并启动守护进程
主库

[root@dm222 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy1 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy1.service to /usr/lib/systemd/system/DmWatcherServicehy1.service.
Finished to create the service (DmWatcherServicehy1)
[root@dm222 ~]# service DmWatcherServicehy1 start
Redirecting to /bin/systemctl start DmWatcherServicehy1.service

备库

[root@dm223 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy2 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy2.service to /usr/lib/systemd/system/DmWatcherServicehy2.service.
Finished to create the service (DmWatcherServicehy2)
[root@dm223 ~]# service DmWatcherServicehy2 start
Redirecting to /bin/systemctl start DmWatcherServicehy2.service

查看file_lsn与cur_lsn主备库是否一致
主库

[dmdba@dm222 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is primary, state is open
login used time : 2.370(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26559                26559

used time: 5.367(ms). Execute id is 600.

备库

[dmdba@dm223 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is standby, state is open
login used time : 1.921(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26559                26559

used time: 18.396(ms). Execute id is 100.

配置监视器(基本要求,安装dm8的软件)
由于主库和实时备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知实时备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间

[GRP1]
MON_INST_OGUID = 555555                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238

[dmdba@dm225 data]$ vi dmmonitor.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0

[GRP1]
MON_INST_OGUID = 555555


MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238

启动监视器:

[dmdba@dm225 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-02-14 17:11:11: DMMONITOR[4.0] V8
[monitor]         2022-02-14 17:11:11: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-14 17:11:12: Received message from(HY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-14 17:11:11  OPEN           OK        HY1              OPEN        PRIMARY   VALID    2        26559           26559

[monitor]         2022-02-14 17:11:12: Received message from(HY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-14 17:11:11  OPEN           OK        HY2              OPEN        STANDBY   VALID    2        26559           26559

show
2022-02-14 17:11:23
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             555555      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.222      5238         2022-02-14 17:11:22  GLOBAL    VALID     OPEN           HY1              OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.222      5236       OK        HY1              OPEN        PRIMARY   0          0            REALTIME  VALID    4204            26559           4204            26559           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.223      5238         2022-02-14 17:11:22  GLOBAL    VALID     OPEN           HY2              OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.223      5236       OK        HY2              OPEN        STANDBY   0          0            REALTIME  VALID    4200            26559           4200            26559           NONE

DATABASE(HY2) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4204, 4204, 4204], (RLSN, SLSN, KLSN)[26559, 26559, 26559], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (26559)


#================================================================================#

主备同步测试
主库:

SQL> create table t1(id int);
executed successfully
used time: 56.331(ms). Execute id is 601.
SQL> insert into t1 values(1);
affect rows 1

used time: 0.832(ms). Execute id is 602.
SQL> commit;
executed successfully
used time: 2.878(ms). Execute id is 603.
SQL> select * from t1;

LINEID     ID
---------- -----------
1          1

used time: 1.172(ms). Execute id is 604.

备库:

SQL> select * from t1;

LINEID     ID
---------- -----------
1          1

used time: 2.349(ms). Execute id is 101.

在实际应用中,如果数据库规模很大,并且对数据的实时性要求不是很严格,则可以配置多个异步备库用于分担统计报表等任务。

这里以实时主备环境为例,仍然采用7.2 配置实时主备小节的配置环境,对异步备库的搭建步骤做举例说明,读写分离集群和MPP主备的异步备库搭建步骤是相同的,只需要根据实际情况调整配置项的具体值即可。

这里以一个异步备库为例,配置在主库HY1上,异步备库实例名为HY3。如果需要配置多个异步备库,对应的源实例配置可以参考主库HY1的配置步骤,异步备库自身的配置可以参考HY3的配置步骤。

源实例之间不能有相同的异步归档配置,避免同时向异步备库发送归档,导致异步备库数据乱掉的情况发生。

如果源实例自身出现故障,在故障恢复之前,都不会再发送归档到异步备库,所以如果有多个异步备库,可以考虑将异步备库分别配置到不同的源实例上。

环境说明
这里采用实时主备环境,增加一台机器用来部署异步备库,其他环境不变。

新增的机器事先安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

新增的异步备库实例名为“HY3”,按照“组名_守护环境_序号”的建议方式命名,注意总长度不能超过16。

机器名    IP地址             初始状态         操作系统              备注
dm224     10.10.13.224     异步备库HY3      redhat 7.8            10.10.13.224

数据准备
按照数据准备中的方法准备异步备库的数据。
如果实时主备守护环境已经处于运行状态,需要先正常退出主备库实例和守护进程。

先正常停止实时主备环境中的主库和备库
停止主库

[root@dm222 ~]# service DmWatcherServicehy1 stop
Redirecting to /bin/systemctl stop DmWatcherServicehy1.service
[root@dm222 ~]# ps -ef | grep dm.ini
root     29636 11271  0 16:47 pts/4    00:00:00 grep --color=auto dm.ini

停止备库

[root@dm223 ~]# service DmWatcherServicehy2 stop
Redirecting to /bin/systemctl stop DmWatcherServicehy2.service
[root@dm223 ~]# ps -ef | grep dm.ini
root     19132  5222  0 16:47 pts/3    00:00:00 grep --color=auto dm.ini

备份主库
1. 正常关闭数据库

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

2.使用dmrman来进行冷备份

[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full to backup_file1 backupset  '/dm8/hy1_full_bak_2'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full to backup_file1 backupset '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
Processing backupset /dm8/hy1_full_bak_2
[-8216]:Archive log absence, repair archive log with SQL 'repair archive log ...' in dmrman
[dmdba@dm222 dm8]$ dmrman
dmrman V8
RMAN> repair archivelog database '/dm8/data/hy/dm.ini'
repair archivelog database '/dm8/data/hy/dm.ini'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
repair archive log successfully.
repair time used: 349.630(ms)
time used: 353.380(ms)
RMAN> exit
time used: 0.842(ms)
[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full  backupset  '/dm8/hy1_full_bak_2'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full backupset '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
Processing backupset /dm8/hy1_full_bak_2
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:02.007

将主库的备份复制到异步备库:

[dmdba@dm222 dm8]$ scp -r hy1_full_bak_2 10.10.13.224:/dm8
The authenticity of host '10.10.13.224 (10.10.13.224)' can't be established.
ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4.
ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.13.224' (ECDSA) to the list of known hosts.
dmdba@10.10.13.224's password:
hy1_full_bak_2.bak                                                                                                                                                                                       100%   15MB  20.9MB/s   00:00
hy1_full_bak_2_1.bak                                                                                                                                                                                     100%  173KB   4.5MB/s   00:00
hy1_full_bak_2.meta                                                                                                                                                                                      100%   85KB  11.1MB/s   00:00
[dmdba@dm222 dm8]$

创建异步备库并恢复

[dmdba@dm224 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy3 port_num=5236 page_size=8 charset=0
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-10-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-15 17:00:17

恢复异步备库:

[dmdba@dm224 dm8]$ dmrman CTLSTMT="RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'"
dmrman V8
RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:07][Remaining:00:00:00]
restore successfully.
time used: 00:00:07.883
[dmdba@dm224 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[26600], file_lsn[26600]
[Percent:100.00%][Speed:0.00PKG/s][Cost:00:00:00][Remaining:00:00:00]
recover successfully!
time used: 00:00:02.881
[dmdba@dm224 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[27968], file_lsn[27968]
recover successfully!
time used: 00:00:01.067

配置主库HY1
配置dm.ini
在实时主备环境下配置dm.ini的基础上,打开定时器配置,其他配置不变。
#配置有异步归档时,打开定时器,定时同步归档到异备库

TIMER_INI = 1

配置dmmal.ini
在实时主备环境下配置dmmal.ini的基础上,增加异步备库HY3的mal配置项。

[MAL_INST3]
MAL_INST_NAME = HY3              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.224          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.224     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm222 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
在实时主备环境下配置dmarchl.ini的基础上,增加异步归档的配置项。

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC              #异步归档类型
ARCH_DEST = HY3                #异步归档目标实例名
ARCH_TIMER_NAME = RT_TIMER     #定时器名称,和dmtimer.ini中的名称一致

[dmdba@dm222 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC
ARCH_DEST = HY3
ARCH_TIMER_NAME = RT_TIMER

配置dmtimer.ini
配置dmtimer.ini,用于定时触发实例发送归档日志到异步备库。
下面示例中定时器配置为每天09:00:00触发主库发送归档日志到异步备库,可以根据实际情况再做调整。

[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 09:00:00
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

[dmdba@dm222 hy]$ vi dmtimer.ini
[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 09:00:00
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

配置备库HY2
该示例中备库上没有异步归档配置,但是由于dmmal.ini必须配置一致,因此需要修改备库上的dmmal.ini配置,其他已有的配置项不需要改动。

配置dmmal.ini
dmmal.ini中需要增加到异步备库HY3的mal配置项

[MAL_INST3]
MAL_INST_NAME = HY3              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.224          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.224     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm223 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239


2022-02-17 16:11:11: The asynchronous standby database configuration is different between instance[HY1] and instance[HY2]

对实时备库也要配置异步归档,否则会报上面的错误信息

配置dm.ini
在实时主备环境下配置dm.ini的基础上,打开定时器配置,其他配置不变。
#配置有异步归档时,打开定时器,定时同步归档到异备库

TIMER_INI = 1

[dmdba@dm223 ~]$ vi /dm8/data/hy/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC
ARCH_DEST = HY3
ARCH_TIMER_NAME = RT_TIMER


[dmdba@dm223 ~]$ vi /dm8/data/hy/dmtimer.ini
[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 23:59:59
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

配置异步备库HY3
配置dm.ini
在dm224机器上配置备库的实例名为HY31,dm.ini参数修改如下:

INSTANCE_NAME = HY3               #实例名,建议使用“组名_守护环境_序号”的命名方式,总长度不能超过16
PORT_NUM = 5236                   #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60         #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0             #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2             #不允许备库OFFLINE表空间
MAL_INI = 1                       #打开MAL系统
ARCH_INI = 1                      #打开归档配置
RLOG_SEND_APPLY_MON = 64          #统计最近64次的日志重演信息

配置dmmal.ini
同一个守护进程组中,所有主备库必须使用相同的dmmal.ini配置文件

[dmdba@dm224 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
本地守护类型的备库只需要配置本地归档。

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/data/hy/arch      #本地归档文件路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm224 hy]$ vi dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为本地守护类型,异步备库不具备故障自动切换等功能,DW_MODE配置并不起作用,此处配置为MANUAL即可,另外异步备库不需要配置dmwatcher.ctl控制文件。

[GRP1]
DW_TYPE = LOCAL                                          #全局守护类型
DW_MODE = MANUAL                                         #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 555555                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/hy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动

[dmdba@dm224 hy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = LOCAL
DW_MODE = MANUAL
DW_ERROR_TIME = 10
INST_ERROR_TIME = 10
INST_OGUID = 555555
INST_INI = /dm8/data/hy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver

启动主库

[root@dm222 ~]# service DmWatcherServicehy1 start
Redirecting to /bin/systemctl start DmWatcherServicehy1.service
[root@dm222 ~]# ps -ef | grep dm.ini
dmdba    11148     1  2 15:14 ?        00:00:00 /dm8/bin/dmserver /dm8/data/hy/dm.ini mount
root     11276 11271  0 15:15 pts/4    00:00:00 grep --color=auto dm.ini

启动实时备库

[root@dm223 ~]# service DmWatcherServicehy2 start
Redirecting to /bin/systemctl start DmWatcherServicehy2.service
[root@dm223 ~]# ps -ef | grep dm.ini
dmdba    31842     1  1 15:15 ?        00:00:00 /dm8/bin/dmserver /dm8/data/hy/dm.ini mount
root     31947  5222  0 15:15 pts/3    00:00:00 grep --color=auto dm.ini

以mount方式启动异步备库

[dmdba@dm224 hy]$ dmserver /dm8/data/hy/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 1, oguid = 555555
License will expire on 2022-10-21
file lsn: 27968
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.

[dmdba@dm224 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is primary, state is mount
login used time : 3.554(ms)
disql V8
SQL> sp_set_oguid(555555);
sp_set_oguid(555555);
[-720]:Dmwatcher is active, or current configuration(ALTER_MODE_STATUS) not allowed to alter database.
used time: 8.410(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 8.953(ms). Execute id is 1.
SQL> sp_set_oguid(555555);
DMSQL executed successfully
used time: 66.419(ms). Execute id is 2.
SQL> alter database standby;
executed successfully
used time: 79.036(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 5.075(ms). Execute id is 3.

配置监视器
在实时主备配置监视器的配置基础上,需要增加到异步备库守护进程的“IP:PORT”信息,否则监视器无法收到异步备库消息,其他配置项不需要改动。

修改dmmonitor.ini配置确认监视器,增加到HY3守护进程的MON_DW_IP配置项,需要找到dmmal.ini中实例HY3的配置项信息,MON_DW_IP中的IP信息和dmmal.ini配置项中的MAL_HOST一致,PORT信息和dmmal.ini配置项中的MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                  #确认监视器模式
MON_LOG_PATH = /dm/data/log         #监视器日志文件存放路径
MON_LOG_INTERVAL = 60               #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32              #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0             #不限定日志文件总占用空间
[GRP1]
MON_INST_OGUID = 555555             #组GRP1的唯一OGUID值
#以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
#IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238
#新增到异步备库GRP1_LOCAL_01守护进程的连接信息
MON_DW_IP = 10.10.13.224:5238

[dmdba@dm225 data]$ vi dmmonitor.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0

[GRP1]
MON_INST_OGUID = 555555


MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238
MON_DW_IP = 10.10.13.224:5238

启动守护进程
启动异步备库的守护进程:

[root@dm224 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy3 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy3.service to /usr/lib/systemd/system/DmWatcherServicehy3.service.
Finished to create the service (DmWatcherServicehy3)
[root@dm224 ~]# service DmWatcherServicehy3 start
Redirecting to /bin/systemctl start DmWatcherServicehy3.service

守护进程启动后,进入Startup状态,此时实例处于Mount状态,异步备库的守护进程会将本地实例自动Open,并切换守护进程自身为Open状态。

[dmdba@dm224 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is standby, state is open
login used time : 2.335(ms)
disql V8
SQL>

启动监视器
修改监视器配置后,需要重新启动监视器:

[dmdba@dm225 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-02-16 15:33:08: DMMONITOR[4.0] V8
[monitor]         2022-02-16 15:33:08: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-16 15:33:08: Received message from(HY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY2              OPEN        STANDBY   NULL     4        29115           29115

[monitor]         2022-02-16 15:33:08: Received message from(HY3)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY3              OPEN        STANDBY   NULL     0        27968           27968

[monitor]         2022-02-16 15:33:08: Received message from(HY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY1              OPEN        PRIMARY   VALID    4        29115           29115

show
2022-02-17 16:20:32
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             555555      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.222      5238         2022-02-17 16:20:31  GLOBAL    VALID     OPEN           HY1              OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.222      5236       OK        HY1              OPEN        PRIMARY   0          0            REALTIME  VALID    4307            34882           4307            34882           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.223      5238         2022-02-17 16:20:31  GLOBAL    VALID     OPEN           HY2              OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.223      5236       OK        HY2              OPEN        STANDBY   0          0            REALTIME  VALID    4301            34882           4301            34882           NONE

DATABASE(HY2) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4306, 4306, 4307], (RLSN, SLSN, KLSN)[34882, 34882, 34882], N_TSK[0], TSK_MEM_USE[1024]
REDO_LSN_ARR: (34882)


ASYNC SOURCE INSTANCE: HY1

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.224      5238         2022-02-17 16:20:32  LOCAL     VALID     OPEN           HY3              OK        1     1     OPEN        STANDBY   DSC_OPEN       NONE      NULL

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.224      5236       OK        HY3              OPEN        STANDBY   0          0            NONE      NULL     4276            34882           4276            34882           NONE

DATABASE(HY3) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1), ARCH_SEND_UNTIL_TIME[NONE], APPLY_UNTIL_TIME[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4306, 4306, 4306], (RLSN, SLSN, KLSN)[34882, 34882, 34882], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (34882)

发表评论

电子邮件地址不会被公开。