达梦数据库如何解除主从关系
环境:
OS:Centos 7
DB:DMV8
在需要解除主从关系的数据库服务器上操作
1.停掉dmwatcher并删除服务
[root@host02 root]# systemctl stop DmWatcherServiceGRP1
[root@host02 root]# cd /dmdbms/product/script/root
[root@host02 root]# ./dm_service_uninstaller.sh -n DmWatcherServiceGRP1
2.删除实时归档
[dmdba@host02 DAMENG]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME #实时归档类型
ARCH_DEST = DAMENG #实时归档目标实例名,这里是主库的实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST = /dmdbms/arch #本地归档文件存放路径
ARCH_FILE_SIZE = 2048 #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0 #单位Mb,0 表示无限制,范围 1024~4294967294M
ARCH_FLUSH_BUF_SIZE = 0
ARCH_HANG_FLAG = 1
删除实时归档部分
3.若在该机器配置部署了监控机的话也要删除
[root@host02 root]# cd /dmdbms/product/script/root
[root@host02 root]#systemctl stop DmMonitorServiceMonitor
[root@host02 root]# ./dm_service_uninstaller.sh -n DmMonitorServiceMonitor
4.删除dmmal.ini配置文件
注意这里还需要修改配置文件,把MAL_INI参数原来的1改成0,ALTER_MODE_STATUS原来的0该成1
vi /dmdbms/data/DAMENG/dm.ini
MAL_INI= 0 #dmmal.ini
ALTER_MODE_STATUS =1
5.重启数据库
systemctl stop DmServiceDMSERVER.service
systemctl start DmServiceDMSERVER.service
6.重置oguid并修改模式
SQL>alter database mount;
SQL>sp_set_oguid(0);
SQL>alter database normal;
SQL> alter database open;
SQL> select name,status$,mode$,OGUID from v$instance;
LINEID name status$ mode$ OGUID
---------- --------- ------- ------ -----------
1 DAMENGBAK OPEN NORMAL 0
used time: 0.590(ms). Execute id is 504.