主库实例初始化
# dmdba用户操作(避免权限问题)
# 工具位置:/dm8/bin
./dminit PATH=/dm8/data DB_NAME=DM01 INSTANCE_NAME=DMSVR01 PORT_NUM=5236 PAGE_SIZE=16 EXTENT_SIZE=32 LOG_SIZE=500 CASE_SENSITIVE=Y SYSDBA_PWD=DM01SYSDBA SYSAUDITOR_PWD=DM01SYSDBA
# root 用户操作
# 脚本位置:/dm8/script/root
./dm_service_installer.sh -t dmserver -p DMSVR01 -dm_ini /dm8/data/DM01/dm.ini
备库实例初始化
# dmdba用户操作(避免权限问题)
# 工具位置:/dm8/bin
./dminit PATH=/dm8/data DB_NAME=DM01 INSTANCE_NAME=DMSVR02 PORT_NUM=5236 PAGE_SIZE=16 EXTENT_SIZE=32 LOG_SIZE=500 CASE_SENSITIVE=Y SYSDBA_PWD=DM01SYSDBA SYSAUDITOR_PWD=DM01SYSDBA
# root 用户操作
# 脚本位置:/dm8/script/root
./dm_service_installer.sh -t dmserver -p DMSVR02 -dm_ini /dm8/data/DM01/dm.ini
主库备份
# root用户操作
# 主库必须至少启动过一次,完成数据库的服务的初始化
systemctl start DmServiceDMSVR01
systemctl stop DmServiceDMSVR01
# dmdba用户操作(避免权限问题-备库操作用户若权限不足无法读取备份集文件)
# dmrman工具脱机全库备份
# 工具位置:/dm8/bin
# 备库提前创建/dm8/bak目录
./dmrman
backup database '/dm8/data/DM01/dm.ini' full to FULLBAK backupset '/dm8/bak/FULLBAK';
# 备份集传输备库主机
scp -r /dm8/bak/FULLBAK dmdba@192.168.18.212:/dm8/bak/FULLBAK
备库还原
# root用户操作
# 关闭数据库服务
systemctl start DmServiceDMSVR02
systemctl stop DmServiceDMSVR02
# dmrman工具脱机全库还原
# dmdba用户操作(避免权限问题-备库操作用户若权限不足无法读取备份集文件)
# 工具位置:/dm8/bin
./dmrman
restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/bak/FULLBAK';
recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/bak/FULLBAK';
recover database '/dm8/data/DM01/dm.ini' update db_magic;
主库配置文件
# dm.ini
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
# dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.18.211
MAL_PORT = 55101
MAL_INST_HOST = 192.168.18.211
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.18.212
MAL_PORT = 55121
MAL_INST_HOST = 192.168.18.212
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
# dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/DM01/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
# dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 453331
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
备库配置文件
# dm.ini
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
# dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.18.211
MAL_PORT = 55101
MAL_INST_HOST = 192.168.18.211
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSVR02
MAL_HOST = 192.168.18.212
MAL_PORT = 55121
MAL_INST_HOST = 192.168.18.212
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
# dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR01
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/DM01/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
# dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 453331
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
监视器配置文件
# dmmonitor.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 453331
MON_DW_IP = 192.168.18.211:65101
MON_DW_IP = 192.168.18.212:65121
启动主库
# mount模式启动
# 前台启动占用终端
./dmserver /dm8/data/DM01/dm.ini mount &
# 工具位置:/dm8/bin
./disql SYSDBA/DM01SYSDBA:5236
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL>sp_set_oguid(453331);
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
SQL>alter database primary;
# 启动守护进程
# 工具位置:/dm8/bin
./dmwatcher /dm8/data/DM01/dmwatcher.ini &
启动备库
# mount模式启动
# 前台启动占用终端
./dmserver /dm8/data/DM01/dm.ini mount &
# 工具位置:/dm8/bin
./disql SYSDBA/DM01SYSDBA:5236
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL>sp_set_oguid(453331);
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
SQL>alter database standby;
# 启动守护进程
# 工具位置:/dm8/bin
./dmwatcher /dm8/data/DM01/dmwatcher.ini &
启动监视器
# 工具位置:/dm8/bin
./dmmonitor /dm8/dmmonitor.ini
# 查看集群组
choose switchover GRP1
# 登陆监视器
login
username:SYSDBA
password:DM01SYSDBA
# 主备切换
switchover DMSVR02
文章
阅读量
获赞