注册
DCP认证考试-守护集群搭建-学习总结
专栏/培训园地/ 文章详情 /

DCP认证考试-守护集群搭建-学习总结

哈是哈士奇的哈 2024/06/21 410 0 0
摘要

考试前一定要多练习几遍

1、关闭主库服务,做冷备,并将备份拷贝到备机上

[dmdba@localhost bin]$ ./dmrman
RMAN>backup database '/dm8/data/DM01/dm.ini' backupset '/dm8/backup';
[dmdba@localhost backup1]$ scp back* dmdba@192.168.224.135:/dm8/backup

2、配置主库的 dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini 文件
2.1 dm.ini 参数:

ALTER_MODE_STATUS = 0 
ENABLE_OFFLINE_TS = 2 
MAL_INI = 1 
ARCH_INI = 1 

2.2其他配置文件

配置 dmmal.ini 文件
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = DMSVR01
MAL_HOST = 192.168.224.133
MAL_PORT = 55101
MAL_INST_HOST = 192.168.224.133
MAL_INST_PORT = 5236
MAL_DW_PORT = 65101
MAL_INST_DW_PORT = 45101
[MAL_INST2]
MAL_INST_NAME =DMSVR02
MAL_HOST = 192.168.224.135
MAL_PORT = 55121
MAL_INST_HOST = 192.168.224.135
MAL_INST_PORT = 5236
MAL_DW_PORT = 65121
MAL_INST_DW_PORT = 45121

配置归档日志文件:
[dmdba@localhost DAMENG]$ cat dmarch.ini
ARCH_WAIT_APPLY = 0
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = DMSVR02
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 0
ARCH_FLUSH_BUF_SIZE = 0
ARCH_HANG_FLAG = 1

配置 dmwatcher.ini 文件
[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/DM01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

3、将主库启动到 mount 状态

[dmdba@localhost bin]$ ./dmserver /dm8/data/DM01/dm.ini mount
如果失败,那就检查一下dmarch.ini、dmwatcher.ini、dmmal.ini 文件名称和内容

4、修改主库的配置 要在./dm8/bin 目录下执行

[dmdba@localhost bin]$ ./disql sysdba/DM01SYSDBA
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.备机上初始化数据库,并恢复数据库
5.1用命令行初始化数据库实例

[dmdba@localhost bin]$ ./dminit db_name=DM01 instance_name=DMSVR02 port_num=5236 path=/dm8/data

5.2使用dbca.sh注册数据库实例
5.3还原数据库操作

[dmdba@localhost bin]$ ./dmrman
RMAN> restore database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
RMAN> recover database '/dm8/data/DM01/dm.ini' from backupset '/dm8/backup';
RMAN> recover database '/dm8/data/DM01/dm.ini' update db_magic;

6、配置备库的 dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini
可以将主库的文件传到备考

scp dmarch.ini dmwatcher.ini dmarch.ini dmdba@192.168.224.135:/dm8/data/DM01

注意:dmarch.ini要修改

7、启动备库到 mount 状态

[dmdba@localhost bin]$ ./dmserver /dm8/data/DA01/dm.ini mount
如果失败,那就检查一下dmarch.ini、dmwatcher.ini、dmmal.ini 文件**名称和内容**

8、修改备库的配置

[dmdba@localhost bin]$ ./disql sysdba/DM01SYSDBA@192.168.224.135:5236
SQL> sp_set_oguid(8888);
SQL> alter database standby;

9、分别启动主库和备库上的守护进程

[dmdba@localhost bin]$ ./dmwatcher /dm8/data/DM01/dmwatcher.ini

10、配置监视器 注意log的路径

[GRP1]
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 = 8888
MON_DW_IP = 192.168.224.134:65101
MON_DW_IP = 192.168.224.135:65121

11、启动监视器

[dmdba@localhost bin]$ ./dmmonitor /dm8/data/dmmonitor.ini

12、login、show、switchover试一下,如果有问题,排查一下问题
12.1 disql查一下主库、备库状态,要处于打开状态,不能是配置状态
12.2 看一下防火墙是否关闭

1、查看状态:systemctl status firewalld
2、关闭:    systemctl stop firewalld
3、关闭自启: systemctl disable firewalld

13、注册数据守护集群服务: root用户

主库:
[root@localhost ~]# cd /dm8/script/root/ 
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -p DMSVR01 -watcher_ini /dm8/data/DM01/dmwatcher.ini
备库:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -watcher_ini /dm8/data/DM01/dmwatcher.ini -p DMSVR02
监视器:
[root@localhost ~]# cd /dm8/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmmonitor -monitor_ini /dm8/data/dmmonitor.ini -p monitor

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服