Bootstrap

Redhat 7.9上配置达梦8 主备集群

Redhat 7.9上配置达梦8 主备集群

一 基础环境

在这里插入图片描述

端口说明:
在这里插入图片描述

注:
主库已经安装软件,及创建数据库实例。并已开启归档模式。
[dmdba@test1 tool]$ disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 6.060(ms)
disql V8
SQL>
SQL> select NAME,TYPE,VALUE,SYS_VALUE,FILE_VALUE from v$parameter where name=‘BAK_PATH’;

行号 NAME TYPE VALUE SYS_VALUE FILE_VALUE


1 BAK_PATH READ ONLY /dm8/backup /dm8/backup /dm8/backup

已用时间: 9.332(毫秒). 执行号:501.
SQL> select * from v$arch_status;

行号 ARCH_TYPE ARCH_DEST ARCH_STATUS ARCH_SRC


1 LOCAL /dm8/arch VALID DMSVR01

已用时间: 0.523(毫秒). 执行号:502.

备库已经安装软件。

监视器已经安装软件。

二 配置

2.1 配置主库

2.1.1主库进行脱机备份

–备份

[dmdba@test1 ~]$ DmServiceDMSVR01 stop
Stopping DmServiceDMSVR01:                                 [ OK ]
[dmdba@test1 ~]$ 
[dmdba@test1 ~]$ dmrman
dmrman V8
RMAN> backup database '/dm8/data/DM01/dm.ini' full;
backup database '/dm8/data/DM01/dm.ini' full;
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[42939], file_lsn[42939]
Processing backupset /dm8/backup/DB_DM01_FULL_20240727_084148_248563
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]                                 
backup successfully!
time used: 00:00:03.209

–传输到备库

[dmdba@test1 ~]$ cd /dm8/backup/DB_DM01_FULL_20240727_084148_248563/
[dmdba@test1 DB_DM01_FULL_20240727_084148_248563]$ scp DB_DM01_FULL_20240727_084148_248563.* [email protected]:/dm8/backup/
The authenticity of host '192.168.10.100 (192.168.10.100)' can't be established.
ECDSA key fingerprint is SHA256:pGiJgBHeambwotli/1YC55UrX8l05NxVtpuIXfSbxKg.
ECDSA key fingerprint is MD5:4a:ac:c3:4c:b2:c0:f1:2f:10:08:3b:bc:46:72:22:08.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.10.100' (ECDSA) to the list of known hosts.
[email protected]'s password: 
DB_DM01_FULL_20240727_084148_248563.bak                                                                                    100% 9070KB  54.4MB/s   00:00    
DB_DM01_FULL_20240727_084148_248563.meta                                                                                   100%  102KB  25.7MB/s   00:00    
[dmdba@test1 DB_DM01_FULL_20240727_084148_248563]$
2.1.2 配置主库dm.ini 文件
修改 dm.ini 文件如下:
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
2.1.3 配置主库dmarch.ini 文件
修改 dmarch.ini 文件如下:
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
        ARCH_TYPE            = LOCAL
        ARCH_DEST            = /dm8/arch
        ARCH_FILE_SIZE       = 64
        ARCH_SPACE_LIMIT     = 0
        ARCH_FLUSH_BUF_SIZE  = 0
        ARCH_HANG_FLAG       = 1
2.1.4 配置主库dmmal.ini 文件
修改 dmmal.ini 文件如下:
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.10.99
MAL_PORT = 55101
MAL_INST_HOST = 192.168.10.99
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.10.100
MAL_PORT = 55121
MAL_INST_HOST = 192.168.10.100
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
2.1.5 配置主库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 = 8888
INST_INI = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
2.1.6主库起到mount状态,并修改配置

–起到mount状态

[dmdba@test1 ~]$ /dm8/bin/DmServiceDMSVR01 start mount
Starting DmServiceDMSVR01:                                 [ OK ]

–修改主库配置

