数据守护集群搭建
1、关闭主机数据库
bin目录: ./DmServiceDMSERVER stop
2、dmrman 做冷备
bin目录:./dmrman
backup database '/dm8/data/DAMENG/dm.ini' backupset '/dm8/backup 备份到backup文件夹
远程复制到备机backup目录
scp backup.* dmdba@192.168.116.135:/dm8/backup
3、配置主库的 dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini 文件
cd /dm8/data/DAMENG/
vi dm.ini
修改 以下配置参数
ALTER_MODE_STATUS = 0 不允许修改
ENABLE_OFFLINE_TS = 2 不允许表空间离线
MAL_INI = 1
ARCH_INI = 1 开归档
vi dmmach.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
vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSERVER
MAL_HOST = 192.168.116.134
MAL_PORT = 15236
MAL_INST_HOST = 192.168.116.134
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME = DMSERVER2
MAL_HOST = 192.168.116.135
MAL_PORT = 15236
MAL_INST_HOST = 192.168.116.135
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[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/DAMENG/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
4、将主库启动到 mount 状态
[dmdba@localhost bin]$ ./DmServiceDMSERVER start mount
[dmdba@localhost ~]$ cd /dm8/bin
[dmdba@localhost bin]$ ./disql sysdba/Dameng123
[dmdba@localhost bin]$ ./disql sysdba/Dameng123
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 62.109(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); 允许修改
SQL> sp_set_oguid(8888);
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0); 设置不允许修改
SQL> alter database primary; 切换成为主库
5、初始化备机数据库,并恢复数据库
[dmdba@localhost backup]$ cd /dm8/bin
[dmdba@localhost bin]$ ./dminit db_name=DAMENG instance_name=DMSERVER2 PATH=/dm8/data 初始化数据库实例
bih目录下
./dmrman
RMAN> restore database '/dm8/data/DAMENG/dm.ini' from backupset '/dm8/backup'; 还原
RMAN> recover database '/dm8/data/DAMENG/dm.ini' from backupset '/dm8/backup'; 恢复
RMAN> recover database '/dm8/data/DAMENG/dm.ini' update db_magic; 更新魔术
6、配置备库
scp dmmal.ini, dmdba@192.168.116.135:/dm8/data/DAMENG
scp dmarch.ini dmdba@192.168.116.135:/dm8/data/DAMENG
scp dmwatcher.ini dmdba@192.168.116.135:/dm8/data/DAMENG
Dmmain.ini 文件 主备是一样的
dmwatcher.ini 文件 主备一样
dmarch.ini 不同
[dmdba@localhost DAMENG]$ cat 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
7、启动备机到 mount 状态
[dmdba@localhost bin]$ ./dmserver /dm8/data/DAMENG/dm.ini mount
8、修改备库的配置
[dmdba@localhost ~]$ cd /dm8/bin
[dmdba@localhost bin]$ ./disql sysdba/Dameng123
服务器[LOCALHOST:5236]:处于普通配置状态
登录使用时间 : 5.749(ms)
disql V8
SQL> sp_set_oguid(8888);
SQL> alter database standby;
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
9、启动主库和备库上的守护进程
[dmdba@localhost bin]$ ./dmwatcher /dm8/data/DAMENG/dmwatcher.ini
10、配置监视器
cd /dm8/data
[dmdba@localhost data]$ cat dmmonitor.ini
监视器
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/data/logMON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 8888
MON_DW_IP = 192.168.116.134:65101 主机
MON_DW_IP = 192.168.116.135:65101 备机
[dmdba@localhost bin]$ ./dmmonitor /dm8/data/dmmonitor.ini 启动监视器
登录监视器:
login
用户名:sysdba
密码:
注册数据守护集群的服务:
主库:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -p DMSERVER -watcher_ini /dm8/data/DAMENG/dmwatcher.ini
备库:[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -watcher_ini /dm8/data/DAMENG/dmwatcher.ini -p DMSERVER2
切换主备:
登录监视器后:
switchover
配置连接服务名
[root@localhost bin]# cat /etc/dm_svc.conf
TIME_ZONE=(480)
LANGUAGE=(CN)
DAMENG=(192.168.240.101:5236,192.168.240.102:5236)
[dmdba@localhost ~]$ cd /dm8/bin
[dmdba@localhost bin]$ ./disql sysdba/Dameng123
select instance_name from v$instance; 查看
文章
阅读量
获赞