目录
2、DMDSC+DMDataWatch(2+2)节点服务器系统的安装
3.2 分别在primary/standby识别到添加的共享存储
6.3准备DMASM 的 MAL 配置文件(dmasvrmal.ini)
8.3.1修改dmdscprimary1的dmarch.ini文件
8.3.2修改dmdscprimary2的dmarch.ini文件
8.3.3修改dmdscstandby1的dmarch.ini文件
8.3.4修改dmdscstandby2的dmarch.ini文件
8.13 验证dmdscprimary+dmdatawatch+dmdscstandby
前言
数据库行业发展中,两地三中心是灾备问题最佳最高级的解决方案,众多数据库品牌都推出了相应的技术架构。但是Oracle数据库的Oracle RAC DataGuard(2+2)在过去一直无法替代,原因为不具备共享存储架构的产品和可靠的DG技术。经过多年的自主研发,国产达梦数据库已经实现共享存储架构DSC和数据守护技术Data Watch,对可替换Oracle RAC DataGuard (2+2)的DM8达梦共享存储数据库集DMDSC数据库数据守护DM Data Watch(2+2)进行了搭建测试。
1、项目规划
1.1 基本需求调研和虚拟环境搭建要求
需求名称 | 需求内容 |
业务系统 | DMDSC+DMDataWatch(2+2) |
主机名 | dmdscprimary1/dmdscprimary2/dmdscprimarymonitor/dmdscstandby1/ dmdscstandby2/dmdscstandbymonitor |
IP地址 | 192.168.2.204~208/213 |
OS | RHEL LINUX 7.6_ x64 |
db name | dscprimary/dscstandby |
instance name | dscprimary1/dscprimary2、dscstandby1/dscstandby2 |
数据库版本 | DM8 |
实验机为DIY的服务器CPU主机,做测试验证用途。
实验机 | 具体型号 | 参数 |
CPU | 志强E5-2680v2(服务器拆机) | 10核20线程 |
内存 | 三星DDR3(服务器拆机) | 64G |
硬盘 | SSD(新购)+机械硬盘(台式机闲置) | 1T+4T |
虚拟机的要求:2C,4G
虚拟机存储要求:/:30g
1.2 网络系统的规划
主机类型 | IP地址 | 实例名 | 操作系统 |
主库1 | 192.168.2.204(对外) 10.10.20.204(内部) | dmdscprimary1 | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
主库2 | 192.168.2.205(对外) 10.10.20.205(内部) | dmdscprimary2 | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
主库监控 | 192.168.2.206(对外) 10.10.20.206(内部) | dmdscprimarymonitor | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
备库1 | 192.168.2.207(对外) 10.10.20.207(内部) | dmdscstandby1 | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
备库2 | 192.168.2.208(对外) 10.10.20.208(内部) | dmdscstandby2 | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
备库监控 | 192.168.2.213(对外) 10.10.20.213(内部) | dmdscstandbymonitor | Red Hat Enterprise Linux Server release 7.5 (Maipo) |
1.3 本地存储和共享存储的规划
本地存储 | 路径 |
安装目录 | /dm/dmdbms |
备份目录 | /dm/dmbak |
归档目录 | /dm/dmarch |
共享存储 | 容量 |
dcrdisk: | 1024m |
votedisk: | 2078m |
logdisk: | 3074m |
datadisk: | 4096m |
2、DMDSC+DMDataWatch(2+2)节点服务器系统的安装
虚拟机软件:vbox
3、DMDSC共享存储规划与配置
3.1在vbox虚拟机上配置4块共享存储
3.2 分别在primary/standby识别到添加的共享存储
3.3 获取UUID,绑定udev
for i in b c d e;
do
echo "KERNEL==\"sd?\",SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\",RESULT==\"`/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", SYMLINK+=\"dm-disk$i\",OWNER=\"dmdba\", GROUP=\"dinstall\",MODE=\"0660\""
done
/sbin/udevadm trigger --type=devices --action=change
/sbin/udevadm control --reload-rules
4、DMDSC for linux7系统参数设置
4.1 关闭防火墙和selinux
systemctl stop firewalld
systemctl disable firewalld
vi /etc/selinux/config(selinux=disabled)
4.2创建DM用户
groupadd dinstall
useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
passwd dmdba
4.3创建目录
mkdir -p /dm/dmdbms
mkdir -p /dm/dmarch
mkdir -p /dm/dmbak
chown -R dmdba:dinstall /dm/
chmod -R 775 /dm/
4.4配置系统限制
cat >> /etc/security/limits.conf << EOF
dmdba soft nofile 65535
dmdba hard nofile 65535
EOF
4.5配置环境变量
su - dmdba
vi ~/.bash_profile
export PATH="$DM_HOME/bin:$PATH"
source ~/.bash_profile
5、安装DM 数据库
mount -o loop dm8_setup_rh7_64_ent_8.1.0.147_20190328.iso /mnt/
cd /mnt/
cp DMInstall.bin /dm/
chown dmdba:dinstall DMInstall.bin
su - dmdba
./DMInstall.bin -i
6、安装部署DMDSC
6.1 配置dmdcr_cfg.ini 文件
6.2使用 DMASMCMD 工具初始化
在dmdscprimary/dscstandby中一节点上执行:
[root@dscprimary1 ~]# su - dmdba
[dmdba@ dscprimary1 ~]$ dmasmcmd
DMASMCMD V8.1.0.147-Build(2019.03.27-104581)ENT
ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 9.134(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 8.760(ms).
ASM>create asmdisk '/dev/raw/raw3' 'log0'
[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMLOG0
Used time: 7.536(ms).
ASM>create asmdisk '/dev/raw/raw4' 'data0'
[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA0
Used time: 8.811(ms).
ASM>init dcrdisk '/dev/raw/raw1' from '/dm/dmdbms/data/dmdcr_cfg.ini' identified by 'dmdsc'
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
Used time: 145.364(ms).
ASM>init votedisk '/dev/raw/raw2' from '/dm/dmdbms/data/dmdcr_cfg.ini'
[Trace]DG 125 allocate 4 extents for file 0xfd000002.
Used time: 27.909(ms)
6.3准备DMASM 的 MAL 配置文件(dmasvrmal.ini)
6.4准备dmdcr.ini 配置文件
[root@dmdscprimary1 ~]# cat /dm/dmdbms/data/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm/dmdbms/data/dmasvrmal.ini
DMDCR_SEQNO = 0
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /dm/dmdbms/bin/dmasmsvr dcr_ini=/dm/dmdbms/data/dmdcr.ini
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm/dmdbms/bin/dmserver path=/dm/dmdbms/data/dmdscprimary1_config/dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini mount
6.5注册启动DMCSS和DMASM服务
[root@dmdscprimary1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary1
[root@dmdscprimary1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary1 -y DmCSSServicedmdscprimary1
[root@dmdscprimary2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary2
[root@dmdscprimary2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary2 -y DmCSSServicedmdscprimary2
dscprimary1:
[root@dscprimary1 ~]$ systemctl start DmCSSServicedmdscprimary1
[root@dscprimary1 ~]$ systemctl start DmASMSvrServicedmdscprimary1
dscprimary2:
[root@dscprimary2 ~]$ systemctl start DmCSSServicedmdscprimary2
[root@dscprimary2 ~]$ systemctl start DmASMSvrServicedmdscprimary2
dscstandby1:
[root@dscstandby1 ~]$ systemctl start DmCSSServicedmdscprimary1
[root@dscprimary1 ~]$ systemctl start DmASMSvrServicedmdscprimary1
dscstandby2:
[root@dscstandby2 ~]$ systemctl start DmCSSServicedmdscprimary2
[root@dscstandby2 ~]$ systemctl start DmASMSvrServicedmdscprimary2
6.6创建DMASM磁盘组
[root@dscprimary1 ~]# su - dmdba
[dmdba@dscprimary1 ~]$ dmasmtool DCR_INI=/dm/dmdbms/data/dmdcr.ini
DMASMTOOL V8.1.0.147-Build(2019.03.27-104581)ENT
ASM>create diskgroup 'dmlog' asmdisk '/dev/raw/raw3'
Used time: 00:00:08.219.
ASM>create diskgroup 'dmdata' asmdisk '/dev/raw/raw4'
Used time: 00:00:05.349.
6.7准备dminit.ini 配置文件
6.8使用dminit 初始化 DB 环境
dminit control=/dm/dmdbms/data/dminit.ini
cd /dm/dmdbms/data
scp -r dmdscprimary2_config 192.168.2.205:`pwd`
6.8启动数据库服务器
[root@dm8dsc1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm/dmdbms/data/dmdscprimary1_config/dm.ini -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary1 -y DmASMSvrServicedmdscprimary1
[root@dm8dsc2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm/dmdbms/data/dmdscprimary2_config/dm.ini -dcr_ini /dm/dmdbms/data/dmdcr.ini -p dmdscprimary2 -y DmASMSvrServicedmdscprimary2
[root@dmdscprimary1 ~]# systemctl start DmServicedmdscprimary1
[root@dmdscprimary2 ~]# systemctl start DmServicedmdscprimary2
6.9 配置启动DMCSSM监控器
6.10 配置服务名
6.11 dmdsc搭建结果验证
SQL> select instance_name from v$instance;
LINEID INSTANCE_NAME
1 dmdscprimary1
SQL> select * from v$dsc_ep_info;
LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
1 dmdscprimary1 0 302666758 302833218 MASTER OK
2 dmdscprimary2 1 302846646 302866784 SLAVE OK
[dmdba@dmdscprimary1 dmdscprimary1_config]$ ps -ef|grep dm.ini
dmdba 3556 /dm/dmdbms/bin/dmserver /dm/dmdbms/data/dmdscprimary1_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini -noconsole
[dmdba@dmdscprimary1 dmdscprimary1_config]$ kill -9 3556
SQL> select instance_name from v$instance;
[-70065]:Connection exception, switch the current connection sucessful.
SQL> select instance_name from v$instance;
LINEID INSTANCE_NAME
1 dmdscprimary1
SQL> select * from v$dsc_ep_info;
LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
1 dmdscprimary1 0 304343758 302843282 MASTER ERROR
2 dmdscprimary2 1 302844346 305451058 MASTER OK
[dmdba@ dmdscprimary1~]$ systemctl DmServicedmdscprimary1 start
SQL> select * from v$dsc_ep_info;
LINEID EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
1 dmdscprimary1 0 304343758 302843282 MASTER OK
2 dmdscprimary2 1 302844346 305451058 SLAVE OK
7、配置DMDSC主库备份数据环境
7.1 配置dmarch.ini
cat /dm/dmdbms/data/dmdscprimary1_config/dm.ini|grep "CONFIG_PATH"
(1)配置dmdscprimary1的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscprimary2
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
(2)配置dmdscprimary2的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscprimary1
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
7.2 配置dm.ini
分别编辑主库dmdsc两个节点的dm.ini文件,打开归档参数:
ARCH_INI = 1 #打开归档配置
7.3 数据准备
7.3.1.对主库进行联、脱机备份操作
BACKUP DATABASE BACKUPSET 'db_full_bak_primary_01';
./dmrman use_ap=2 dcr_ini=/dm/dmdbms/data/dmdcr.ini;
RMAN>BACKUP DATABASE '/dm/dmdbms/data/dmdscprimary1_config/dm.ini' FULL BACKUPSET '/dm/dmbak/db_full_bak_primary_01';
7.3.2.搭建DMDSC环境作为备库
scp -r db_full_bak_primary_01 192.168.2.207:`pwd`
7.3.3.还原恢复新增备库
./dmrman use_ap=2 dcr_ini=/dm/dmdbms/data/dmdcr.ini
RMAN>RESTORE DATABASE '/dm/dmdbms/data/dmdscstandby1_config/dm.ini' FROM BACKUPSET '/dm/dmbak/db_full_bak_primary_01';
RMAN>RECOVER DATABASE '/dm/dmdbms/data/dmdscstandby1_config/dm.ini' FROM BACKUPSET '/dm/dmbak/db_full_bak_primary_01';
RMAN>RECOVER DATABASE '/dm/dmdbms/data/dmdscstandby1_config/dm.ini' UPDATE DB_MAGIC;
8 配置DMDSC主备环境
8.1 配置dm.ini
dmdscprimary1/dmdscstandby1
INSTANCE_NAME = dmdscprimary1
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
dmdscprimary2/dmdscstandby2
INSTANCE_NAME = dmdscprimary2
PORT_NUM = 5236
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64
8.2 配置dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = dmdscprimary1
MAL_HOST = 10.10.20.204
MAL_PORT = 9340
MAL_INST_HOST = 192.168.2.204
MAL_INST_PORT = 5236
MAL_DW_PORT = 5536
MAL_INST_DW_PORT = 5336
[MAL_INST2]
MAL_INST_NAME = dmdscprimary2
MAL_HOST = 10.10.20.205
MAL_PORT = 9341
MAL_INST_HOST = 192.168.2.205
MAL_INST_PORT = 5237
MAL_DW_PORT = 5537
MAL_INST_DW_PORT = 5337
[MAL_INST3]
MAL_INST_NAME = dmdscstandby1
MAL_HOST = 10.10.20.207
MAL_PORT = 9340
MAL_INST_HOST = 192.168.2.207
MAL_INST_PORT = 5236
MAL_DW_PORT = 5536
MAL_INST_DW_PORT = 5336
[MAL_INST4]
MAL_INST_NAME = dmdscstandby2
MAL_HOST = 10.10.20.208
MAL_PORT = 9341
MAL_INST_HOST = 192.168.2.208
MAL_INST_PORT = 5237
MAL_DW_PORT = 5537
MAL_INST_DW_PORT = 5337
8.3 配置dmarch.ini
8.3.1修改dmdscprimary1的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscprimary2
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = dmdscstandby1/dmdscstandby2
8.3.2修改dmdscprimary2的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL #本地归档类型
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0 [ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscprimary1
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = dmdscstandby1/dmdscstandby2
8.3.3修改dmdscstandby1的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscstandby2
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = dmdscprimary1/dmdscprimary2
8.3.4修改dmdscstandby2的dmarch.ini文件
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/dmarch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
[ARCHIVE_REMOTE]
ARCH_TYPE = REMOTE
ARCH_DEST = dmdscstandby1
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0
ARCH_INCOMING_PATH = /dm/dmbak/arch_remote
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = dmdscprimary1/dmdscprimary2
8.4配置dmwatcher.ini
dmdscprimary1
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 453331
DCR_INI = /dm/dmdbms/data/dmdcr.ini
INST_INI = /dm/dmdbms/data/dmdscprimary1_config/dm.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
dmdscprimary2
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 453331
DCR_INI = /dm/dmdbms/data/dmdcr.ini
INST_INI = /dm/dmdbms/data/dmdscprimary2_config/dm.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
dmdscstandby1
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 453331
DCR_INI = /dm/dmdbms/data/dmdcr.ini
INST_INI = /dm/dmdbms/data/dmdscstandby1_config/dm.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
dmdscstandby2
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = MANUAL
DW_ERROR_TIME = 60
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 30
INST_OGUID = 453331
DCR_INI = /dm/dmdbms/data/dmdcr.ini
INST_INI = /dm/dmdbms/data/dmdscstandby2_config/dm.ini
INST_AUTO_RESTART = 0
INST_STARTUP_CMD = /dm/dmdbms/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0
8.5 配置dmmonitor.ini
MON_DW_CONFIRM = 0
MON_LOG_PATH = /dm/dmdbms/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 453331
MON_DW_IP = 10.10.20.204:5536/10.10.20.205:5537
MON_DW_IP = 10.10.20.207:5536/10.10.20.208:5537
8.6 配置dmdcr.ini
8.6.1. 打开dmdscprimary1的自动拉起参数
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/bin/dmserver path=/dm/dmdbms/data/dmdscprimary1_config /dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini mount
8.6.2. 打开dmdscprimary2的自动拉起参数
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/bin/dmserver path=/dm/dmdbms/data/dmdscprimary2_config /dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini mount
8.6.3. 打开dmdscstandby1的自动拉起参数
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/bin/dmserver path=/dm/dmdbms/data/dmdscstandby2_config /dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini mount
8.6.4. 打开dmdscstandby2的自动拉起参数
DMDCR_DB_RESTART_INTERVAL = 60
DMDCR_DB_STARTUP_CMD = /dm/bin/dmserver path=/dm/dmdbms/data/dmdscstandby1_config /dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini mount
8.7 启动主备库
[dmdba@dmdscprimary1]$ cd /dm/dmdbms/bin
[dmdba@ dmdscprimary]$./dmserver /dm/dmdbms/data/dmdscprimary1_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini mount
[dmdba@dmdscprimary2]$ cd /dm/dmdbms/bin
[dmdba@dmdscprimary2]$./dmserver /dm/dmdbms/data/dmdscprimary2_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini mount
[dmdba@dmdscstandby1]$ cd /dm/dmdbms/bin
[dmdba@dmdscstandby1]$./dmserver /dm/dmdbms/data/dmdscstandby1_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini mount
[dmdba@dmdscstandby2]$ cd /dm/dmdbms/bin
[dmdba@dmdscstandby2]$./dmserver /dm/dmdbms/data/dmdscstandby2_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini mount
8.8 设置OGUID(在主备库任意节点执行)
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);
8.9 修改主备库模式
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
SQL> alter database primary;
SQL> alter database standby;
SQL> SP_SET_PARA_ VALUE(1, 'ALTER_MODE_STATUS', 0);
8.10 启动监视器
./dmmonitor path=/dm/dmdbms/data/dmmonitor.ini
./dmcssm ini_path=/dm/dmdbms/data/dmcssm.ini
8.11 启动守护进程
./dmwatcher /dm/dmdbms/data/dmdscprimary1_config/dmwatcher.ini
./dmwatcher /dm/dmdbms/data/dmdscprimary2_config/dmwatcher.ini
./dmwatcher /dm/dmdbms/data/dmdscstandby1_config/dmwatcher.ini
./dmwatcher /dm/dmdbms/data/dmdscstandby2_config/dmwatcher.ini
8.12 注册服务
[root@dmdscprimary1 dmdscprimary1_config]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/dmdbms/data/dmdscprimary1_config/dmwatcher.ini -p dmdscprimary1
[root@dmdscprimary2 dmdscprimary2_config]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/dmdbms/data/dmdscprimary2_config/dmwatcher.ini -p dmdscprimary2
[root@dmdscstandby1 dmdscstandby1_config]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/dmdbms/data/dmdscstandby1_config/dmwatcher.ini -p dmdscstandby1
[root@dmdsc standby2 dmdscstandby2_config]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmwatcher -watcher_ini /dm/dmdbms/data/dmdscstandby2_config/dmwatcher.ini -p dmdscstandby2
8.13 验证dmdscprimary+dmdatawatch+dmdscstandby
8.14 primary与standby切换测试
总结
综上,DM8 达梦共享存储数据库集群DMDSC数据库数据守护DM Data Watch(2+2)环境搭建完成。通过验证环境工作正常,根据整个搭建过程,综合以往搭建Oracle RAC Data Guard (2+2) 的经验总结以下几点:
1、搭建难易程度:
DM数据库安装简单,对运维人员的linux运维能力要求中等,DMDSC配置信息和ASM磁盘创建内容清晰,监视器可以监控整个安装过程,Data Watch搭建配置信息皆为独立的配置文件,方便查看;
Oracle数据库安装OS参数设置参数较多,对运维人员Linux运维能力要求较高,RAC安装过程非中等专业人员无法进行命令行安装,DG的配置过程繁杂,公共资料很多,但对于报错尝鲜小白还必须要重新安装;
2、运维难易程度:
DM数据库通过自带监视器可以清晰查看整体环境运行状况,就算非本厂运维人员也很容易发现问题,减短问题出现时间段,且实验环境配置要求较低,容易上手进行实验,更容易掌握;
Oracle数据库运维常用命令众多,运维人员短时间无法进行工作,自行实验环境要求较高,参照公共资料进步也较缓慢;
大话DM数据库和Oracle数据库来说,DM数据库好比英雄联盟游戏,上手容易,参与度高,更适合大部分玩家,从菜鸟到高手过程很开心,头发掉的少;Oracle数据库好比DOTA,玩法攻略众多,但实际操作较难,而且老玩家居多,起点过高,很容易丧失信心,也很容易被虐;
伴随DM8 达梦共享存储数据库集群DMDSC数据库数据守护DM Data Watch(2+2)的落地实现,并将促进整个国产化进程的快速发展,达梦数据库产品的多样化,也会吸引越来越多客户的使用,达梦数据库技术生态的越发完善也会吸引所有数据库从业人员和数据库技术爱好者的参与,时光不语,未来可期,期待达梦数据库的一体机产品。