[dmdba@test1 bin]$ ./disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 5.588(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL 过程已成功完成
已用时间: 9.082(毫秒). 执行号:1.
SQL> sp_set_oguid(8888);
DMSQL 过程已成功完成
已用时间: 1.999(毫秒). 执行号:2.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL 过程已成功完成
已用时间: 52.111(毫秒). 执行号:3.
SQL> alter database primary;
操作已执行
已用时间: 6.878(毫秒). 执行号:0.

2.2 配置备库

2.2.1 初始化备机数据库
[dmdba@test2 backup]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dminit db_name=DM01 instance_name=DMSVR02 PATH=/dm8/data
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2025-01-15
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/DM01/DM0101.log


 log file path: /dm8/data/DM01/DM0102.log

write to dir [/dm8/data/DM01].
create dm database success. 2024-07-27 01:00:02
2.2.2 恢复数据库
[dmdba@test2 bin]$ ./dmrman
dmrman V8
RMAN> restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
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:02][Remaining:00:00:00]                                 
restore successfully.
time used: 00:00:02.827
RMAN> recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[42939], file_lsn[42939]
recover successfully!
time used: 693.791(ms)
RMAN> recover database '/dm8/data/DM01/dm.ini' update db_magic;
recover database '/dm8/data/DM01/dm.ini' update db_magic;
Database mode = 2, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[42939], file_lsn[42939]
recover successfully!
time used: 00:00:01.061
2.2.3 配置备库dm.ini 文件
修改 dm.ini 文件如下:
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
2.2.4 配置备库dmarch.ini 文件
修改 dmarch.ini 文件如下:
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
        ARCH_TYPE            = LOCAL
        ARCH_DEST            = /dm8/arch
        ARCH_FILE_SIZE       = 64
        ARCH_SPACE_LIMIT     = 0
        ARCH_FLUSH_BUF_SIZE  = 0
        ARCH_HANG_FLAG       = 1
2.2.5 配置备库dmmal.ini 文件
修改 dmmal.ini 文件如下:
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.10.99
MAL_PORT = 55101
MAL_INST_HOST = 192.168.10.99
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.10.100
MAL_PORT = 55121
MAL_INST_HOST = 192.168.10.100
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
2.2.6 配置备库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 = 8888
INST_INI = /dm8/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
2.2.7 备库起到mount状态,并修改配置

–起到mount状态

[dmdba@test2 bin]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dmserver /dm8/data/DM01/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server 64 V8 03134284132-20240115-215128-20081 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 2025-01-15
file lsn: 42939
ndct db load finished, code:0
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
uthr_pipe_create, create pipe[read:20, write:21]
uthr_pipe_create, create pipe[read:22, write:23]
uthr_pipe_create, create pipe[read:24, write:25]
uthr_pipe_create, create pipe[read:26, write:27]
uthr_pipe_create, create pipe[read:28, write:29]
uthr_pipe_create, create pipe[read:30, write:31]
uthr_pipe_create, create pipe[read:32, write:33]
uthr_pipe_create, create pipe[read:34, write:35]
uthr_pipe_create, create pipe[read:36, write:37]
uthr_pipe_create, create pipe[read:38, write:39]
uthr_pipe_create, create pipe[read:40, write:41]
uthr_pipe_create, create pipe[read:42, write:43]
uthr_pipe_create, create pipe[read:44, write:45]
uthr_pipe_create, create pipe[read:46, write:47]
uthr_pipe_create, create pipe[read:48, write:49]
uthr_pipe_create, create pipe[read:50, write:51]
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info finished, code:0.
SYSTEM IS READY.

–修改备库配置

--新开一个窗口
[dmdba@test2 bin]$ ./disql sysdba/Dameng123

服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 3.686(ms)
disql V8
SQL> sp_set_oguid(8888);
DMSQL 过程已成功完成
已用时间: 2.868(毫秒). 执行号:1.
SQL> alter database standby;
操作已执行
已用时间: 4.740(毫秒). 执行号:0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL 过程已成功完成
已用时间: 9.072(毫秒). 执行号:2.

2.3 启动主库和备库上的守护进程

–主库执行

