达梦数据守护搭建
主备库初始化
./dminit path=/dmdata/data db_name=DM01 instance_name=DMSVR01 port_num=5236 page_size=16 extent_size=32 log_size=500 case_sensitive=1 SYSDBA_PWD=DM01SYSDBA
./dminit path=/dmdata/data db_name=DM02 instance_name=DMSVR02 port_num=5236 page_size=16 extent_size=32 log_size=500 case_sensitive=1 SYSDBA_PWD=DM01SYSDBA
注册服务
/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p DM01 -dm_ini /dmdata/data/DM01/dm.ini
/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmserver -p DM02 -dm_ini /dmdata/data/DM02/dm.ini
启动服务
./DmServiceDM01 start
配置watcher
dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 10
INST_ERROR_TIME = 120
INST_OGUID = 453331
INST_INI = /dmdata/data/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /home/dmdba/dmdbms/bin/DmServiceDM1 start
INST_RECOVER_TIME = 60
INST_SERVICE_IP_CHECK = 0
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
注册watcher服务
/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p DM01 -watcher_ini /dmdata/data/DM01/dmwatcher.ini
/home/dmdba/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -p DM02 -watcher_ini /dmdata/data/DM02/dmwatcher.ini
需要修改 dm.ini / dmarch.ini / dmmal.ini /dmawtcher.ini / dmmonitor.ini 参数文件,/home/dmdba/dmdbms/samples/ini_script/UTF-8 可查看模板
dm.ini需要修改的参数(主备都要改)
ALTER_MODE_STATUS=0
ENABLE_OFFLINE_TS=2
MAL_INI=1
ARCH_INI=1
dmmal.ini(主备库一致)
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
MAL_LOGIN_TIMEOUT = 15
MAL_BUF_SIZE = 2048
MAL_SYS_BUF_SIZE = 0
MAL_VPOOL_SIZE = 128
MAL_COMPRESS_LEVEL = 0
MAL_TEMP_PATH =
[MAL_INST1]
MAL_INST_NAME = DMSVR01 #和dm.ini文件中实例名一致
MAL_HOST = 192.168.101.190
MAL_PORT = 5636
MAL_INST_HOST = 192.168.101.190
MAL_INST_PORT = 5236
MAL_DW_PORT = 5536
MAL_INST_DW_PORT = 5336
[MAL_INST2]
MAL_INST_NAME = DMSVR02 #和dm.ini文件中实例名一致
MAL_HOST = 192.168.101.191
MAL_PORT = 5636
MAL_INST_HOST = 192.168.101.191
MAL_INST_PORT = 5236
MAL_DW_PORT = 5536
MAL_INST_DW_PORT = 5336
dmarch.ini (主备需要调整ARCH_DEST参数)
[ARCHIVE_LOCAL1] #REDO日志归档名
ARCH_TYPE = LOCAL #REDO日志归档类型
ARCH_DEST = /dmdata/data/arch #归档目标
ARCH_FILE_SIZE = 2048 #单个REDO日志归档文件大小
ARCH_SPACE_LIMIT = 20480 #REDO日志归档空间限制
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档
ARCH_DEST = DMSVR02 #主库设置备库节点,备库设置主库节点
dmmonitor.ini(只需要主库配置)
MON_DW_CONFIRM = 0
MON_LOG_PATH = /dmdata/data/monitorlog
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 453331
#IP 对应 dmmal.ini 中的 MAL_HOST,PORT 对应 dmmal.ini 中的 MAL_DW_PORT
MON_DW_IP = 192.168.101.190:5536
MON_DW_IP = 192.168.101.191:5536
配置完上述参数后,关闭数据库实例
备库同步
backup database '/dmdata/data/DM01/dm.ini' full backupset '/dmdata/data/DMTEST_BAK1223';
/home/dmdba/dmdbms/bin/dmrman CTLSTMT="RESTORE DATABASE '/dmdata/data/DM02/dm.ini' FROM BACKUPSET '/dmdata/data/DMTEST_BAK1223'"
/home/dmdba/dmdbms/bin/dmrman CTLSTMT="RECOVER DATABASE '/dmdata/data/DM02/dm.ini' FROM BACKUPSET '/dmdata/data/DMTEST_BAK1223'"
/home/dmdba/dmdbms/bin/dmrman CTLSTMT="RECOVER DATABASE '/dmdata/data/DM02/dm.ini' UPDATE DB_MAGIC"
./dmserver /dmdata/data/DM01/dm.ini mount
主库
SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
SP_SET_OGUID(453331);
ALTER DATABASE PRIMARY;
SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
./dmserver /dmdata/data/DM02/dm.ini mount
备库
SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
SP_SET_OGUID(453331);
ALTER DATABASE STANDBY;
SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
设置完成后先启动watcher 然后启动db
./DmWatcherServiceDM01 start
./DmWatcherServiceDM02 start
./DmServiceDM01 start
./DmServiceDM02 start