1.实验环境:
操作系统:银河麒麟V10
primary 192.168.17.7
standby 192.168.17.8
monitor 192.168.17.9
2.配置主机名:
hostnamectl set-hostname primary
hostnamectl set-hostname standby
hostnamectl set-hostname monitor
3.检查防火墙
systemctl status firewalld
检查Selinux
getenforce
4.安装DM8数据库
5.集群端口规划
数据库名 | 实例名 | PORT_NUM | MAL_HOST | MAL_PORT | MAL_DW_PORT | MAL_INST_DW_PORT |
DM01 | DMSVR01 | 5236 | 192.168.17.7 | 55101 | 65101 | 45101 |
DM01 | DMSVR02 | 5236 | 192.168.17.8 | 55121 | 65121 | 45121 |
6.初始化实例
7.DMRMAN备份主库
./DmServiceDMSVR01 stop
mkdir /dm8/backup
备份主库
RMAN> backup database '/dm8/data/DM01/dm.ini' full to full_02 backupset '/dm8/backup/full_02'
主库备份文件传到备库/dm8/backup
scp -r /dm8/backup/full_02/ [email protected]:/dm8/backup/
备库恢复
RMAN> restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup/full_02'
restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup/full_02'
file dm.key not found, use default license!
[Percent:0.00%][Speed:0.00M/s][Cost:00:00:01][Remaining:00:00:00]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.272
RMAN> recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup/full_02'
recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup/full_02'
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[31459], file_lsn[31459]
备份集[/dm8/backup/full_02]备份过程中未产生日志
recover successfully!
time used: 264.016(ms)
RMAN> recover database '/dm8/data/DM01/dm.ini' update db_magic
recover database '/dm8/data/DM01/dm.ini' update db_magic
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[31459], file_lsn[31459]
recover successfully!
time used: 00:00:01.013
8.编辑主库配置文件
vim dm.ini
INSTANCE_NAME = DM01
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
vim dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.17.7
MAL_PORT = 55101
MAL_INST_HOST = 192.168.17.7
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.17.8
MAL_PORT = 55121
MAL_INST_HOST = 192.168.17.8
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
vim dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
vim dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 666666
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
启动主库到mount状态
[dmdba@primary bin]$ ./dmserver /dm8/data/DM01/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 4-2-18-21.08.20-146029-10013-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-09-04
file lsn: 31459
ndct db load 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.
配置主库
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
SQL> SP_SET_OGUID(666666);
SQL> ALTER DATABASE PRIMARY;
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
配置主库
[dmdba@primary bin]$ ./disql sysdba/DM01SYSDBA
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 1.081(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
DMSQL 过程已成功完成
已用时间: 3.782(毫秒). 执行号:0.
SQL> SP_SET_OGUID(666666);
DMSQL 过程已成功完成
已用时间: 1.234(毫秒). 执行号:1.
SQL> ALTER DATABASE PRIMARY;
操作已执行
已用时间: 2.789(毫秒). 执行号:0.
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
DMSQL 过程已成功完成
已用时间: 2.715(毫秒). 执行号:2.
[dmdba@primary bin]$ ./disql sysdba/DM01SYSDBA
服务器[LOCALHOST:5236]:处于主库配置状态
登录使用时间 : 0.843(ms)
disql V8
SQL>
9.编辑备库配置文件
vim dm.ini
INSTANCE_NAME = DM01
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
[dmdba@standby DM01]$ cat dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.17.7
MAL_PORT = 55101
MAL_INST_HOST = 192.168.17.7
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.17.8
MAL_PORT = 55121
MAL_INST_HOST = 192.168.17.8
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
[dmdba@standby DM01]$ cat dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[dmdba@standby DM01]$ cat dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 666666
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
启动备库到mount状态
./dmserver /dm8/data/DMDW/dm.ini mount
[dmdba@standby bin]$ ./dmserver /dm8/data/DM01/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 4-2-18-21.08.20-146029-10013-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-09-04
file lsn: 31459
ndct db load 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.
配置备库
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
SQL> SP_SET_OGUID(666666);
SQL> ALTER DATABASE STANDBY;
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
配置备库
[dmdba@standby bin]$ ./disql sysdba/DM01SYSDBA
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 1.081(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
DMSQL 过程已成功完成
已用时间: 6.510(毫秒). 执行号:0.
SQL> SP_SET_OGUID(666666);
DMSQL 过程已成功完成
已用时间: 1.372(毫秒). 执行号:1.
SQL> ALTER DATABASE STANDBY;
操作已执行
已用时间: 2.569(毫秒). 执行号:0.
SQL>
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
DMSQL 过程已成功完成
已用时间: 2.717(毫秒). 执行号:2.
SQL> exit
[dmdba@standby bin]$ ./disql sysdba/DM01SYSDBA
服务器[LOCALHOST:5236]:处于备库配置状态
登录使用时间 : 1.063(ms)
disql V8
SQL>
10.启动dmwatcher
主库启动
./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
备库启动
./dmwatcher /dm8/data/DM01/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
11.配置监视器
vim 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 = 666666
MON_DW_IP = 192.168.17.7:65101
MON_DW_IP = 192.168.17.8:65121
启动监视器
./dmmonitor /dm8/dmmonitor.ini
启动监视器
[dmdba@monitor bin]$ ./dmmonitor /dm8/dmmonitor.ini
[monitor] 2022-08-21 14:18:04: DMMONITOR[4.0] V8
[monitor] 2022-08-21 14:18:04: DMMONITOR[4.0] IS READY.
[monitor] 2022-08-21 14:18:04: 收到守护进程(DMSVR02)消息
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_O PEN FLSN CLSN
2022-08-21 14:18:04 OPEN OK DMSVR02 OPEN STANDBY NULL 4 33803 33803
[monitor] 2022-08-21 14:18:04: 收到守护进程(DMSVR01)消息
WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_O PEN FLSN CLSN
2022-08-21 14:18:03 OPEN OK DMSVR01 OPEN PRIMARY VALID 4 33803 33803
主备库切换
LOGIN
SWITCHOVER
11.注册服务
主库:[root@primary root]# ./dm_service_installer.sh -t dmwatcher -p DMWATCHER -watcher_ini /dm8/data/DM01/dmwatcher.ini
备库:[root@standby root]# ./dm_service_installer.sh -t dmwatcher -p DMWATCHER -watcher_ini /dm8/data/DM01/dmwatcher.ini
监视器:[root@monitor root]# ./dm_service_installer.sh -t dmmonitor -p DMmonitor -monitor_ini /dm8/dmmonitor.ini
12.实时主备集群重启顺序要求:
1、关闭监视器
2、关闭主库守护进程
3、关闭备库守护进程
4、关闭主库实例
5、关闭备库实例
6、启动主库实例 (mount)
7、启动备库实例 (mount)
8、启动主库守护进程 (open)
9、启动备库守护进程 (open)
10、启动监视器
标签:数据库,DM01,PORT,INST,达梦,dm8,MAL,守护,ini From: https://www.cnblogs.com/zongwen/p/16609848.html