[dmdba@test1 ~]$ cd /dm8/bin
[dmdba@test1 bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY

–备库执行

[dmdba@test2 bin]$ cd /dm8/bin
[dmdba@test2 bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY

2.4 配置监视器

2.4.1 配置 dmmonitor.ini

–创建目录

[dmdba@monitor dm8]$ mkdir -p  data/log 
--修改 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 = 8888
MON_DW_IP = 192.168.10.99:65101
MON_DW_IP = 192.168.10.100:65121
2.4.2 登录监视器
[dmdba@monitor data]$ cd /dm8/bin
[dmdba@monitor bin]$ ./dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2024-07-27 09:22:54: DMMONITOR[4.0] V8
[monitor]         2024-07-27 09:22:54: DMMONITOR[4.0] IS READY.

[monitor]         2024-07-27 09:22:54: 
#-----------------------------------------------------------------------------------------------#
GET MONITOR CONNECT INFO FROM DMWATCHER(DMSVR02), THE FIRST LINE IS SELF INFO.

DW_CONN_TIME         MON_CONFIRM    MID            MON_IP                 MON_VERSION                                                     
2024-07-27 01:22:54  TRUE           1877133724     ::ffff:192.168.10.101  DMMONITOR[4.0] V8
                                              
#-----------------------------------------------------------------------------------------------#

[monitor]         2024-07-27 09:22:54: 收到守护进程(DMSVR02)消息
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 01:22:54  OPEN           OK        DMSVR02          OPEN        STANDBY   NULL     4        43095           43095           

[monitor]         2024-07-27 09:22:54: 收到守护进程(DMSVR01)消息
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 09:22:54  OPEN           OK        DMSVR01          OPEN        PRIMARY   VALID    4        43095           43095           

login
用户名:sysdba
密码:
[monitor]         2024-07-27 09:32:10: 登录监视器成功!   

Show 可以看到集群状态

show
2024-07-27 09:33:44 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 09:33:43  GLOBAL    VALID     OPEN           DMSVR01          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          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4945            43095           4945            43095           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 01:33:43  GLOBAL    VALID     OPEN           DMSVR02          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          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  VALID       4945            43095           4945            43095           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4945, 4945, 4945], (RLSN, SLSN, KLSN)[43095, 43095, 43095], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43095)


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

在这里插入图片描述

2.5 注册数据守护集群的服务

2.5.1 主库注册dmwatcher服务
[root@test1 ~]# cd /dm8/script/root/
[root@test1 root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR01 -watcher_ini /dm8/data/DM01/dmwatcher.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceDMSVR01.service to /usr/lib/systemd/system/DmWatcherServiceDMSVR01.service.
创建服务(DmWatcherServiceDMSVR01)完成
2.5.2 备库注册dmwatcher服务
[root@test2 ~]# cd /dm8/script/root/
[root@test2 root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR02 -watcher_ini /dm8/data/DM01/dmwatcher.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceDMSVR02.service to /usr/lib/systemd/system/DmWatcherServiceDMSVR02.service.
创建服务(DmWatcherServiceDMSVR02)完成
2.5.3 注册备库的dmserver服务
[root@test2 root]# ./dm_service_installer.sh -t dmserver -dm_ini /dm8/data/DM01/dm.ini -p DMSVR02
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceDMSVR02.service to /usr/lib/systemd/system/DmServiceDMSVR02.service.
创建服务(DmServiceDMSVR02)完成
2.5.4 注册监视器的dmmonitor服务
[root@monitor ~]# cd /dm8/script/root/
[root@monitor root]# ./dm_service_installer.sh -t dmmonitor -p DMMONITOR -monitor_ini /dm8/data/dmmonitor.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmMonitorServiceDMMONITOR.service to /usr/lib/systemd/system/DmMonitorServiceDMMONITOR.service.
创建服务(DmMonitorServiceDMMONITOR)完成

三 切换测试

3.1 主切备(将DMSVR01切换为备库)

3.1.1 主备同步测试
--主库插入数据
[dmdba@test1 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于主库打开状态
登录使用时间 : 2.721(ms)
disql V8
SQL> create table t1 (id int);
操作已执行
已用时间: 43.027(毫秒). 执行号:701.
SQL> insert into t1 values(1);
影响行数 1

已用时间: 0.856(毫秒). 执行号:702.
SQL> commit;
操作已执行
已用时间: 2.513(毫秒). 执行号:703.

--备库查询
[dmdba@test2 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于备库打开状态
登录使用时间 : 4.122(ms)
disql V8
SQL> select * from t1;

行号     ID         
---------- -----------
1          1

已用时间: 2.095(毫秒). 执行号:101.
3.1.2 switchover切换
switchover
[monitor]         2024-07-27 10:11:22: 开始切换实例DMSVR02
[monitor]         2024-07-27 10:11:22: 通知守护进程DMSVR01切换SWITCHOVER状态
[monitor]         2024-07-27 10:11:22: 守护进程(DMSVR01)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR01为SWITCHOVER状态成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR02切换SWITCHOVER状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR02)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR02为SWITCHOVER状态成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_APPLY_KEEP_PKG()语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_APPLY_KEEP_PKG()语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE STANDBY语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE STANDBY语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE PRIMARY语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE PRIMARY语句成功
[monitor]         2024-07-27 10:11:23: 通知实例DMSVR02修改所有归档状态无效
[monitor]         2024-07-27 10:11:23: 修改所有实例归档为无效状态成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:11:23: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR01切换OPEN状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR01)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR01为OPEN状态成功
[monitor]         2024-07-27 10:11:23: 通知守护进程DMSVR02切换OPEN状态
[monitor]         2024-07-27 10:11:23: 守护进程(DMSVR02)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:11:23: 切换守护进程DMSVR02为OPEN状态成功
[monitor]         2024-07-27 10:11:23: 通知组(GRP1)的守护进程执行清理操作
[monitor]         2024-07-27 10:11:23: 清理守护进程(DMSVR01)请求成功
[monitor]         2024-07-27 10:11:23: 清理守护进程(DMSVR02)请求成功
[monitor]         2024-07-27 10:11:23: 实例DMSVR02切换成功

2024-07-27 10:11:23 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:11:23  GLOBAL    VALID     OPEN           DMSVR02          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          
192.168.10.100  5236       OK        DMSVR02          OPEN        PRIMARY   0          0            REALTIME  VALID       4968            43219           4968            43393           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:11:23  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  INVALID  

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          
192.168.10.99  5236       OK        DMSVR01          OPEN        STANDBY   0          0            REALTIME  INVALID     4967            43218           4967            43218           NONE                  

DATABASE(DMSVR01) APPLY INFO FROM (DMSVR02), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4967, 4967, 4967], (RLSN, SLSN, KLSN)[43218, 43218, 43218], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43218)


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

