DM8 配置DMDSC主备环境(rac到单节点 )

配置DMDSC主备环境
DMDSC主备环境搭建和单节点主备环境搭建步骤类似,区别主要在于首先要准备DMDSC集群环境。

配置说明
DMDSC集群可以作为主库,也可以作为实时备库、即时备库或者异步备库,当DMDSC集群作为备库配置在数据守护系统中时,要将DMDSC集群作为一个整体配置在源库的dmarch.ini中,也就是DMDSC集群所有节点要配置在同一个归档配置项中,每个节点实例名以“/”分隔开来。

假如DMDSC集群有两个节点GRP1_RT_DSC01和GRP1_RT_DSC02,DMDSC集群要作为备库进行配置,其源库为A,则要在A的dmarch.ini文件中增加DMDSC集群的归档配置,这里以实时备库为例说明如下:

[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP1_RT_DSC01/GRP1_RT_DSC02

如果DMDSC集群要作为即时备库或者异步备库来配置,ARCH_DEST的配置方式和示例中是相同的,ARCH_TYPE则要分别替换为TIMELY或者ASYNC,中括号内的配置项名称中包含的归档类型也建议修改和ARCH_TYPE一致。

环境说明
下面以DMDSC集群和单节点之间搭建实时主备环境为例,对搭建步骤进行说明。

下列机器事先都安装了DM8,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为实时主备,主库DMDSC集群的三个节点实例名分别命名为“rac1”、“rac2”,备库命名为“rac_st”。

本次部署为2节点DSC为主库,单机达梦为物理备库

IP规划:

主机名	  服务ip	        心跳ip	        实例名	节点用途
dm8rac1	  10.10.13.201	10.10.13.201	rac1	rac节点1
dm8rac2	  10.10.13.202	10.10.13.202	rac2	rac节点2
dm8rac_st 10.10.13.227	10.10.13.227	rac_st	rac备库

端口规划:

实例名    port_num    mal_inst_dw_port    mal_host          mal_port    mal_dw_port  CSS端口	ASM端口	ASM的MAL端口	DCR检查实例端口
dm1       5236        5237                10.10.13.201      5238        5239         5240       5241    5242            5243
dm2       5236        5237                10.10.13.202      5238        5239         5240       5241    5242            5243
rac_st    5236        5237                10.10.13.227      5238        5239

DSC集群部署
共享存储

/dev/sdb	/dev/raw/raw1	dcr disk	10G
/dev/sdc	/dev/raw/raw2	voting disk	10G
/dev/sdd	/dev/raw/raw3	log disk	10G
/dev/sde	/dev/raw/raw4	data disk1	10G
/dev/sdf	/dev/raw/raw5	data disk2	10G
/dev/sdg	/dev/raw/raw6	data disk3	10G

二、操作系统配置
1、关闭防火墙和SELINUX

[root@gbase ~]# systemctl stop firewalld
[root@gbase ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@gbase ~]# systemctl status firewalld
   firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Dec 06 17:22:42 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 06 17:22:48 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 07 08:21:59 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 07 08:22:00 gbase systemd[1]: Stopped firewalld - dynamic firewall daemon.

[root@gbase ~]# setenforce 0
[root@gbase ~]# sed -i s:^SELINUX=.*$:SELINUX=disabled:g /etc/selinux/config
[root@gbase ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted


[root@gbase ~]# systemctl stop firewalld
[root@gbase ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@gbase ~]# systemctl status firewalld
   firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)

Dec 06 17:22:45 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 06 17:22:51 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 07 08:19:39 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 07 08:19:40 gbase systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@gbase ~]# setenforce 0
[root@gbase ~]# sed -i s:^SELINUX=.*$:SELINUX=disabled:g /etc/selinux/config
[root@gbase ~]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

2、修改主机名

[root@gbase ~]# hostname dm8rac1
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8rac1:g /etc/sysconfig/network
[root@gbase ~]# echo "
 > 10.10.13.201   dm8rac1
 > 10.10.13.202   dm8rac2" >> /etc/hosts
[root@gbase ~]# cat  /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 10.10.13.201   dm8rac1
 10.10.13.202   dm8rac2


