1 环境准备
主机 | IP地址 | 实例名 | 操作系统 |
---|---|---|---|
DSC1 | 外部⽹络:192.168.1.81 内部⽹络:172.16.1.81 | RAC0 | CentOS7 |
DSC2 | 外部⽹络:192.168.1.82 内部⽹络:172.16.1.82 | RAC1 | CentOS7 |
2 安装DM数据库(各节点都需要)
2.1 关闭防⽕墙
[root@DSC1 ~]# systemctl stop firewalld
[root@DSC1 ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multiuser.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbusorg.fedoraproject.FirewallD1.service.
Redhat6:
[root@DSC1 ~]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[root@DSC1 ~]# chkconfig iptables off
[root@DSC1 ~]# chkconfig --list iptables
2.2 关闭Selinux
[root@DSC1 ~]# vim /etc/selinux/config
2.3 创建DM⽤户
⽤户组为:dinstall,⽤户名为:dmdba,⽤户⽬录为:/home/dmdba,⽤户密码:123456
[root@DSC1 ~]# groupadd dinstall
[root@DSC1 ~]# useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba
[root@DSC1 ~]# passwd dmdba
2.4 创建⽬录
用于存储dm数据库文件的空间,需要提前规划并挂载好
[root@DSC1 ~]# mkdir -p /dm/dmdbms
#将dm目录指定给dmdba用户#
[root@DSC1 ~]# chown -R dmdba:dinstall /dm
#给dm目录授权#
[root@DSC1 ~]# chmod -R 775 /dm
2.5 配置系统限制
2.5.1 修改ulimit参数
[root@DSC1 ~]# cp /etc/security/limits.conf /etc/security/limits.conf.bak
#在/etc/security/limits.conf ⽂件中添加如下内容:#
[root@DSC1 ~]# vim /etc/security/limits.conf
dmdba soft nofile 65546
dmdba hard nofile 65536
2.5.2 验证配置ulimit是否⽣效
重启操作系统,并切换⾄dmdba⽤户查看
[dmdba@DSC1 ~]$ ulimit -a
2.6 配置环境变量
在dmdba⽤户~/.bash_profile ⾥添加如下内容:
[dmdba@DSC1 ~]$ vim ~/.bash_profile
export DM_HOME="/dm/dmdbms"
export LD_LIBRARY_PATH="/dm/dmdbms/bin:$LD_LIBRARY_PATH"
export PATH="/dm/dmdbms/bin:$PATH"
使环境变量⽣效
[dmdba@DSC1 ~]$ source ~/.bash_profile
2.7 上传DM安装程序到/dm
使⽤root⽤户给DMInstall.bin程序授权
[root@DSC1 dm8]# chmod 755 ./DMInstall.bin
2.8 运⾏DM安装程序
⽤dmdba⽤户运⾏DM安装程序进⾏命令⾏安装
[dmdba@DSC1 dm8]$ ./DMInstall.bin -i
3 共享存储环境准备(虚拟化环境配置)
规划6个共享存储如下:
Dcr disk: 1G
Voting disk: 2G
Log disk: 3G
Data disk1: 4G
Data disk2: 5G
Data disk3: 6G
先在你本机的vmware安装目录上找到 vmware-vdiskmanager.exe 执行文件。D:\VMware\VMwareWorkstation\vmware-vdiskmanager.exe
C:\Users\Administrator>cd /d D:\VMware\VMwareWorkstation
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 1Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskDcr.vmdk”
Creating disk ‘E:\VirtualMachines\Disk\SharedDiskDcr.vmdk’
Create: 100% done.
Virtual disk creation successful.
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 2Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskVoting.vmdk”
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 3Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskLog.vmdk”
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 4Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskData1.vmdk”
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 5Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskData2.vmdk”
D:\VMware\VMwareWorkstation>vmware-vdiskmanager.exe -c -s 6Gb -a lsilogic -t 2 “E:\VirtualMachines\Disk\SharedDiskData3.vmdk”
4 绑定UDEV(各节点都需要)
4.1 查看创建好raw设备
[root@DSC1 ~]# fdisk -l|grep "/dev/sd*"
4.2 创建UDEV绑定脚本
由于划分了多个磁盘,这些盘符在每次系统启动后并不唯⼀,所以我先使⽤UDEV绑定后,再 绑定成raw设备。
在/dm⽬录下创建udev.sh并添加如下内容:
[root@DSC1 rules.d]# cd /dm/
[root@DSC1 dm]# vim udev.sh
for i in b c d e f g;
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+=\"asmdisk$i\",OWNER=\"dmdba\", GROUP=\"dinstall\",MODE=\"0660\"" >> /etc/udev/rules.d/99-dm-devices.rules
done
redhat6:
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-dm-devices.rules
4.3 执⾏UDEV绑定脚本
给创建好的udev.sh加权限
[root@DSC1 dm8]# chmod +x udev.sh
执⾏绑定脚本
[root@DSC1 dm8]# ./udev.sh
4.4 查看执⾏脚本结果
[root@DSC1 dm]# cat /etc/udev/rules.d/99-dm-devices.rules
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBc8b95773-b5e7cd0e", SYMLINK+="asmdiskb",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VBd447f8dc-a465ceae", SYMLINK+="asmdiskc",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB59d5a474-db42a119", SYMLINK+="asmdiskd",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB26af17be-273062ba", SYMLINK+="asmdiske",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB1f1f4e1c-7202894c", SYMLINK+="asmdiskf",OWNER="dmdba", GROUP="dinstall",MODE="0660"
KERNEL=="sd?",SUBSYSTEM=="block", PROGRAM=="/usr/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="1ATA_VBOX_HARDDISK_VB3b308365-65e3a776", SYMLINK+="asmdiskg",OWNER="dmdba", GROUP="dinstall",MODE="0660"
4.5 重启UDEV
[root@DSC1 ~]# /sbin/udevadm trigger --type=devices --action=change
[root@DSC1 ~]# /sbin/udevadm control --reload-rules
4.6 查看绑定
[root@DSC1 dm8]# ll /dev/asm*
5 配置raw设备(各节点都需要)
5.1 修改/etc/rc.local⽂件
在官⽅⽂档raw的配置是写⼊到/etc/udev/rules.d/60-raw.rules ⽂件,但因为我们之前的 UDEV 规则顺序⽐60-raw低,所以我们这⾥把raw配置直接写⼊到/etc/rc.local 中,以防映射失败。
在rc.local 中添加如下内容:
[root@DSC1 ~]# chmod +x /etc/rc.d/rc.local
[root@DSC1 ~]# vim /etc/rc.d/rc.local
#DCR
raw /dev/raw/raw1 /dev/asmdiskb
sleep 2
chown dmdba:dinstall /dev/raw/raw1
chmod 660 /dev/raw/raw1
#Votingdisk
raw /dev/raw/raw2 /dev/asmdiskc
sleep 2
chown dmdba:dinstall /dev/raw/raw2
chmod 660 /dev/raw/raw2
#LOG
raw /dev/raw/raw3 /dev/asmdiskd
sleep 2
chown dmdba:dinstall /dev/raw/raw3
chmod 660 /dev/raw/raw3
#Data
raw /dev/raw/raw4 /dev/asmdiske
sleep 2
chown dmdba:dinstall /dev/raw/raw4
chmod 660 /dev/raw/raw4
touch /var/lock/subsys/local
#注意这里必须放在最后一行,否则开机不会自动映射raw设备。
5.2 查看裸设备⼤⼩
[root@DSC1 ~]# reboot
[root@DSC1 ~]# blockdev --getsize64 /dev/raw/raw1
1073741824
6 配置dmdcr_cfg.ini ⽂件
在2个节点的/dm/dmdbms/data⽬录下创建配置⽂件dmdcr_cfg.ini,在⽂件中添加如下内容:
[root@DSC1 dmdbms]# su - dmdba
[dmdba@DSC1 ~]$ mkdir /dm/dmdbms/data
[dmdba@DSC1 ~]$ vim /dm/dmdbms/data/dmdcr_cfg.ini
DCR_N_GRP = 3
DCR_VTD_PATH = /dev/raw/raw2
DCR_OGUID = 63635
[GRP]
DCR_GRP_TYPE = CSS
DCR_GRP_NAME = GRP_CSS
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_CSS]
DCR_EP_NAME = CSS0
DCR_EP_HOST = 172.16.1.81
DCR_EP_PORT = 9541
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 172.16.1.82
DCR_EP_PORT = 9542
[GRP]
DCR_GRP_TYPE = ASM
DCR_GRP_NAME = GRP_ASM
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_ASM]
DCR_EP_NAME = ASM0
DCR_EP_SHM_KEY = 93360
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 192.168.1.81
DCR_EP_PORT = 9641
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP_ASM]
DCR_EP_NAME = ASM1
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 192.168.1.82
DCR_EP_PORT = 9642
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_RAC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_RAC]
DCR_EP_NAME = RAC0
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741
[GRP_RAC]
DCR_EP_NAME = RAC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9742
7 使⽤ DMASMCMD ⼯具初始化
在任意⼀台节点上⽤dmasmcmd⼯具执⾏如下命令:
[dmdba@DSC1 ~]$ dmasmcmd
DMASMCMD V8
ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 6.444(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 6.290(ms).
ASM>create asmdisk '/dev/raw/raw3' 'LOG0'
[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMLOG0
Used time: 12.429(ms).
ASM>create asmdisk '/dev/raw/raw4' 'DATA0'
[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA0
Used time: 11.047(ms).
ASM>init dcrdisk '/dev/raw/raw1' from '/dm/dmdbms/data/dmdcr_cfg.ini' identified by 'dameng123'
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
Used time: 130.824(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: 32.514(ms).
8 准备DMASM 的 MAL 配置⽂件(dmasvrmal.ini)
在2个节点的/dm/dmdbms/data⽬录下创建 DMASM 的 MAL 配置⽂件(命名为 dmasvrmal.ini),使⽤ DMASM 的所有节点都要配置,内容完全⼀样。
[dmdba@DSC1 ~]$ vim /dm/dmdbms/data/dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 172.16.1.81
MAL_PORT = 7236
[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 172.16.1.82
MAL_PORT = 7237
9 准备dmdcr.ini 配置⽂件
dmdcr.ini 是 dmcss、dmasmsvr、dmasmtool ⼯具的输⼊参数。记录了当前节点序列号以 及 DCR 磁盘路径。
在2个节点的/dm8/dmdbms/data⽬录下创建dmdcr.ini 配置⽂件,dmdcr_path 相同,dmasvrmal.ini ⽂件内容也相同,dmdcr_seqo 分别为 0 和 1。
节点DSC1
[dmdba@DSC1 ~]$ vim /dm/dmdbms/data/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm/dmdbms/data/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 0
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /dm/dmdbms/bin/dmasmsvr dcr_ini=/dm/dmdbms/data/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm/dmdbms/bin/dmserver path=/dm/dmdbms/data/rac0_config/dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini
节点DSC2
[dmdba@DSC2 ~]$ vim /dm/dmdbms/data/dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm/dmdbms/data/dmasvrmal.ini #dmasmsvr 使用的 MAL 配置文件路径
DMDCR_SEQNO = 1
#ASM 重启参数,命令行方式启动
DMDCR_ASM_RESTART_INTERVAL = 0
DMDCR_ASM_STARTUP_CMD = /dm/dmdbms/bin/dmasmsvr dcr_ini=/dm/dmdbms/data/dmdcr.ini
#DB 重启参数,命令行方式启动
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm/dmdbms/bin/dmserver path=/dm/dmdbms/data/rac1_config/dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini
10 启动DMCSS、DMASM 服务程序
10.1 分别在2个节点注册DMCSS和DMASM服务
以root⽤户执⾏
节点DSC1
注册DMCSS服务
[root@DSC1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicerac1.service to /usr/lib/systemd/system/DmCSSServicerac1.service.
创建服务(DmCSSServicerac1)完成
注册DMASM服务
[root@DSC1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac1 -y DmCSSServicerac1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmASMSvrServicerac1.service to /usr/lib/systemd/system/DmASMSvrServicerac1.service.
创建服务(DmASMSvrServicerac1)完成
节点DSC2
注册DMCSS服务
[root@DSC2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac2
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicerac2.service to /usr/lib/systemd/system/DmCSSServicerac2.service.
创建服务(DmCSSServicerac2)完成
注册DMASM服务
[root@DSC2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac2 -y DmCSSServicerac2
Created symlink from /etc/systemd/system/multi-user.target.wants/DmASMSvrServicerac2.service to /usr/lib/systemd/system/DmASMSvrServicerac2.service.
创建服务(DmASMSvrServicerac2)完成
10.2 启动DMCSS和DMASM 服务
#节点DSC1
[root@DSC1 ~]# service DmCSSServicerac1 start
Redirecting to /bin/systemctl start DmCSSServicerac1.service
[root@DSC1 ~]# service DmASMSvrServicerac1 start
Redirecting to /bin/systemctl start DmASMSvrServicerac1.service
#节点DSC2
[root@DSC2 ~]# service DmCSSServicerac2 start
[root@DSC2 ~]# service DmASMSvrServicerac2 start
10.3 ⼿⼯启动命令
⼿⼯启动命令如下,⼿⼯启动后窗⼝不能关闭,所以这⾥仅作了解,不运⾏:
#⼿动启动 dmcss 命令:
dmcss DCR_INI=/dm8/dmdbms/data/dmdcr.ini
#⼿动启动 dmasmsvr 命令:
dmasmsvr DCR_INI=/dm8/dmdbms/data/dmdcr.ini
11 创建DMASM磁盘组
在任意节点使⽤ dmasmtool ⼯具创建 DMASM 磁盘组。
[dmdba@DSC1 ~]$ dmasmtool DCR_INI=/dm/dmdbms/data/dmdcr.ini
DMASMTOOL V8
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 111.881(ms).
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 119.307(ms).
12 准备dminit.ini 配置⽂件
在2个节点的/dm/dmdbms/data⽬录下创建 dminit.ini 配置⽂件,添加如下内容。 在2个节点都创建。
[dmdba@DSC1 ~]$ vim /dm/dmdbms/data/dminit.ini
db_name = rac
system_path = +DMDATA/data
system = +DMDATA/data/rac/system.dbf
system_size = 128
roll = +DMDATA/data/rac/roll.dbf
roll_size = 128
main = +DMDATA/data/rac/main.dbf
main_size = 128
ctl_path = +DMDATA/data/rac/dm.ctl
ctl_size = 8
log_size = 256
dcr_path = /dev/raw/raw1 #dcr 磁盘路径,目前不支持 asm,只能是裸设备
dcr_seqno = 0
auto_overwrite = 1
[RAC0] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm/dmdbms/data/rac0_config
port_num = 5236
mal_host = 172.16.1.81
mal_port = 9340
log_path = +DMLOG/log/rac0_log01.log
log_path = +DMLOG/log/rac0_log02.log
[RAC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm/dmdbms/data/rac1_config
port_num = 5236
mal_host = 172.16.1.82
mal_port = 9341
log_path = +DMLOG/log/rac1_log01.log
log_path = +DMLOG/log/rac1_log02.log
13 使⽤dminit 初始化 DB 环境
在任意节点启动 dminit ⼯具初始化数据库。dminit 执⾏完成后,会在 config_path ⽬录 (/dm/dmdbms/data/rac0_config 和/dm/dmdbms/data/rac1_config)下⽣成配置⽂件 dm.ini 和 dmmal.ini。
[dmdba@DSC1 data]$ dminit control=/dm/dmdbms/data/dminit.ini
initdb V8
db version: 0x7000b
file dm.key not found, use default license!
License will expire on 2021-12-07
log file path: +DMLOG/log/rac0_log01.log
log file path: +DMLOG/log/rac0_log02.log
log file path: +DMLOG/log/rac1_log01.log
log file path: +DMLOG/log/rac1_log02.log
write to dir [+DMDATA/data/rac].
create dm database success. 2021-01-03 20:59:45
#将rac1的配置⽂件复制过去节点DSC2:
[dmdba@DSC1 data]$ cd /dm/dmdbms/data/
[dmdba@DSC1 data]$ scp -r rac1_config/ 192.168.1.82:`pwd`
The authenticity of host '192.168.1.82 (192.168.1.82)' can't be established.
ECDSA key fingerprint is SHA256:ODW+OT9h3hEMrTLxeZ9UXsGZZz1claHTGdSdx14+nAY.
ECDSA key fingerprint is MD5:aa:5a:7f:be:3d:56:4f:0f:7b:51:34:2a:dc:19:05:e7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.82' (ECDSA) to the list of known hosts.
dmdba@192.168.1.82's password:
dmmal.ini 100% 202 94.4KB/s 00:00
dm.ini 100% 48KB 7.8MB/s 00:00
sqllog.ini 100% 479 264.8KB/s 00:00
14 启动数据库服务器
14.1 注册服务
在2个节点分别注册DM 数据库服务:
#节点DSC1
[root@DSC1 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm/dmdbms/data/rac0_config/dm.ini -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac1 -y DmASMSvrServicerac1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicerac1.service to /usr/lib/systemd/system/DmServicerac1.service.
创建服务(DmServicerac1)完成
#节点DSC2
[root@DSC2 ~]# /dm/dmdbms/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm/dmdbms/data/rac1_config/dm.ini -dcr_ini /dm/dmdbms/data/dmdcr.ini -p rac2 -y DmASMSvrServicerac2
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicerac2.service to /usr/lib/systemd/system/DmServicerac2.service.
创建服务(DmServicerac2)完成
14.2 启动数据库
#节点DSC1
[root@DSC1 ~]# systemctl start DmServicerac1
#节点DSC2
[root@DSC2 ~]# systemctl start DmServicerac2
如果 DMCSS 配置有⾃动拉起 dmserver 的功能,可以等待 DMCSS ⾃动拉起实例,不需要手动启动。
14.3 ⼿⼯启动命令
⼿⼯启动命令如下,⼿⼯启动后窗⼝不能关闭,所以…
./dmserver /dm8/dmdbms/data/rac0_config/dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini
./dmserver /dm8/dmdbms/data/rac1_config/dm.ini dcr_ini=/dm/dmdbms/data/dmdcr.ini
15 连接数据库验证
15.1 配置dm_svc.conf服务名⽂件
[root@DSC1 ~]# vim /etc/dm_svc.conf
rac=(192.168.1.81:5236,192.168.1.82:5236)
SWITCH_TIME=(10000)
SWITCH_INTERVAL=(100)
TIME_ZONE=(480)
LANGUAGE=(cn)
[root@DSC1 ~]# chown dmdba:dinstall /etc/dm_svc.conf
15.2 连接RAC集群
[dmdba@DSC1 ~]$ disql sysdba/SYSDBA@rac
服务器[192.168.1.82:5236]:处于普通打开状态
登录使用时间 : 9.221(ms)
disql V8
SQL> select instance_name from v$instance;
行号 INSTANCE_NAME
---------- -------------
1 RAC1
已用时间: 6.222(毫秒). 执行号:100.
SQL> select * from v$dsc_ep_info;
行号 EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1 RAC0 0 808391232 808391691 Control Node OK
2 RAC1 1 808399522 808399956 Normal Node OK
已用时间: 15.359(毫秒). 执行号:101.
SQL>
15.3 测试故障重连
SQL> select instance_name from v$instance;
行号 INSTANCE_NAME
---------- -------------
1 RAC1
已用时间: 1.027(毫秒). 执行号:102.
#此时连接的rac1,我们kill 进程:
[root@DSC2 ~]# ps -ef|grep dm.ini
dmdba 4465 1 0 21:09 ? 00:00:06 /dm/dmdbms/bin/dmserver /dm/dmdbms/data/rac1_config/dm.ini DCR_INI=/dm/dmdbms/data/dmdcr.ini -noconsole
root 31843 4086 0 21:20 pts/1 00:00:00 grep --color=auto dm.ini
[root@DSC2 ~]# kill -9 4465
#在查询,等了⼀分钟左右,故障重连成功:
SQL> select instance_name from v$instance;
行号 INSTANCE_NAME
---------- -------------
1 RAC1
已用时间: 1.027(毫秒). 执行号:102.
SQL> select instance_name from v$instance;
[-70019]:网络通讯失败.
SQL> select instance_name from v$instance;
服务器[192.168.1.81:5236]:处于普通打开状态
已连接
行号 INSTANCE_NAME
---------- -------------
1 RAC0
已用时间: 9.406(毫秒). 执行号:51200.
#启动rac0,节点0变成了normal:
[root@DSC2 ~]# service DmServicerac2 start
Redirecting to /bin/systemctl start DmServicerac2.service
SQL> select * from v$dsc_ep_info;
行号 EP_NAME EP_SEQNO EP_GUID EP_TIMESTAMP EP_MODE EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1 RAC0 0 808391232 808392157 Control Node OK
2 RAC1 1 808682009 808682033 Normal Node OK