[monitor]         2024-07-27 10:11:26: 守护进程(DMSVR02)状态切换 [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 02:11:26  RECOVERY       OK        DMSVR02          OPEN        PRIMARY   VALID    5        43393           43393           

[monitor]         2024-07-27 10:11:29: 守护进程(DMSVR02)状态切换 [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 02:11:30  OPEN           OK        DMSVR02          OPEN        PRIMARY   VALID    5        43393           43393

确认状态。当前DMSVR02已切换为主库

show
2024-07-27 10:12:36 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:12:36  GLOBAL    VALID     OPEN           DMSVR02          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          
192.168.10.100  5236       OK        DMSVR02          OPEN        PRIMARY   0          0            REALTIME  VALID       4970            43393           4970            43393           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:12:35  GLOBAL    VALID     OPEN           DMSVR01          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          
192.168.10.99  5236       OK        DMSVR01          OPEN        STANDBY   0          0            REALTIME  VALID       4970            43393           4970            43393           NONE                  

DATABASE(DMSVR01) APPLY INFO FROM (DMSVR02), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4970, 4970, 4970], (RLSN, SLSN, KLSN)[43393, 43393, 43393], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43393)


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

在这里插入图片描述

3.2 备切主(将DMSVR01切换为主库)

3.2.1主备同步测试
--主库插入数据
[dmdba@test2 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于主库打开状态
登录使用时间 : 3.486(ms)
disql V8
SQL> insert into t1 values(2);
影响行数 1

已用时间: 12.692(毫秒). 执行号:801.
SQL> commit;
操作已执行
已用时间: 2.173(毫秒). 执行号:802.

--备库查询
[dmdba@test1 bin]$ ./disql dmtest/Dameng123

服务器[LOCALHOST:5236]:处于备库打开状态
登录使用时间 : 2.643(ms)
disql V8
SQL> select * from t1;

行号     ID         
---------- -----------
1          1
2          2

已用时间: 0.573(毫秒). 执行号:801.
3.2.2 switchover切换
switchover
[monitor]         2024-07-27 10:17:14: 开始切换实例DMSVR01
[monitor]         2024-07-27 10:17:14: 通知守护进程DMSVR02切换SWITCHOVER状态
[monitor]         2024-07-27 10:17:14: 守护进程(DMSVR02)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:17:14: 切换守护进程DMSVR02为SWITCHOVER状态成功
[monitor]         2024-07-27 10:17:14: 通知守护进程DMSVR01切换SWITCHOVER状态
[monitor]         2024-07-27 10:17:14: 守护进程(DMSVR01)状态切换 [OPEN-->SWITCHOVER]
[monitor]         2024-07-27 10:17:14: 切换守护进程DMSVR01为SWITCHOVER状态成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(0, 6)语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR02开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR02执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行SP_APPLY_KEEP_PKG()语句
[monitor]         2024-07-27 10:17:14: 实例DMSVR01执行SP_APPLY_KEEP_PKG()语句成功
[monitor]         2024-07-27 10:17:14: 实例DMSVR01开始执行ALTER DATABASE MOUNT语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE MOUNT语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行ALTER DATABASE STANDBY语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行ALTER DATABASE STANDBY语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行ALTER DATABASE PRIMARY语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE PRIMARY语句成功
[monitor]         2024-07-27 10:17:15: 通知实例DMSVR01修改所有归档状态无效
[monitor]         2024-07-27 10:17:15: 修改所有实例归档为无效状态成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行ALTER DATABASE OPEN FORCE语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行ALTER DATABASE OPEN FORCE语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR02开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR02执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01开始执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句
[monitor]         2024-07-27 10:17:15: 实例DMSVR01执行SP_SET_GLOBAL_DW_STATUS(6, 0)语句成功
[monitor]         2024-07-27 10:17:15: 通知守护进程DMSVR02切换OPEN状态
[monitor]         2024-07-27 10:17:15: 守护进程(DMSVR02)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:17:15: 切换守护进程DMSVR02为OPEN状态成功
[monitor]         2024-07-27 10:17:15: 通知守护进程DMSVR01切换OPEN状态
[monitor]         2024-07-27 10:17:15: 守护进程(DMSVR01)状态切换 [SWITCHOVER-->OPEN]
[monitor]         2024-07-27 10:17:15: 切换守护进程DMSVR01为OPEN状态成功
[monitor]         2024-07-27 10:17:15: 通知组(GRP1)的守护进程执行清理操作
[monitor]         2024-07-27 10:17:15: 清理守护进程(DMSVR01)请求成功
2024-07-27 10:17:15 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:17:15  GLOBAL    VALID     OPEN           DMSVR01          OK        1     1     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID    

[monitor]         2024-07-27 10:17:15: 清理守护进程(DMSVR02)请求成功
[monitor]         2024-07-27 10:17:15: 实例DMSVR01切换成功

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          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4976            43418           4976            43591           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:17:15  GLOBAL    VALID     OPEN           DMSVR02          OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  INVALID  

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          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  INVALID     4975            43417           4975            43417           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4975, 4975, 4975], (RLSN, SLSN, KLSN)[43417, 43417, 43417], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43417)


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