[root@gbase ~]# hostname dm8rac2
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8rac2:g /etc/sysconfig/network
[root@gbase ~]#
[root@gbase ~]# echo "
>  10.10.13.201   dm8rac1
>  10.10.13.202   dm8rac2" >> /etc/hosts
[root@gbase ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 10.10.13.201   dm8rac1
 10.10.13.202   dm8rac2

三、 安装达梦软件

3.1检查Linux(Unix)系统信息

[root@dm8rac1 ~]# getconf LONG_BIT
64

[root@dm8rac2 ~]# getconf LONG_BIT
64

查询操作系统release信息

[root@dm8rac1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

[root@dm8rac2 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

3.2创建安装用户
为了减少对操作系统的影响,用户不应该以root系统用户来安装和运行DM。用户可以在安装之前为DM创建一个专用的系统用户。
1. 创建安装用户组dinstall。

[root@dm8rac1 ~]# groupadd dinstall

[root@dm8rac2 ~]# groupadd dinstall

2. 创建安装用户dmdba。

[root@dm8rac1 ~]# useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba

[root@dm8rac2 ~]# useradd -g dinstall -m -d /home/dmdba -s /bin/bash dmdba

3. 初始化用户密码。

[root@dm8rac1 ~]# passwd dmdba
Changing password for user dmdba.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

[root@dm8rac2 ~]# passwd dmdba
Changing password for user dmdba.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

3.3 Linux(Unix)下检查操作系统限制
在Linux(Unix)系统中,因为ulimit命令的存在,会对程序使用操作系统资源进行限制。为了使DM能够正常运行,建议用户检查当前安装用户的ulimit参数。

运行ulimit -a进行查询。如下图所示:

[root@dm8rac1 ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31152
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

[root@dm8rac2 ~]# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31152
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

参数使用限制:
1.data seg size
data seg size (kbytes, -d)
建议用户设置为1048576(即1GB)以上或unlimited(无限制),此参数过小将导致数据库启动失败。
2. file size
file size(blocks, -f)
建议用户设置为unlimited(无限制),此参数过小将导致数据库安装或初始化失败。
3. open files
open files(-n)
建议用户设置为65536以上或unlimited(无限制)。
4.virtual memory
virtual memory (kbytes, -v)
建议用户设置为1048576(即1GB)以上或unlimited(无限制),此参数过小将导致数据库启动失败。

如果用户需要为当前安装用户更改ulimit的资源限制,请修改文件/etc/security/limits.conf。

[root@dm8rac1 ~]# vi /etc/security/limits.conf
dmdba soft data unlimited
dmdba hard data unlimited
dmdba soft fsize unlimited
dmdba hard fsize unlimited
dmdba soft nofile 65536
dmdba hard nofile 65536

[root@dm8rac2 ~]# vi /etc/security/limits.conf
dmdba soft data unlimited
dmdba hard data unlimited
dmdba soft fsize unlimited
dmdba hard fsize unlimited
dmdba soft nofile 65536
dmdba hard nofile 65536

[root@dm8rac1 ~]# su - dmdba
[dmdba@dm8rac1 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited


[root@dm8rac2 ~]# su - dmdba
[dmdba@dm8rac2 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31152
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65536
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 4096
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

3.4.检查系统内存与存储空间
1.检查内存
为了保证DM的正确安装和运行,要尽量保证操作系统至少1GB的可用内存(RAM)。如果可用内存过少,可能导致DM安装或启动失败。用户可以
使用以下命令检查操作内存:
#获取内存总大小

[root@dm8rac1 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009068 kB

[root@dm8rac12 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009068 kB

#获取交换分区大小

[root@dm8rac1 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

[root@dm8rac2 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

#获取内存使用详情

[root@dm8rac1 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           0           6
Swap:             7           0           7

[root@dm8rac2 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           0           6
Swap:             7           0           7

2.检查存储空间
1) DM完全安装需要1GB的存储空间,用户需要提前规划好安装目录,预留足够的存储空间。用户在DM安装前也应该为数据库实例预留足够的存储空间,规划好数据路径和备份路径。用户可使用以下命令检查存储空间:
#查询目录/dm8可用空间

[root@dm8rac1 ~]# mkdir /dm8
[root@dm8rac1 ~]# chown -R dmdba:dinstall /dm8
[root@dm8rac1 ~]# chmod -R 775 /dm8

[root@dm8rac2 ~]# mkdir /dm8
[root@dm8rac2 ~]# chown -R dmdba:dinstall /dm8
[root@dm8rac2 ~]# chmod -R 775 /dm8

[root@dm8rac1 ~]# df -h /dm8
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /


[root@dm8rac2 ~]# df -h /dm8
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

2) DM安装程序在安装时将产生临时文件,临时文件需要1GB的存储空间,临时文件目录默认为/tmp。用户可以使用以下命令检查存储空间。
如下图所示:

[root@dm8rac1 ~]# df -h /tmp
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /


[root@dm8rac2 ~]# df -h /tmp
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   48G  5.6G   43G  12% /

3.5.安装DM
创建目录/soft/dmsoft用来存储挂载iso文件后来显示软件包中的文件

[root@dm8rac1 ~]# cd /soft
[root@dm8rac1 soft]# unzip dm8_20211021_x86_rh6_64_ent.zip
Archive:  dm8_20211021_x86_rh6_64_ent.zip
   creating: dm8_20211021_x86_rh6_64_ent/
  inflating: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso
 extracting: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso_SHA256.txt
 extracting: dm8_20211021_x86_rh6_64_ent/verinfo.txt
[root@dm8rac1 soft]# ls -lrt
total 778320
drwxr-xr-x. 2 root root       132 Nov 12 13:43 dm8_20211021_x86_rh6_64_ent
-rw-r--r--. 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip
[root@dm8rac1 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8rac1 soft]# ls -lrt
total 778320
drwxr-xr-x. 2 root root       132 Nov 12 13:43 dm8
-rw-r--r--. 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip

[root@dm8rac1 soft]# mkdir dmsoft
[root@dm8rac1 soft]# mount -t iso9660 -o loop dm8/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso  /soft/dmsoft
mount: /dev/loop0 is write-protected, mounting read-only

[root@dm8rac1 soft]# cd dmsoft
[root@dm8rac1 dmsoft]# ls -lrt
total 790160
-r-xr-xr-x. 1 root root   2802503 Oct 21 14:04 DM8 Install.pdf
-r-xr-xr-x. 1 root root 806320703 Oct 21 14:11 DMInstall.bin


[root@dm8rac12 ~]# cd /soft
[root@dm8rac2 soft]# unzip dm8_20211021_x86_rh6_64_ent.zip
Archive:  dm8_20211021_x86_rh6_64_ent.zip
   creating: dm8_20211021_x86_rh6_64_ent/
  inflating: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso
 extracting: dm8_20211021_x86_rh6_64_ent/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso_SHA256.txt
 extracting: dm8_20211021_x86_rh6_64_ent/verinfo.txt
[root@dm8rac2 soft]# ls -lrt
total 778320
drwxr-xr-x. 2 root root       132 Nov 12 13:43 dm8_20211021_x86_rh6_64_ent
-rw-r--r--. 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip
[root@dm8rac2 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8rac2 soft]# ls -lrt
total 778320
drwxr-xr-x. 2 root root       132 Nov 12 13:43 dm8
-rw-r--r--. 1 root root 796998047 Nov 29 10:25 dm8_20211021_x86_rh6_64_ent.zip

[root@dm8rac2 soft]# mkdir dmsoft
[root@dm8rac2 soft]# mount -t iso9660 -o loop dm8/dm8_20211021_x86_rh6_64_ent_8.1.2.84.iso  /soft/dmsoft
mount: /dev/loop0 is write-protected, mounting read-only

[root@dm8rac2 soft]# cd dmsoft
[root@dm8rac2 dmsoft]# ls -lrt
total 790160
-r-xr-xr-x. 1 root root   2802503 Oct 21 14:04 DM8 Install.pdf
-r-xr-xr-x. 1 root root 806320703 Oct 21 14:11 DMInstall.bin

在/soft/dmsoft目录下存在DMInstall.bin文件, DMInstall.bin文件就是DM的安装程序。在运行安装程序前,需要赋予DMInstall.bin文件执行权限。具体命令如下所示:

[root@dm8rac1 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system


[root@dm8rac2 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

在现实中,许多Linux(Unix)操作系统上是没有图形化界面的,为了使DM能够在这些操作系统上顺利安装,DM提供了命令行的安装方式。在终端进入到安装程序所在文件夹,执行以下命令进行命令行安装:

[dmdba@dm8rac1 dmsoft]$ ./DMInstall.bin -i
Please select the installer's language (E/e:English C/c:Chinese) [E/e]:e
Extract install files.........
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:n

Whether to Set The TimeZone? (Y/y:Yes N/n:No) [Y/y]:y
TimeZone:
[ 1]: GTM-12=West Date Line
[ 2]: GTM-11=Samoa
[ 3]: GTM-10=Hawaii
[ 4]: GTM-09=Alaska
[ 5]: GTM-08=Pacific(America and Canada)
[ 6]: GTM-07=Arizona
[ 7]: GTM-06=Central(America and Canada)
[ 8]: GTM-05=East(America and Canada)
[ 9]: GTM-04=Atlantic(America and Canada)
[10]: GTM-03=Brasilia
[11]: GTM-02=Middle Atlantic
[12]: GTM-01=Azores
[13]: GTM=Greenwich Mean Time
[14]: GTM+01=Sarajevo
[15]: GTM+02=Cairo
[16]: GTM+03=Moscow
[17]: GTM+04=AbuDhabi
[18]: GTM+05=Islamabad
[19]: GTM+06=Dakar
[20]: GTM+07=BangKok,Hanoi
[21]: GTM+08=China
[22]: GTM+09=Seoul
[23]: GTM+10=Guam
[24]: GTM+11=Solomon
[25]: GTM+12=Fiji
[26]: GTM+13=Nukualofa
[27]: GTM+14=Kiribati
Please Select the TimeZone [21]:21

Installation Type:
1 Typical
2 Server
3 Client
4 Custom
Please Input the number of the Installation Type [1 Typical]:4
1 Server component
2 Client component
  2.1 Manager
  2.2 Monitor
  2.3 DTS
  2.4 Console
  2.5 Analyzer
  2.6 DISQL
3 DM Drivers
4 Manual component
5 DBMS Service
  5.1 Realtime Audit Service
  5.2 Job Service
  5.3 Instance Monitor Service
  5.4 Assistant Plug-In Service
Please Input the number of the Installation Type [1 2 3 4 5]:1 2 3 4 5
Require Space: 1242M

Please Input the install path [/home/dmdba/dmdbms]:/dm8
Available Space:39G
Please Confirm the install path(/dm8)? (Y/y:Yes N/n:No) [Y/y]:y

Pre-Installation Summary
Installation Location: /dm8
Require Space: 1242M
Available Space: 39G
Version Information:
Expire Date:
Installation Type: Custom
Confirm to Install? (Y/y:Yes N/n:No):y
2021-12-07 10:57:53
[INFO] Installing DM DBMS...
2021-12-07 10:57:54
[INFO] Installing BASE Module...
2021-12-07 10:57:56
[INFO] Installing SERVER Module...
2021-12-07 10:57:56
[INFO] Installing CLIENT Module...
2021-12-07 10:57:57
[INFO] Installing DRIVERS Module...
2021-12-07 10:57:57
[INFO] Installing MANUAL Module...
2021-12-07 10:57:57
[INFO] Installing SERVICE Module...
2021-12-07 10:58:03
[INFO] Move log file to log directory.
2021-12-07 10:58:05
[INFO] Installed DM DBMS completely.

Please execute the commands by root:
/dm8/script/root/root_installer.sh

End

以root用户来执行上面的脚本

[root@dm8rac1 ~]# /dm8/script/root/root_installer.sh
Move /dm8/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server


[dmdba@dm8rac2 dmsoft]$ ./DMInstall.bin -i
Please select the installer's language (E/e:English C/c:Chinese) [E/e]:e
Extract install files.........
Welcome to DM DBMS Installer

Whether to input the path of Key File? (Y/y:Yes N/n:No) [Y/y]:n

Whether to Set The TimeZone? (Y/y:Yes N/n:No) [Y/y]:y
TimeZone:
[ 1]: GTM-12=West Date Line
[ 2]: GTM-11=Samoa
[ 3]: GTM-10=Hawaii
[ 4]: GTM-09=Alaska
[ 5]: GTM-08=Pacific(America and Canada)
[ 6]: GTM-07=Arizona
[ 7]: GTM-06=Central(America and Canada)
[ 8]: GTM-05=East(America and Canada)
[ 9]: GTM-04=Atlantic(America and Canada)
[10]: GTM-03=Brasilia
[11]: GTM-02=Middle Atlantic
[12]: GTM-01=Azores
[13]: GTM=Greenwich Mean Time
[14]: GTM+01=Sarajevo
[15]: GTM+02=Cairo
[16]: GTM+03=Moscow
[17]: GTM+04=AbuDhabi
[18]: GTM+05=Islamabad
[19]: GTM+06=Dakar
[20]: GTM+07=BangKok,Hanoi
[21]: GTM+08=China
[22]: GTM+09=Seoul
[23]: GTM+10=Guam
[24]: GTM+11=Solomon
[25]: GTM+12=Fiji
[26]: GTM+13=Nukualofa
[27]: GTM+14=Kiribati
Please Select the TimeZone [21]:21

Installation Type:
1 Typical
2 Server
3 Client
4 Custom
Please Input the number of the Installation Type [1 Typical]:4
1 Server component
2 Client component
  2.1 Manager
  2.2 Monitor
  2.3 DTS
  2.4 Console
  2.5 Analyzer
  2.6 DISQL
3 DM Drivers
4 Manual component
5 DBMS Service
  5.1 Realtime Audit Service
  5.2 Job Service
  5.3 Instance Monitor Service
  5.4 Assistant Plug-In Service
Please Input the number of the Installation Type [1 2 3 4 5]:1 2 3 4 5
Require Space: 1242M

Please Input the install path [/home/dmdba/dmdbms]:/dm8
Available Space:39G
Please Confirm the install path(/dm8)? (Y/y:Yes N/n:No) [Y/y]:y

Pre-Installation Summary
Installation Location: /dm8
Require Space: 1242M
Available Space: 39G
Version Information:
Expire Date:
Installation Type: Custom
Confirm to Install? (Y/y:Yes N/n:No):y
2021-12-07 10:57:53
[INFO] Installing DM DBMS...
2021-12-07 10:57:54
[INFO] Installing BASE Module...
2021-12-07 10:57:56
[INFO] Installing SERVER Module...
2021-12-07 10:57:56
[INFO] Installing CLIENT Module...
2021-12-07 10:57:57
[INFO] Installing DRIVERS Module...
2021-12-07 10:57:57
[INFO] Installing MANUAL Module...
2021-12-07 10:57:57
[INFO] Installing SERVICE Module...
2021-12-07 10:58:03
[INFO] Move log file to log directory.
2021-12-07 10:58:05
[INFO] Installed DM DBMS completely.

Please execute the commands by root:
/dm8/script/root/root_installer.sh

End

以root用户来执行上面的脚本

[root@dm8rac2 ~]# /dm8/script/root/root_installer.sh
Move /dm8/bin/dm_svc.conf to /etc
Modify the files' mode of DM Server

四、绑定UDEV
编辑/etc/udev/rules.d/60-raw.rules文件

ACTION=="add", KERNEL=="sdb", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sde", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdg", RUN+="/bin/raw /dev/raw/raw6 %N"

ACTION=="add", KERNEL=="raw[1-6]", OWNER="dmdba", GROUP="dinstall", MODE="660"

[root@dm8rac1 rules.d]# /sbin/udevadm trigger --type=devices --action=change

[root@dm8rac2 rules.d]# /sbin/udevadm trigger --type=devices --action=change

如果不能正常显示就重启操作系统

[root@dm8rac1 ~]# ls -lrt /dev/raw
total 0
crw-rw---- 1 root  disk     162, 0 Dec  7 14:59 rawctl
crw-rw---- 1 dmdba dinstall 162, 5 Dec  7 14:59 raw5
crw-rw---- 1 dmdba dinstall 162, 6 Dec  7 14:59 raw6
crw-rw---- 1 dmdba dinstall 162, 4 Dec  7 14:59 raw4
crw-rw---- 1 dmdba dinstall 162, 3 Dec  7 14:59 raw3
crw-rw---- 1 dmdba dinstall 162, 2 Dec  7 14:59 raw2
crw-rw---- 1 dmdba dinstall 162, 1 Dec  7 14:59 raw1

[root@dm8rac2 ~]# ls -lrt /dev/raw
total 0
crw-rw---- 1 root  disk     162, 0 Dec  7 14:59 rawctl
crw-rw---- 1 dmdba dinstall 162, 5 Dec  7 14:59 raw5
crw-rw---- 1 dmdba dinstall 162, 6 Dec  7 14:59 raw6
crw-rw---- 1 dmdba dinstall 162, 4 Dec  7 14:59 raw4
crw-rw---- 1 dmdba dinstall 162, 3 Dec  7 14:59 raw3
crw-rw---- 1 dmdba dinstall 162, 2 Dec  7 14:59 raw2
crw-rw---- 1 dmdba dinstall 162, 1 Dec  7 14:59 raw1

可以通过blockdev –getsize64 /dev/raw/raw1命令查看裸设备大小

[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw1
2147483648
[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw2
2147483648
[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw3
10737418240
[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw4
10737418240
[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw5
10737418240
[root@dm8rac1 ~]# blockdev --getsize64 /dev/raw/raw6
10737418240


[root@dm8rac2 ~]# blockdev --getsize64 /dev/raw/raw1
2147483648
[root@dm8rac2 ~]# blockdev --getsize64 /dev/raw/raw2
2147483648
[root@dm8rac3 ~]# blockdev --getsize64 /dev/raw/raw3
10737418240
[root@dm8rac4 ~]# blockdev --getsize64 /dev/raw/raw4
10737418240
[root@dm8rac5 ~]# blockdev --getsize64 /dev/raw/raw5
10737418240
[root@dm8rac6 ~]# blockdev --getsize64 /dev/raw/raw6
10737418240

五.配置dmdcr_cfg.ini文件
在2个节点的/dm8/data目录下创建配置文件dmdcr_cfg.ini,在文件中添加如下内容:

[dmdba@dm8rac1 ~]$ mkdir /dm8/data

[dmdba@dm8rac2 ~]$ mkdir /dm8/data

[dmdba@dm8rac1 data]$ vi 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 = CSS1
DCR_EP_HOST = 10.10.13.201
DCR_EP_PORT = 5240
[GRP_CSS]
DCR_EP_NAME = CSS2
DCR_EP_HOST = 10.10.13.202
DCR_EP_PORT = 5240

[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 = ASM1
DCR_EP_SHM_KEY = 93360
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.10.13.201
DCR_EP_PORT = 5241
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP_ASM]
DCR_EP_NAME = ASM2
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.10.13.202
DCR_EP_PORT = 5241
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 = RAC1
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 5243
[GRP_RAC]
DCR_EP_NAME = RAC2
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 5243

[dmdba@dm8rac2 data]$ vi 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 = CSS1
DCR_EP_HOST = 10.10.13.201
DCR_EP_PORT = 5240
[GRP_CSS]
DCR_EP_NAME = CSS2
DCR_EP_HOST = 10.10.13.202
DCR_EP_PORT = 5240

[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 = ASM1
DCR_EP_SHM_KEY = 93360
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.10.13.201
DCR_EP_PORT = 5241
DCR_EP_ASM_LOAD_PATH = /dev/raw
[GRP_ASM]
DCR_EP_NAME = ASM2
DCR_EP_SHM_KEY = 93361
DCR_EP_SHM_SIZE = 10
DCR_EP_HOST = 10.10.13.202
DCR_EP_PORT = 5241
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 = RAC1
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 5243
[GRP_RAC]
DCR_EP_NAME = RAC2
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 5243

六.使用 DMASMCMD 工具初始化(任意一节点执行)

[dmdba@dm8rac1 ~]$ dmasmcmd
DMASMCMD V8
ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 334.533(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 192.761(ms).
ASM>create asmdisk '/dev/raw/raw3' 'LOG0'
[Trace]The ASM initialize asmdisk /dev/raw/raw3 to name DMASMLOG0
Used time: 189.725(ms).
ASM>create asmdisk '/dev/raw/raw4' 'DATA0'
[Trace]The ASM initialize asmdisk /dev/raw/raw4 to name DMASMDATA0
Used time: 167.320(ms).
ASM>create asmdisk '/dev/raw/raw5' 'LOG1'
[Trace]The ASM initialize asmdisk /dev/raw/raw5 to name DMASMLOG1
Used time: 132.694(ms).
ASM>create asmdisk '/dev/raw/raw6' 'DATA1'
[Trace]The ASM initialize asmdisk /dev/raw/raw6 to name DMASMDATA1
Used time: 259.934(ms).
ASM>init dcrdisk '/dev/raw/raw1' from '/dm8/data/dmdcr_cfg.ini' identified by 'dameng123'
[Trace]DG 126 alloc one extent for inodes, addr(disk_id, disk_auno, extent_no):(0,0,1).
[Trace]DG 126 allocate 4 extents for file 0xfe000002.
[Trace]DG 126 alloc 4 extents for 0xfe000002, addr(disk_id, disk_auno, extent_no):(0, 0, 2)->(0, 0, 5), need_init = 1.
Used time: 00:00:02.531.
ASM>init votedisk '/dev/raw/raw2' from '/dm8/data/dmdcr_cfg.ini'
[Trace]DG 125 alloc one extent for inodes, addr(disk_id, disk_auno, extent_no):(0,0,1).
[Trace]DG 125 allocate 4 extents for file 0xfd000002.
[Trace]DG 125 alloc 4 extents for 0xfd000002, addr(disk_id, disk_auno, extent_no):(0, 0, 2)->(0, 0, 5), need_init = 1.
Used time: 00:00:01.089.
ASM>

七.准备DMASM 的 MAL 配置文件
在2个节点的/dm8/data目录下创建 DMASM 的 MAL 配置文件(命名为 dmasvrmal.ini),使用 DMASM 的所有节点都要配置,内容完全一样。

[dmdba@dm8rac1 data]$ vi dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM1
MAL_HOST = 10.10.13.201
MAL_PORT = 5242

[MAL_INST2]
MAL_INST_NAME = ASM2
MAL_HOST = 10.10.13.202
MAL_PORT = 5242


[dmdba@dm8rac2 data]$ vi dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM1
MAL_HOST = 10.10.13.201
MAL_PORT = 5242

[MAL_INST2]
MAL_INST_NAME = ASM2
MAL_HOST = 10.10.13.202
MAL_PORT = 5242

八.准备dmdcr.ini 配置文件
dmdcr.ini 是 dmcss、dmasmsvr、dmasmtool 工具的输入参数。记录了当前节点序列号以及 DCR 磁盘路径。在2个节点的/dm/dmdbms/data目录下创建dmdcr.ini 配置文件,dmdcr_path 相同,dmasvrmal.ini 文件内容也相同,dmdcr_seqo 分别为 0 和 1。
节点 1:

[dmdba@dm8rac1 data]$ vi dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm8/data/dmasvrmal.ini
DMDCR_SEQNO = 0

#ASM
DMDCR_ASM_RESTART_INTERVAL = 10
DMDCR_ASM_STARTUP_CMD = /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini

#DB
DMDCR_DB_RESTART_INTERVAL = 30
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/config/rac1/dm.ini dcr_ini=/dm8/data/dmdcr.ini


节点2:

[dmdba@dm8rac2 data]$ vi dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_MAL_PATH =/dm8/data/dmasvrmal.ini
DMDCR_SEQNO = 1

#ASM
DMDCR_ASM_RESTART_INTERVAL = 10
DMDCR_ASM_STARTUP_CMD = /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini

#DB
DMDCR_DB_RESTART_INTERVAL = 30
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/config/rac2/dm.ini dcr_ini=/dm8/data/dmdcr.ini

九.启动DMCSS、DMASM 服务程序
1、注册 DMCSS和DMASM服务
节点一:

[root@dm8rac1 ~]# /dm8/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm8/data/dmdcr.ini -p rac1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicerac1.service to /usr/lib/systemd/system/DmCSSServicerac1.service.
Finished to create the service (DmCSSServicerac1)
[root@dm8rac1 ~]# /dm8/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm8/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.
Finished to create the service (DmASMSvrServicerac1)

节点二:

[root@dm8rac2 ~]# /dm8/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm8/data/dmdcr.ini -p rac2
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicerac2.service to /usr/lib/systemd/system/DmCSSServicerac2.service.
Finished to create the service (DmCSSServicerac2)
[root@dm8rac2 ~]# /dm8/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm8/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.
Finished to create the service (DmASMSvrServicerac2)

2、启动DMCSS和DMASM服务
节点一

[root@dm8rac1 ~]# service DmCSSServicerac1 start
Redirecting to /bin/systemctl start DmCSSServicerac1.service
[root@dm8rac1 ~]# ps -ef | grep dmdba
root      2952  2618  0 16:28 pts/0    00:00:00 su - dmdba
dmdba     2953  2952  0 16:28 pts/0    00:00:00 -bash
dmdba     3468     1  0 16:48 ?        00:00:00 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini
dmdba     3492     1  0 16:49 ?        00:00:00 /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini
root      3504  3205  0 16:49 pts/1    00:00:00 grep --color=auto dmdba

节点二

[root@dm8rac2 ~]# service DmCSSServicerac2 start
Redirecting to /bin/systemctl start DmCSSServicerac2.service
[root@dm8rac2 ~]# ps -ef | grep dmdba
root      2952  2619  0 16:28 pts/0    00:00:00 su - dmdba
dmdba     2953  2952  0 16:28 pts/0    00:00:00 -bash
dmdba     3456     1  0 16:49 ?        00:00:00 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini
dmdba     3480     1  1 16:49 ?        00:00:00 /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini
root      3496  3193  0 16:49 pts/1    00:00:00 grep --color=auto dmdba

css 服务启动后会自动拉起asm服务,因为在dmdcr.ini文件中配置自动拉起ASM和DB的操作。

十、创建DMASM磁盘组
在任意节点使用 dmasmtool 工具创建 DMASM 磁盘组。

[dmdba@dm8rac1 data]$ dmasmtool DCR_INI=/dm8/data/dmdcr.ini
DMASMTOOL V8
ASM>create diskgroup 'DMLOG' asmdisk '/dev/raw/raw3'
Used time: 428.934(ms).
ASM>create diskgroup 'DMDATA' asmdisk '/dev/raw/raw4'
Used time: 284.431(ms).
ASM>

十一、准备dminit.ini 配置文件
在2个节点的/dm8/data目录下创建 dminit.ini 配置文件,添加如下内容。 在2个节点都创建。

[dmdba@dm8rac1 data]$ vi 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

[RAC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm8/data/config/rac1
port_num = 5236
mal_host = 10.10.13.201
mal_port = 5238
log_path = +DMLOG/log/rac0_log01.log
log_path = +DMLOG/log/rac0_log02.log

[RAC2] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm8/data/config/rac2
port_num = 5236
mal_host = 10.10.13.202
mal_port = 5238
log_path = +DMLOG/log/rac1_log01.log
log_path = +DMLOG/log/rac1_log02.log


[dmdba@dm8rac2 data]$ vi 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

[RAC1] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm8/data/config/rac1
port_num = 5236
mal_host = 10.10.13.201
mal_port = 5238
log_path = +DMLOG/log/rac0_log01.log
log_path = +DMLOG/log/rac0_log02.log

[RAC2] #inst_name 跟 dmdcr_cfg.ini 中 DB 类型 group 中 DCR_EP_NAME 对应
config_path = /dm8/data/config/rac2
port_num = 5236
mal_host = 10.10.13.202
mal_port = 5238
log_path = +DMLOG/log/rac1_log01.log
log_path = +DMLOG/log/rac1_log02.log

十二、使用dminit初始化数据库
在任意节点启动 dminit 工具初始化数据库。dminit 执行完成后,会在 config_path 目录(/dm8/data/config/rac1 和/dm8/data/config/rac2)下生成配置文件 dm.ini 和 dmmal.ini。

[dmdba@dm8rac1 data]$ dminit control=/dm8/data/dminit.ini
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-10-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 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. 2022-02-25 16:59:26

将节点一上的/dm8/data/config中的rac2配置目录复制到节点二:

[dmdba@dm8rac1 config]$ scp -r rac2 110.10.13.202:/dm8/data/config/
^C[dmdba@dm8rac1 config]$ scp -r rac2 10.10.13.202:/dm8/data/config/
The authenticity of host '10.10.13.202 (10.10.13.202)' can't be established.
ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4.
ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.13.202' (ECDSA) to the list of known hosts.
dmdba@10.10.13.202's password:
dmmal.ini                                                                                                                                                                                                100%  208     8.7KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   53KB   3.0MB/s   00:00
sqllog.ini                                                                                                                                                                                               100%  481    15.3KB/s   00:00
[dmdba@dm8rac1 config]$

十三、启动数据库服务器
1、在2个节点分别注册DM 数据库服务:
节点一:

[root@dm8rac1 ~]# /dm8/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm8/data/config/rac1/dm.ini -dcr_ini /dm8/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.
Finished to create the service (DmServicerac1)

节点二:

[root@dm8rac2 ~]# /dm8/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm8/data/config/rac2/dm.ini -dcr_ini /dm8/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.
Finished to create the service (DmServicerac2)

这里可以手动启动数据库服务来启动数据库,也可以重启CSS服务来启动数据库,因为配置CSS会自动拉起数据库

[root@dm8rac1 ~]# service DmCSSServicerac1 start
Redirecting to /bin/systemctl start DmCSSServicerac1.service

[root@dm8rac1 ~]# ps -ef | grep dmdba
root      2952  2618  0 16:28 pts/0    00:00:00 su - dmdba
dmdba     2953  2952  0 16:28 pts/0    00:00:00 -bash
root      3680  3629  0 16:59 pts/2    00:00:00 su - dmdba
dmdba     3681  3680  0 16:59 pts/2    00:00:00 -bash
dmdba     4150     1  0 17:13 ?        00:00:00 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini
dmdba     4176     1  0 17:13 ?        00:00:00 /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini
dmdba     4274     1  1 17:14 ?        00:00:00 /dm8/bin/dmserver path=/dm8/data/config/rac1/dm.ini dcr_ini=/dm8/data/dmdcr.ini
root      4319  3205  0 17:14 pts/1    00:00:00 grep --color=auto dmdba

[root@dm8rac2 ~]# service DmCSSServicerac2 restart
Redirecting to /bin/systemctl restart DmCSSServicerac2.service
[root@dm8rac2 ~]# ps -ef | grep dmdba
root      2952  2619  0 16:28 pts/0    00:00:00 su - dmdba
dmdba     2953  2952  0 16:28 pts/0    00:00:00 -bash
root      3681  3630  0 17:00 pts/2    00:00:00 su - dmdba
dmdba     3682  3681  0 17:00 pts/2    00:00:00 -bash
dmdba     4124     1  0 17:13 ?        00:00:00 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini
dmdba     4148     1  0 17:13 ?        00:00:00 /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini
dmdba     4177     1  3 17:14 ?        00:00:00 /dm8/bin/dmserver path=/dm8/data/config/rac2/dm.ini dcr_ini=/dm8/data/dmdcr.ini
root      4203  3193  0 17:14 pts/1    00:00:00 grep --color=auto dmdba

DSC+单机的DW部署
为DSC集群配置实时备机(单机),组成数据守护集群(DW)

配置DSC集群监视器
任意节点新建监视器配置文件,执行以下命令:

[dmdba@dm8rac1 data]$ vi dmcssm.ini
#和 dmdcr_cfg.ini 中的 DCR_OGUID 保持一致
CSSM_OGUID = 63635
#配置所有 CSS 的连接信息,
#和 dmdcr_cfg.ini 中 CSS 配置项的 DCR_EP_HOST 和 DCR_EP_PORT 保持一致
CSSM_CSS_IP = 10.10.13.201:5240
CSSM_CSS_IP = 10.10.13.202:5240
CSSM_LOG_PATH =/dm8/dmcssm/log #监视器日志文件存放路径
CSSM_LOG_FILE_SIZE = 32 #每个日志文件最大 32 MB
CSSM_LOG_SPACE_LIMIT = 0 #不限定日志文件总占用空间

启动监视器,dmdba 用户执行,

"dmcssm.ini" [New] 9L, 439C written
[dmdba@dm8rac1 data]$ dmcssm ini_path=/dm8/data/dmcssm.ini
[monitor]         2022-02-25 20:49:03: CSS MONITOR V8
[monitor]         2022-02-25 20:49:03: CSS MONITOR SYSTEM IS READY.

[monitor]         2022-02-25 20:49:03: Wait CSS Control Node choosed...
[monitor]         2022-02-25 20:49:04: Wait CSS Control Node choosed succeed.

show

monitor current time:2022-02-25 20:49:08, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS1] auto check = TRUE, global info:
[ASM1] auto restart = TRUE
[RAC1] auto restart = TRUE

[CSS2] auto check = TRUE, global info:
[ASM2] auto restart = TRUE
[RAC2] auto restart = TRUE


ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:49:08    CSS1          0         5240    Control Node OPEN               WORKING      OK           TRUE         245896425         245896870
        2022-02-25 20:49:08    CSS2          1         5240    Normal Node  OPEN               WORKING      OK           TRUE         245897746         245898186

=================== group[name = GRP_ASM, seq = 1, type = ASM, Control Node = 1] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is TRUE
ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:49:08    ASM1          0         5241    Normal Node  OPEN               WORKING      OK           TRUE         245903152         245901946
        2022-02-25 20:49:08    ASM2          1         5241    Control Node OPEN               WORKING      OK           TRUE         245902734         245903157

=================== group[name = GRP_RAC, seq = 2, type = DB, Control Node = 0] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is TRUE
ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:49:08    RAC1          0         5236    Control Node OPEN               WORKING      OK           TRUE         80515155          80515546
        2022-02-25 20:49:08    RAC2          1         5236    Normal Node  OPEN               WORKING      OK           TRUE         80513792          80514195

==================================================================================================================

脱机备份DSC数据库
在监视器中关闭数据库实例,执行以下命令

ep stop GRP_RAC
[monitor]         2022-02-25 20:52:24: Notify CSS(seqno:0) set ep(RAC1)auto restart off
[monitor]         2022-02-25 20:52:25: Notify CSS(seqno:0) set ep(RAC1)auto restart off success
[monitor]         2022-02-25 20:52:25: Notify CSS(seqno:1) set ep(RAC2)auto restart off
[monitor]         2022-02-25 20:52:25: Notify CSS(seqno:1) set ep(RAC2)auto restart off success
[monitor]         2022-02-25 20:52:25: Set CSS auto restart off success
[monitor]         2022-02-25 20:52:25: Notify CSS(seqno:0) execute EP STOP(GRP_RAC)
[monitor]         2022-02-25 20:52:31: Notify current active CSS to do clear
[monitor]         2022-02-25 20:52:32: Clean request of CSS(0) success
[monitor]         2022-02-25 20:52:32: Clean request of CSS(1) success
[monitor]         2022-02-25 20:52:32: Command EP STOP GRP_RAC execute success

show

monitor current time:2022-02-25 20:52:39, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS1] auto check = TRUE, global info:
[ASM1] auto restart = TRUE
[RAC1] auto restart = FALSE

[CSS2] auto check = TRUE, global info:
[ASM2] auto restart = TRUE
[RAC2] auto restart = FALSE


ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:52:38    CSS1          0         5240    Control Node OPEN               WORKING      OK           TRUE         245896425         245897077
        2022-02-25 20:52:38    CSS2          1         5240    Normal Node  OPEN               WORKING      OK           TRUE         245897746         245898393

=================== group[name = GRP_ASM, seq = 1, type = ASM, Control Node = 1] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is TRUE
ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:52:38    ASM1          0         5241    Normal Node  OPEN               WORKING      OK           TRUE         245903152         245902153
        2022-02-25 20:52:38    ASM2          1         5241    Control Node OPEN               WORKING      OK           TRUE         245902734         245903364

=================== group[name = GRP_RAC, seq = 2, type = DB, Control Node = 255] ========================================

n_ok_ep = 2
ok_ep_arr(index, seqno):
(0, 0)
(1, 1)

sta = OPEN, sub_sta = STARTUP
break ep = NULL
recover ep = NULL

crash process over flag is FALSE
ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2022-02-25 20:52:38    RAC1          0         5236    Normal Node  SHUTDOWN           SHUTDOWN     OK           FALSE        80515155          80515746
        2022-02-25 20:52:38    RAC2          1         5236    Normal Node  SHUTDOWN           SHUTDOWN     OK           FALSE        80513792          80514394

==================================================================================================================

使用dmrman工具备份数据库,dmdba用户执行
注册DmAP服务(可以不使用dmap,在使用dmrman时使用参数use_ap=2时)

[root@dm8rac1 ~]# /dm8/script/root/dm_service_installer.sh -t dmap
Created symlink from /etc/systemd/system/multi-user.target.wants/DmAPService.service to /usr/lib/systemd/system/DmAPService.service.
Finished to create the service (DmAPService)

启动DmAP服务

[root@dm8rac1 ~]# service DmAPService start
Redirecting to /bin/systemctl start DmAPService.service

[dmdba@dm8rac1 data]$ dmrman use_ap=2 dcr_ini=/dm8/data/dmdcr.ini
dmrman V8
RMAN> backup database '/dm8/data/config/rac1/dm.ini' full backupset '/dm8/data/racfullbak';
backup database '/dm8/data/config/rac1/dm.ini' full backupset '/dm8/data/racfullbak';
file dm.key not found, use default license!
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[29267], file_lsn[29267]
EP[1]'s cur_lsn[29267]
EP[0] adjust cur_lsn from [29267] to [29267]
Processing backupset /dm8/data/racfullbak
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:01][Remaining:00:00:00]
backup successfully!
time used: 00:00:08.410

备份完成将备份文件拷贝到DSC备库(10.10.13.227上合适的目录)

[dmdba@dm8rac1 data]$ scp -r racfullbak 10.10.13.227:/dm8/data/
The authenticity of host '10.10.13.227 (10.10.13.227)' can't be established.
ECDSA key fingerprint is SHA256:6O8c9WEeEYPbL4ncdRR1RsrjxxmfzPq9Tkq4/6uLSP4.
ECDSA key fingerprint is MD5:e1:73:3e:8d:79:be:5c:82:0f:c7:58:79:45:ad:df:86.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.13.227' (ECDSA) to the list of known hosts.
dmdba@10.10.13.227's password:
racfullbak.bak                                                                                                                                                                                           100% 6262KB  29.3MB/s   00:00
racfullbak.meta                                                                                                                                                                                          100%   77KB   3.4MB/s   00:00
[dmdba@dm8rac1 data]$

备库创建实例
备库上使用 dmdba 用户执行实例初始化

[dmdba@dm8racst ~]$ dminit path=/dm8/data/  db_name=rac_st
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-10-21
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL

 log file path: /dm8/data/rac_st/rac_st01.log


 log file path: /dm8/data/rac_st/rac_st02.log

write to dir [/dm8/data/rac_st].
create dm database success. 2022-02-25 21:25:01

使用DMDSC库的备份集还原恢复到单节点备库

[dmdba@dm8racst ~]$ dmrman use_ap=2
dmrman V8
RMAN> restore database '/dm8/data/rac_st/dm.ini' from backupset '/dm8/data/racfullbak';
restore database '/dm8/data/rac_st/dm.ini' from backupset '/dm8/data/racfullbak';
file dm.key not found, use default license!
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:05][Remaining:00:00:00]
restore successfully.
time used: 00:00:05.801
RMAN> recover database '/dm8/data/rac_st/dm.ini' from backupset '/dm8/data/racfullbak';
recover database '/dm8/data/rac_st/dm.ini' from backupset '/dm8/data/racfullbak';
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[29267], file_lsn[29267]
no log generates while the backupset [/dm8/data/racfullbak] created
recover successfully!
time used: 296.715(ms)
RMAN> recover database '/dm8/data/rac_st/dm.ini' update db_magic;
recover database '/dm8/data/rac_st/dm.ini' update db_magic;
Database mode = 0, oguid = 0
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[29267], file_lsn[29267]
recover successfully!
time used: 00:00:01.048

修改DSC实例配置文件
RAC集群的2个节点都需要修改
rac1上 dmdba用户执行
vi /dm8/data/config/rac1/dm.ini
修改以下参数值

ALTER_MODE_STATUS = 0 #不允许手工方式修改实例模式/状态

ENABLE_OFFLINE_TS = 2 #不允许备库 OFFLINE 表空间

ARCH_INI = 1 #开启归档模式

rac2上 dmdba用户执行
vi /dm8/data/config/rac2/dm.ini
修改以下参数值

ALTER_MODE_STATUS = 0 #不允许手工方式修改实例模式/状态

ENABLE_OFFLINE_TS = 2 #不允许备库 OFFLINE 表空间

ARCH_INI = 1 #开启归档模式

修改DSC MAL系统配置文件
rac1上 dmdba用户执行

[dmdba@dm8rac1 data]$ vi /dm8/data/config/rac1/dmmal.ini
[mal_inst0]
mal_inst_name = RAC1
mal_host = 10.10.13.201
mal_port = 5238
mal_inst_host = 10.10.13.201
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst1]
mal_inst_name = RAC2
mal_host = 10.10.13.202
mal_port = 5238
mal_inst_host = 10.10.13.202
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst2]
mal_inst_name = RAC_ST
mal_host = 10.10.13.227
mal_port = 5238
mal_inst_host = 10.10.13.227
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

rac2上 dmdba用户执行

[dmdba@dm8rac2 ~]$ vi /dm8/data/config/rac2/dmmal.ini
[mal_inst0]
mal_inst_name = RAC1
mal_host = 10.10.13.201
mal_port = 5238
mal_inst_host = 10.10.13.201
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst1]
mal_inst_name = RAC2
mal_host = 10.10.13.202
mal_port = 5238
mal_inst_host = 10.10.13.202
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst2]
mal_inst_name = RAC_ST
mal_host = 10.10.13.227
mal_port = 5238
mal_inst_host = 10.10.13.227
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

配置DSC归档配置文件
RAC集群的2个节点都需要修改

rac1上 dmdba用户执行

[dmdba@dm8rac1 data]$ vi /dm8/data/config/rac1/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/arch_local
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 51200

[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC2
ARCH_INCOMING_PATH = /dm8/data/arch_remote
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 51200

[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = RAC_ST

rac2上 dmdba用户执行

[dmdba@dm8rac2 ~]$ vi /dm8/data/config/rac2/dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/arch_local
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 51200

[ARCHIVE_REMOTE1]
ARCH_TYPE = REMOTE
ARCH_DEST = RAC1
ARCH_INCOMING_PATH = /dm8/data/arch_remote
ARCH_FILE_SIZE = 64
ARCH_SPACE_LIMIT = 51200

[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = RAC_ST

配置DSC数据守护配置文件
RAC集群的2个节点都需要修改

rac1上 dmdba用户执行

[dmdba@dm8rac1 data]$ vi /dm8/data/config/rac1/dmwatcher.ini
[GRP_RAC_DW]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #手动切换模式
DW_ERROR_TIME = 60 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 35 #本地实例故障认定时间
INST_OGUID = 100001 #守护系统唯一 OGUID 值
INST_INI = /dm8/data/config/rac1/dm.ini #dm.ini 配置文件路径
DCR_INI =/dm8/data/dmdcr.ini #dmdcr.ini 配置文件路径
INST_AUTO_RESTART = 0 #关闭实例的自动启动功能

rac2上 dmdba用户执行

[dmdba@dm8rac2 ~]$ vi /dm8/data/config/rac2/dmwatcher.ini
[GRP_RAC_DW]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #手动切换模式
DW_ERROR_TIME = 60 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 35 #本地实例故障认定时间
INST_OGUID = 100001 #守护系统唯一 OGUID 值
INST_INI = /dm8/data/config/rac2/dm.ini #dm.ini 配置文件路径
DCR_INI =/dm8/data/dmdcr.ini #dmdcr.ini 配置文件路径
INST_AUTO_RESTART = 0 #关闭实例的自动启动功能

修改备库实例配置文件
vi /dm8/data/rac_st/dm.ini
修改以下参数值

INSTANCE_NAME=RAC_ST #实例名

ALTER_MODE_STATUS = 0 #不允许手工方式修改实例模式/状态

ENABLE_OFFLINE_TS = 2 #不允许备库 OFFLINE 表空间

ARCH_INI = 1 #开启归档模式

MAL_INI = 1 #开启MAL系统

配置备库归档配置文件

[dmdba@dm8racst rac_st]$ vi /dm8/data/rac_st/dmarch.ini
[ARCHIVE_LOCAL1]
arch_type =local
arch_dest = /dm8/data/arch
arch_file_size = 64
arch_space_limit = 51200

[ARCHIVE_REALTIME]
arch_type = realtime
arch_dest = RAC1/RAC2

[dmdba@dm8racst rac_st]$ vi /dm8/data/rac_st/dmmal.ini
[mal_inst0]
mal_inst_name = RAC1
mal_host = 10.10.13.201
mal_port = 5238
mal_inst_host = 10.10.13.201
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst1]
mal_inst_name = RAC2
mal_host = 10.10.13.202
mal_port = 5238
mal_inst_host = 10.10.13.202
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

[mal_inst2]
mal_inst_name = RAC_ST
mal_host = 10.10.13.227
mal_port = 5238
mal_inst_host = 10.10.13.227
mal_inst_port = 5236
mal_dw_port = 5239
mal_inst_dw_port = 5237

配置备库数据守护配置文件

[dmdba@dm8racst ~]$ vi /dm8/data/rac_st/dmwatcher.ini
[GRP_RAC_DW]
DW_TYPE = GLOBAL #全局守护类型
DW_MODE = MANUAL #手动切换模式
DW_ERROR_TIME = 60 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 35 #本地实例故障认定时间
INST_OGUID = 100001 #守护系统唯一 OGUID 值
INST_INI = /dm8/data/rac_st/dm.ini #dm.ini 配置文件路径
INST_AUTO_RESTART = 1 #关闭实例的自动启动功能
INST_STARTUP_CMD = /dm8/bin/dmserver #命令行方式启动

启动所有实例到mount状态
在rac1上启动实例,使用dmdba用户执行

[dmdba@dm8rac1 ~]$ dmserver path=/dm8/data/config/rac1/dm.ini dcr_ini=/dm8/data/dmdcr.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-10-21
hlck_sys_init, init g_drm_dest:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
lbs_sys_init, the length of g_master_map is 1451, fill it use ok_ep_arr:[0, 1], n_ok_ep:2!
check CSS cmd: START NOTIFY, cmd_seq: 29
Control Node change from 255 to 254
check CSS cmd: DCR_LOAD, cmd_seq: 30
check CSS cmd: EP START, cmd_seq: 33
Control Node change from 254 to 0
file lsn: 29267
check CSS cmd: EP START2, cmd_seq: 38
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.
check CSS cmd: EP OPEN, cmd_seq: 43
iid page's trxid[8020]
NEXT TRX ID = 9024.
[!!!DSC INFO!!!] DSC crash process over!
check CSS cmd: EP REAL OPEN, cmd_seq: 46

在rac2上启动实例,使用dmdba用户执行

[dmdba@dm8rac2 ~]$ dmserver path=/dm8/data/config/rac2/dm.ini dcr_ini=/dm8/data/dmdcr.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-10-21
hpc_ini_info_pre_check end, code:0
hlck_sys_init, init g_drm_dest:[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]
lbs_sys_init, the length of g_master_map is 1451, fill it use ok_ep_arr:[0, 1], n_ok_ep:2!
check CSS cmd: DCR_LOAD, cmd_seq: 31
check CSS cmd: EP START, cmd_seq: 35
Control Node change from 255 to 0
mal_tsk_process_g_crash_lsn_bro, ep_seqno(0), crash_lsn(0)
mal_tsk_process_g_crash_lsn_bro, ep_seqno(1), crash_lsn(0)
check CSS cmd: EP START2, cmd_seq: 40
Control node start status: MOUNT
file lsn: 29267
begin redo pwr log collect, last ckpt lsn: 29267 ...
redo pwr log collect finished
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.
check CSS cmd: EP OPEN, cmd_seq: 44
iid page's trxid[8021]
NEXT TRX ID = 9025.
check CSS cmd: EP REAL OPEN, cmd_seq: 47

在备库上启动实例,使用dmdba用户执行

[dmdba@dm8racst ~]$ dmserver path=/dm8/data/rac_st/dm.ini mount
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-84-21.10.21-149328-10032-ENT  startup...
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
Database mode = 0, oguid = 0
License will expire on 2022-10-21
file lsn: 29267
ndct db load finished
ndct second level fill fast pool finished
ndct third level fill fast pool finished
ndct fill fast pool finished
nsvr_startup end.
aud sys init success.
aud rt sys init success.
systables desc init success.
ndct_db_load_info success.
SYSTEM IS READY.

修改主备库模式
使用disql工具连接各实例,rac任意节点使用dmdba执行

这里需要注意的是rac是多实例单库,设置oguid是针对实例而言,rac两个实例都需要改,但是这种数据库为主库,则只需要选择一个节点执行即可。

[dmdba@dm8rac1 data]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 7.071(ms)
disql V8
SQL> sp_set_oguid(100001);
DMSQL executed successfully
used time: 312.734(ms). Execute id is 0.


[dmdba@dm8rac2 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 4.016(ms)
disql V8
SQL> sp_set_oguid(100001);
DMSQL executed successfully
used time: 263.902(ms). Execute id is 0.
SQL> alter database primary;
executed successfully
used time: 270.052(ms). Execute id is 0.


[dmdba@dm8racst dm8]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 2.887(ms)
disql V8
SQL> sp_set_oguid(100001);
DMSQL executed successfully
used time: 65.576(ms). Execute id is 0.
SQL> alter database standby;
executed successfully
used time: 41.479(ms). Execute id is 0.

启动所有节点守护进程
注册为系统服务,方便启动和关闭集群,以及实现开机自动启动。

所有节点都需要注册,使用 root 用户执行

rac1 执行以下命令:
[root@dm8rac1 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/config/rac1/dmwatcher.ini -p rac1 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicerac1.service to /usr/lib/systemd/system/DmWatcherServicerac1.service.
Finished to create the service (DmWatcherServicerac1)

rac2 执行以下命令:

[root@dm8rac2 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/config/rac2/dmwatcher.ini -p rac2 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicerac2.service to /usr/lib/systemd/system/DmWatcherServicerac2.service.
Finished to create the service (DmWatcherServicerac2)

rac_st 执行以下命令:

[root@dm8racst ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/rac_st/dmwatcher.ini -p rac_st -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicerac_st.service to /usr/lib/systemd/system/DmWatcherServicerac_st.service.
Finished to create the service (DmWatcherServicerac_st)

以服务方式启动守护进程
rac1 执行以下命令:

[root@dm8rac1 ~]# service DmWatcherServicerac1 start
Redirecting to /bin/systemctl start DmWatcherServicerac1.service

rac2 执行以下命令

[root@dm8rac2 ~]# service DmWatcherServicerac2 start
Redirecting to /bin/systemctl start DmWatcherServicerac2.service

rac_st 执行以下命令:

[root@dm8racst ~]# service DmWatcherServicerac_st start
Redirecting to /bin/systemctl start DmWatcherServicerac_st.service

配置dmmonitor.ini

[dmdba@dm8racst1 data]$ vi dmmonitor.ini
MON_LOG_PATH = /dm8/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 64
MON_LOG_SPACE_LIMIT = 0
MON_DW_CONFIRM = 0

[GRP_RAC_DW]
MON_INST_OGUID = 100001

MON_DW_IP = 10.10.13.201:5239/10.10.13.202:5239
MON_DW_IP = 10.10.13.227:5239

启动数据守护监视器:

[dmdba@dm8racst1 data]$ dmmonitor path=/dm8/data/dmmonitor.ini
[monitor]         2022-02-25 22:30:45: DMMONITOR[4.0] V8
[monitor]         2022-02-25 22:30:46: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-25 22:30:46: Received message from(RAC2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-25 22:30:46  STARTUP        OK        RAC1             OPEN        PRIMARY   VALID    3        31768           31768

[monitor]         2022-02-25 22:30:46: Received message from(RAC1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-25 22:30:46  OPEN           OK        RAC1             OPEN        PRIMARY   VALID    3        31768           31768

[monitor]         2022-02-25 22:30:46: Received message from(RAC_ST)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-25 22:30:46  OPEN           OK        RAC_ST           OPEN        STANDBY   VALID    3        31768           31768

show
2022-02-25 22:31:20
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP_RAC_DW       100001      FALSE           MANUAL          FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.201      5239         2022-02-25 22:31:20  GLOBAL    VALID     OPEN           RAC1             OK        2     2     OPEN        PRIMARY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.201      5236       OK        RAC1             OPEN        PRIMARY   0          0            REALTIME  VALID    4195            31768           4195            31768           NONE
10.10.13.202      5236       OK        RAC2             OPEN        PRIMARY   1          0            REALTIME  VALID    2476            31768           2476            31768           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
10.10.13.227      5239         2022-02-25 22:31:20  GLOBAL    VALID     OPEN           RAC_ST           OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  VALID

EP INFO:
INST_IP             INST_PORT  INST_OK   INAME            ISTATUS     IMODE     DSC_SEQNO  DSC_CTL_NODE RTYPE     RSTAT    FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
10.10.13.227      5236       OK        RAC_ST           OPEN        STANDBY   0          0            REALTIME  VALID    4188            31768           4188            31768           NONE

DATABASE(RAC_ST) APPLY INFO FROM (RAC1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4195, 4195, 4195], (RLSN, SLSN, KLSN)[31768, 31768, 31768], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (31768)

DSC_SEQNO[1], (RSEQ, SSEQ, KSEQ)[2476, 2476, 2476], (RLSN, SLSN, KLSN)[31768, 31768, 31768], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (31768)


#================================================================================#

测试DSC+DW集群
使用disql工具连接任意rac节点,创建测试表test,并插入数据测试

[dmdba@dm8rac1 data]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is primary, state is open
login used time : 3.518(ms)
disql V8
SQL> create table test(id int);
executed successfully
used time: 140.246(ms). Execute id is 300.
SQL> insert into test values (1);
affect rows 1

used time: 1.927(ms). Execute id is 301.
SQL> commit;
executed successfully
used time: 12.186(ms). Execute id is 302.
SQL> select * from test;

LINEID     ID
---------- -----------
1          1

used time: 1.543(ms). Execute id is 303.

备库查询

[dmdba@dm8racst dm8]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is standby, state is open
login used time : 3.050(ms)
disql V8
SQL> select * from test;

LINEID     ID
---------- -----------
1          1

used time: 5.496(ms). Execute id is 200.

发表评论

电子邮件地址不会被公开。