注册
DW数据守护搭建
专栏/培训园地/ 文章详情 /

DW数据守护搭建

王彬 2024/11/27 314 0 0
摘要
  1. 配置清单
    准备3台测试服务器,01、02作为主备数据库,03作为监视器(dbmonitor)。
    dmtest01(192.168.219.123)
    dmtest02(192.168.219.124)
    dmtest03(192.168.219.125)
    主备库的配置规划如下,生产环境的 MAL_HOST 建议使用独立网段IP。

数据库名
实例名
PORT_NUM
MAL_INST_DW_PORT
MAL_HOST
MAL_PORT
DMTEST DMSERVER 5237 45101 192.168.219.123 55101
DMTEST DMSERVER2 5273 45121 192.168.219.124 55121
MAL_DW_PORT
65101
65121
2. 主库备份

以dmdba用户访问dmtest01

mkdir /dm8/backup
cd /dm8/bin
./DmServiceDMSERVER stop
./dmrman
BACKUP DATABASE '/dm8/data/DMTEST/dm.ini' FULL TO BACKUP_FILE1 BACKUPSET IL'/dm8/backup/BACKUP_FILE_01'
exit
scp /dm8/backup/BACKUP_FILE_01/. dmdba@192.168.219.124:/dm8/backup/BACKUP_FILE_01
3. 备库恢复还原

以dmdba用户访问dmtest02

cd /dm8/bin
./DmServiceDMSERVER2 stop
mkdir -p /dm8/backup/BACKUP_FILE_01
./dmrman
RESTORE DATABASE '/dm8/data/DMTEST/dm.ini' FROM BACKUPSET '/dm8/backup/BACKUP_FILE_01'
RECOVER DATABASE '/dm8/data/DMTEST/dm.ini' FROM BACKUPSET '/dm8/backup/BACKUP_FILE_01'
RECOVER DATABASE '/dm8/data/DMTEST/dm.ini' UPDATE DB_MAGIC
exit
4. 配置主库

(1) dm.ini 配置

以dmdba用户访问dmtest01

cd /dm8/data/DMTEST
vi dm.ini
编辑或修订如下内容:

INSTANCE_NAME = DMSERVER
PORT_NUM = 5237
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
(2) dmmal.ini 配置

cd /dm8/data/DMTEST
vi dmmal.ini
复制粘贴如下内容:

MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSERVER
MAL_HOST = 192.168.219.123
MAL_PORT = 55101
MAL_INST_HOST = 192.168.219.123
MAL_INST_PORT = 5237
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSERVER2
MAL_HOST = 192.168.219.124
MAL_PORT = 55121
MAL_INST_HOST = 192.168.219.124
MAL_INST_PORT = 5237
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
(3) dmarch.ini 配置

cd /dm8/data/DMTEST
vi dmarch.ini
复制粘贴如下内容:

[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSERVER2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
(4) dmwatcher.ini 配置

cd /dm8/data/DMTEST
vi 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/DMTEST/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
5. mount状态启动主库

/dm8/bin/dmserver /dm8/data/DMTEST/dm.ini mount
设置为手动更新配置:

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
设置OGUID:

SQL>sp_set_oguid(453331);
设置为主库:

SQL>alter database primary;
设置为不许手动更新配置:

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
6. 配置备库

(1) dm.ini 配置

以dmdba用户访问dmtest02

cd /dm8/data/DMTEST
vi dm.ini
编辑或修订如下内容:

INSTANCE_NAME = DMSERVER2
PORT_NUM = 5237
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
(2) dmmal.ini 配置

cd /dm8/data/DMTEST
vi dmmal.ini
复制粘贴如下内容:

MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSERVER
MAL_HOST = 192.168.219.123
MAL_PORT = 55101
MAL_INST_HOST = 192.168.219.123
MAL_INST_PORT = 5237
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSERVER2
MAL_HOST = 192.168.219.124
MAL_PORT = 55121
MAL_INST_HOST = 192.168.219.124
MAL_INST_PORT = 5237
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121
(3) dmarch.ini 配置

cd /dm8/data/DMTEST
vi dmarch.ini
复制粘贴如下内容:

[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSERVER
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
(4) dmwatcher.ini 配置

cd /dm8/data/DMTEST
vi 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/DMTEST/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
7. mount状态启动备库

/dm8/bin/dmserver /dm8/data/DMTEST/dm.ini mount
设置为手动更新配置:

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
设置OGUID:

SQL>sp_set_oguid(453331);
设置为主库:

SQL>alter database standby;
设置为不许手动更新配置:

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
8. 启动dmwatcher

以dmdba用户访问dmtest01

/dm8/bin/dmwatcher /dm8/data/DMTEST/dmwatcher.ini
以dmdba用户访问dmtest02

/dm8/bin/dmwatcher /dm8/data/DMTEST/dmwatcher.ini
9. 启动dmmonitor

以dmdba用户访问dmtest03

cd /dm8
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 = 453331
MON_DW_IP = 192.168.1.30:65101
MON_DW_IP = 192.168.1.20:65121
启动:

/dm8/bin/dmmonitor /dm8/dmmonitor.ini
10. 注册服务

以root用户访问dmtest01

cd /dm8/script/root
./dm_service_installer.sh -t dmwatcher -p DMWATCHER -watcher_ini /dm8/data/DMTEST/dmwatcher.ini
以root用户访问dmtest02

cd /dm8/script/root
./dm_service_installer.sh -t dmwatcher -p DMWATCHER -watcher_ini /dm8/data/DMTEST/dmwatcher.ini
以root用户访问dmtest03

cd /dm8/script/root
./dm_service_installer.sh -t dmmonitor -p DMMONITOR -monitor_ini /dm8/dmmonitor.ini
完成。

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服