[monitor]         2024-07-27 10:17:18: 守护进程(DMSVR01)状态切换 [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 10:17:18  RECOVERY       OK        DMSVR01          OPEN        PRIMARY   VALID    6        43591           43591           

[monitor]         2024-07-27 10:17:20: 守护进程(DMSVR01)状态切换 [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN            
                  2024-07-27 10:17:20  OPEN           OK        DMSVR01          OPEN        PRIMARY   VALID    6        43591           43591           

确认状态。当前DMSVR01已切换为主库

show
2024-07-27 10:18:07 
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG  
GRP1             8888        TRUE            AUTO            FALSE     


<<DATABASE GLOBAL INFO:>>
DW_IP          MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.99  65101        2024-07-27 10:18:06  GLOBAL    VALID     OPEN           DMSVR01          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          
192.168.10.99  5236       OK        DMSVR01          OPEN        PRIMARY   0          0            REALTIME  VALID       4977            43591           4977            43591           NONE                  

<<DATABASE GLOBAL INFO:>>
DW_IP           MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT    
192.168.10.100  65121        2024-07-27 02:18:07  GLOBAL    VALID     OPEN           DMSVR02          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          
192.168.10.100  5236       OK        DMSVR02          OPEN        STANDBY   0          0            REALTIME  VALID       4977            43591           4977            43591           NONE                  

DATABASE(DMSVR02) APPLY INFO FROM (DMSVR01), REDOS_PARALLEL_NUM (1), WAIT_APPLY[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4977, 4977, 4977], (RLSN, SLSN, KLSN)[43591, 43591, 43591], N_TSK[0], TSK_MEM_USE[0] 
REDO_LSN_ARR: (43591)


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

在这里插入图片描述

;