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.

DM8动态增加读写分离集群节点

动态增加读写分离集群节点
配置读写分离集群
下列机器事先都安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为读写分离集群,主库命名为“jy1”,备库分别命名为“jy2”和“jy3”。

机器名     IP地址                      初始状态                          操作系统
dm8rw1     10.10.13.213(对外)       主库 jy1                          redhat 7.8
           10.10.13.213(mal对内)

dm8rw2     10.10.13.214(对外)
           10.10.13.214(mal对内)     备库 jy2                          redhat 7.8

dm8rw3     10.10.13.215(对外)
           10.10.13.215(mal对内)     备库 jy3                          redhat 7.8

dm8rw4     10.10.13.216              确认监视器                       redhat 7.8



实例名              port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port
jy1                 5236                 5237                10.10.13.213          5238            5239
jy2                 5236                 5237                10.10.13.214          5238            5239
jy3                 5236                 5237                10.10.13.215          5238            5239

安装DM数据库软件

数据准备
在主库机器上初始化数据库到目录/dm8/data:

[dmdba@dm8rw1 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy1 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:10:20


创建DmAPService用于dmrman来执行备份
主库

[root@dm8rw1 bin]# /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)

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

备库jy2

[root@dm8rw2 bin]# /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)

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

备库jy3

[root@dm8rw3 bin]# /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)
[root@dm8rw3 bin]# service DmAPService start
Redirecting to /bin/systemctl start DmAPService.service

注册服务用于启动数据库

[root@dm8rw1 bin]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy1 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy1.service to /usr/lib/systemd/system/DmServicejy1.service.
Finished to create the service (DmServicejy1)

正常启动数据库并正常关闭

[root@dm8rw1 bin]# service DmServicejy1 start
Redirecting to /bin/systemctl start DmServicejy1.service

[dmdba@dm8rw1 jy]$ disql SySDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 4.305(ms)
disql V8
SQL> select instance_name from v$instance;

LINEID     INSTANCE_NAME
---------- -------------
1          JY1

used time: 5.512(ms). Execute id is 53700.

[root@dm8rw1 bin]# service DmServicejy1 stop
Redirecting to /bin/systemctl stop DmServicejy1.service

备份主库

1. 正常关闭数据库

[root@dm8rw1 bin]# service DmServicejy1 stop
Redirecting to /bin/systemctl stop DmServicejy1.service

2.使用dmrman来进行冷备份

[dmdba@dm8rw1 jy]$ dmrman CTLSTMT="backup database '/dm8/data/jy/dm.ini' full backupset  '/dm8/jy1_full_bak_1'"
dmrman V8
backup database '/dm8/data/jy/dm.ini' full backupset '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
Processing backupset /dm8/jy1_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.468

将主库的备份复制备库:

[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.214:/dm8
dmdba@10.10.13.214's password:
jy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  24.8MB/s   00:00
jy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   4.2MB/s   00:00
[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.215:/dm8
dmdba@10.10.13.215's password:
jy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  10.9MB/s   00:00
jy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   1.2MB/s   00:00
[dmdba@dm8rw1 dm8]$

创建备库备库并恢复
备库jy2:

[dmdba@dm8rw2 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy2 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:46:05

备库jy3:

[dmdba@dm8rw3 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy3 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:46:37

恢复备库
备库jy2:

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'"
dmrman V8
restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'
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.615

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
no log generates while the backupset [/dm8/jy1_full_bak_1] created
recover successfully!
time used: 345.359(ms)

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC
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[26788], file_lsn[26788]
recover successfully!
time used: 00:00:01.066

备库jy3:

[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'"
dmrman V8
restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'
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:06][Remaining:00:00:00]
restore successfully.
time used: 00:00:06.606
[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
no log generates while the backupset [/dm8/jy1_full_bak_1] created
recover successfully!
time used: 323.405(ms)
[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC
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[26788], file_lsn[26788]
recover successfully!
time used: 00:00:01.069

配置操作
一.主库
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy1
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw1 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例jy1是主库,需要向即时备库jy2/jy3同步数据,因此即时归档的ARCH_DEST分别配置为jy2和jy3。

[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY                 #即时归档类型
ARCH_DEST = jy2                    #即时归档目标实例名
[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY                 #即时归档类型
ARCH_DEST = jy3                    #即时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm8rw1 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw1 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库jy2
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy2
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw2 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。

除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名

当前实例jy2是备库,守护系统配置完成后,可能在各种故障处理中,jy2切换为新的主库,正常情况下,jy1会切换为新的备库,需要向jy1和jy3同步数据,因此即时归档的ARCH_DEST分别配置为jy1和jy3。

[dmdba@dm8rw2 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw2 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库jy3
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy3
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw3 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。

除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名

当前实例jy3是备库,守护系统配置完成后,可能在各种故障处理中,jy3切换为新的主库,正常情况下,jy1会切换为新的备库,需要向jy1和jy2同步数据,因此即时归档的ARCH_DEST分别配置为jy1和jy2。

[dmdba@dm215 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw3 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

二:
主库启动到mount状态设置oguid

[dmdba@dm8rw1 ~]$ dmserver /dm8/data/jy/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: 25300
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.


[dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 3.177(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 66.753(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 3.112(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.941(ms). Execute id is 2.

备库jy2启动到mount状态设置oguid

[dmdba@dm8rw2 ~]$ dmserver /dm8/data/jy/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: 26788
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.



[dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 5.278(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 114.383(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 19.022(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.356(ms). Execute id is 2.

备库jy3启动到mount状态设置oguid

[dmdba@dm8rw3 ~]$ dmserver /dm8/data/jy/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: 26788
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.


[dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 5.145(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 110.938(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 14.513(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.549(ms). Execute id is 2.

备库jy2注册服务用于启动数据库

[root@dm8rw2 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy2 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy2.service to /usr/lib/systemd/system/DmServicejy2.service.
Finished to create the service (DmServicejy2)

备库jy3注册服务用于启动数据库

[root@dm8rw3 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy3 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy3.service to /usr/lib/systemd/system/DmServicejy3.service.
Finished to create the service (DmServicejy3)

三:
主库以primary打开

[dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

备库jy2以standby 打开

[dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

备库jy3以standby 打开

[dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

启动命令行工具DIsql,登录备库修改数据库为Standby模式如果当前数据库不是normal模式,需要先修改dm.ini中ALTER_MODE_STATUS值为1,允许修改数据库模式,修改Standby模式成功后再改回为0。如果是normal模式,请忽略下面的第1步和第3步。

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); ----第1步
SQL>alter database standby; ----第2步
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0); ----第3步

四:
启动守护进程
启动各个主备库上的守护进程:
主库

[dmdba@dm8rw1 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:19
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         RECOVERY        WAIT_SEND_ARCH  VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY1              PRIMARY   OPEN         TIMELY    4205            28044           4205            28044           4
---------------------------------------------------------------------------



备库jy2

[dmdba@dm8rw2 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:28
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         OPEN            SUB_STATE_START VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY2              STANDBY   OPEN         TIMELY    4204            28044           4204            28044           0

DATABASE(JY2) APPLY INFO:
REDOS_PARALLEL_NUM (1)
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)

---------------------------------------------------------------------------

备库jy3

[dmdba@dm8rw3 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:35
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         OPEN            SUB_STATE_START VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY3              STANDBY   OPEN         TIMELY    4204            28044           4204            28044           0

DATABASE(JY3) APPLY INFO:
REDOS_PARALLEL_NUM (1)
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)

---------------------------------------------------------------------------

也可以注册守护进程服务来进行启动
主库

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

[root@dm8rw1 ~]# service DmWatcherServicejy1 start
Redirecting to /bin/systemctl start DmWatcherServicejy1.service

备库1

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

[root@dm8rw2 ~]# service DmWatcherServicejy2 start
Redirecting to /bin/systemctl start DmWatcherServicejy2.service

备库2

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

[root@dm8rw3 ~]# service DmWatcherServicejy3 start
Redirecting to /bin/systemctl start DmWatcherServicejy3.service

配置监视器
由于主库和即时备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知即时备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间
[GRP1]
MON_INST_OGUID = 222222                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.213:5238
MON_DW_IP = 10.10.13.214:5238
MON_DW_IP = 10.10.13.215:5238


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

[GRP1]
MON_INST_OGUID = 222222



MON_DW_IP = 10.10.13.213:5238
MON_DW_IP = 10.10.13.214:5238
MON_DW_IP = 10.10.13.215:5238

启动监视器:

[dmdba@dm8rw4 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-01-18 22:28:01: DMMONITOR[4.0] V8
[monitor]         2022-01-18 22:28:02: DMMONITOR[4.0] IS READY.

[monitor]         2022-01-18 22:28:02: Received message from(JY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY1              OPEN        PRIMARY   VALID    3        28044           28044

[monitor]         2022-01-18 22:28:02: Received message from(JY3)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY3              OPEN        STANDBY   VALID    3        28044           28044

[monitor]         2022-01-18 22:28:02: Received message from(JY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY2              OPEN        STANDBY   VALID    3        28044           28044

show
2022-01-18 22:28:11
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             222222      TRUE            AUTO            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.213      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY1              OK        1     1     OPEN        PRIMARY   DSC_OPEN       TIMELY    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.213      5236       OK        JY1              OPEN        PRIMARY   0          0            TIMELY    VALID    4207            28044           4207            28044           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.214      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY2              OK        1     1     OPEN        STANDBY   DSC_OPEN       TIMELY    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.214      5236       OK        JY2              OPEN        STANDBY   0          0            TIMELY    VALID    4204            28044           4204            28044           NONE

DATABASE(JY2) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)


< >
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.215      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY3              OK        1     1     OPEN        STANDBY   DSC_OPEN       TIMELY    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.215      5236       OK        JY3              OPEN        STANDBY   0          0            TIMELY    VALID    4204            28044           4204            28044           NONE

DATABASE(JY3) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)


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

测试数据同步
主库:

SQL> create table test(id number(10));
executed successfully
used time: 198.382(ms). Execute id is 103.
SQL> insert into test values(1);
affect rows 1

SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 0.350(ms). Execute id is 501.



used time: 1.182(ms). Execute id is 104.
SQL> commit;
executed successfully
used time: 12.799(ms). Execute id is 105.

备库jy2:

SQL> select * from test;

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

used time: 2.615(ms). Execute id is 202.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 5.798(ms). Execute id is 0.

备库jy3:

SQL> select * from test;

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

used time: 2.691(ms). Execute id is 202.
SQL> select file_LSN, cur_LSN from v$rlog;
LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 5.949(ms). Execute id is 0.

接口说明

DM多种客户端接口都支持读写分离集群连接设置,以下说明客户端连接服务器时如何设置读写分离属性,详细可参考《DM8程序员手册》。4

JDBC接口
在JDBC连接串中增加了两个连接属性:
n rwSeparate 是否使用读写分离系统,默认0;取值(0不使用,1使用)。
n rwPercent 分发到主库的事务占主备库总事务的百分比,有效值0~100,默认值25。
dm.jdbc.driver.DmDriver
jdbc:dm://192.168.0.206:5236?rwSeparate=1&rwPercent=10

当需要进行系统扩容,希望系统运行不中断,或者影响运行的时间尽可能短,可通过动态增加集群节点的方式进行。下面举例对读写分离集群进行
动态增加节点。

配置环境说明

机器名    IP地址            初始状态           操作系统
dm8rw5   10.10.13.226     主库 jy4           redhat 7.8

数据准备
新备库创建DmAPService用于dmrman来执行还原恢复

[root@dm8rw5 /]# /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)
[root@dm8rw5 /]# service DmAPService start
Redirecting to /bin/systemctl start DmAPService.service

1.对主库进行联机备份操作:

SQL> backup database backupset '/dm8/jy1_full_bak_2';
executed successfully
used time: 00:00:02.278. Execute id is 500.

2.将备份集复制到新备库:

[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_2 10.10.13.226:/dm8
The authenticity of host '10.10.13.226 (10.10.13.226)' 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.226' (ECDSA) to the list of known hosts.
dmdba@10.10.13.226's password:
jy1_full_bak_2.bak                                                                                                                                                                                       100%   15MB  23.0MB/s   00:00
jy1_full_bak_2_1.bak                                                                                                                                                                                     100%  156KB   4.7MB/s   00:00
jy1_full_bak_2.meta                                                                                                                                                                                      100%   85KB   6.0MB/s   00:00
[dmdba@dm8rw1 dm8]$

3.初始化新备库数据库

[dmdba@dm8rw5 ~]$ dminit path=/dm8/data db_name=jy instance_name=jy4 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-02-16 16:50:23

恢复备库

[dmdba@dm8rw5 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_2'"
dmrman V8
restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_2'
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:08][Remaining:00:00:00]
restore successfully.
time used: 00:00:08.834
[dmdba@dm8rw5 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_2'"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 222222
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[29992], file_lsn[29992]
[Percent:100.00%][Speed:0.00PKG/s][Cost:00:00:00][Remaining:00:00:00]
recover successfully!
time used: 00:00:02.730
[dmdba@dm8rw5 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 1, oguid = 222222
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[31068], file_lsn[31068]
recover successfully!
time used: 00:00:01.061

配置新备库
配置dm.ini
在dm8rw5机器上配置备库的实例名为jy4,dm.ini参数修改如下:

INSTANCE_NAME = jy         #实例名总长度不能超过16
PORT_NUM = 5236            #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60  #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0      #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2      #不允许备库OFFLINE表空间
MAL_INI = 1                #打开MAL系统
ARCH_INI = 1               #打开归档配置
RLOG_SEND_APPLY_MON = 64   #统计最近64次的日志重演信息

拷贝一份原系统dmmal.ini文件,并加上自己一项,最终配置如下:

MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = jy4
MAL_HOST = 10.10.13.226
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.226
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[dmdba@dm8rw5 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = jy4
MAL_HOST = 10.10.13.226
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.226
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。

[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_TIMELY3]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

[dmdba@dm8rw5 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_TIMELY3]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

[dmdba@dm8rw5 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

注册守护进程服务

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

启动备库
以mount方式启动备库

[dmdba@dm8rw5 ~]$ dmserver /dm8/data/jy/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 = 1, oguid = 222222
License will expire on 2022-10-21
file lsn: 31068
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.

设置OGUID
启动命令行工具disql,登录备库设置OGUID值。

[dmdba@dm8rw5 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is primary, state is mount
login used time : 3.364(ms)
disql V8
SQL> sp_set_oguid(222222);
sp_set_oguid(222222);
[-720]:Dmwatcher is active, or current configuration(ALTER_MODE_STATUS) not allowed to alter database.
used time: 7.912(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 8.997(ms). Execute id is 1.
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 57.701(ms). Execute id is 2.

修改数据库模式
修改数据库为Standby模式:

SQL> alter database standby;
executed successfully
used time: 66.098(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 8.720(ms). Execute id is 3.

动态添加MAL配置
需要分别连接原系统中每个实例单独执行:
1.允许手工修改服务器的模式和状态。

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

Server[localhost:5236]:mode is primary, state is open
login used time : 2.628(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 36.203(ms). Execute id is 600.


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

Server[localhost:5236]:mode is standby, state is open
login used time : 4.421(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 140.819(ms). Execute id is 0.

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

Server[localhost:5236]:mode is standby, state is open
login used time : 4.246(ms)
disql V8
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 127.831(ms). Execute id is 0

2.退出原系统所有守护进程。
注意守护进程退出后,需要等待对应实例dm.ini中配置的DW_INACTIVE_INTERVAL时间后才允许后续操作,否则未超过故障认定时间,服务器认为守护进程仍然处于活动状态,不允许手工修改服务器为mount状态。

[root@dm8rw1 ~]# service DmWatcherServicejy1 stop
Redirecting to /bin/systemctl stop DmWatcherServicejy1.service


[root@dm8rw2 ~]# service DmWatcherServicejy2 stop
Redirecting to /bin/systemctl stop DmWatcherServicejy2.service

[root@dm8rw3 ~]# service DmWatcherServicejy3 stop
Redirecting to /bin/systemctl stop DmWatcherServicejy3.service

3.修改数据库状态为MOUNT。

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

Server[localhost:5236]:mode is primary, state is open
login used time : 2.628(ms)
disql V8
SQL> alter database mount;
executed successfully
used time: 47.587(ms). Execute id is 0.

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

Server[localhost:5236]:mode is standby, state is open
login used time : 4.421(ms)
disql V8
SQL> alter database mount;
executed successfully
used time: 29.109(ms). Execute id is 0.

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

Server[localhost:5236]:mode is standby, state is open
login used time : 4.246(ms)
disql V8
SQL> alter database mount;
executed successfully
used time: 37.954(ms). Execute id is 0.

4.重新修改ALTER_MODE_STATUS值为0,不允许手工修改服务器的模式和状态
jy1:

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 8.305(ms). Execute id is 602.

jy2:

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 8.565(ms). Execute id is 2.

jy3:

SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 8.420(ms). Execute id is 2.

5.动态增加mal中jy4的相关配置信息
jy1:

SQL> SF_MAL_CONFIG(1,0);
DMSQL executed successfully
used time: 0.760(ms). Execute id is 603.
SQL> SF_MAL_INST_ADD('MAL_INST4','jy4','10.10.13.226',5238,'10.10.13.226',5236,5239,0,5237);
DMSQL executed successfully
used time: 1.085(ms). Execute id is 604.
SQL> SF_MAL_CONFIG_APPLY();
DMSQL executed successfully
used time: 0.816(ms). Execute id is 605.
SQL> SF_MAL_CONFIG(0,0);
DMSQL executed successfully
used time: 0.514(ms). Execute id is 606.

jy2:

SQL> SF_MAL_CONFIG(1,0);
DMSQL executed successfully
used time: 0.881(ms). Execute id is 3.
SQL> SF_MAL_INST_ADD('MAL_INST4','jy4','10.10.13.226',5238,'10.10.13.226',5236,5239,0,5237);
DMSQL executed successfully
used time: 1.306(ms). Execute id is 4.
SQL> SF_MAL_CONFIG_APPLY();
DMSQL executed successfully
used time: 0.827(ms). Execute id is 5.
SQL> SF_MAL_CONFIG(0,0);
DMSQL executed successfully
used time: 0.572(ms). Execute id is 6.

jy3:

SQL> SF_MAL_CONFIG(1,0);
DMSQL executed successfully
used time: 0.663(ms). Execute id is 3.
SQL> SF_MAL_INST_ADD('MAL_INST4','jy4','10.10.13.226',5238,'10.10.13.226',5236,5239,0,5237);
DMSQL executed successfully
used time: 1.168(ms). Execute id is 4.
SQL> SF_MAL_CONFIG_APPLY();
DMSQL executed successfully
used time: 0.815(ms). Execute id is 5.
SQL> SF_MAL_CONFIG(0,0);
DMSQL executed successfully
used time: 0.585(ms). Execute id is 6.

动态添加归档配置
分别连接原系统中的所有实例(此时处于MOUNT状态),动态添加dmarch.ini中归档节点
jy1:

SQL> alter database add archivelog 'DEST=jy4, TYPE=TIMELY';
executed successfully
used time: 1.596(ms). Execute id is 0.

jy2:

SQL> alter database add archivelog 'DEST=jy4, TYPE=TIMELY';
executed successfully
used time: 1.199(ms). Execute id is 0.

jy3:

SQL> alter database add archivelog 'DEST=jy4, TYPE=TIMELY';
executed successfully
used time: 1.357(ms). Execute id is 0.

修改监视器dmmonitor.ini
在dmmonitor.ini中添加新增的备库jy4:

[dmdba@dm8rw4 ~]$ vi /dm8/data/dmmonitor.ini
MON_DW_CONFIRM = 1
MON_LOG_PATH = /dm8/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0

[GRP1]
MON_INST_OGUID = 222222



MON_DW_IP = 10.10.13.213:5239
MON_DW_IP = 10.10.13.214:5239
MON_DW_IP = 10.10.13.215:5239
MON_DW_IP = 10.10.13.226:5239

启动所有守护进程以及监视器
分别启动主库和备库(包括jy4)的所有守护进程,最后启动监视器。
jy1:

[root@dm8rw1 ~]# service DmWatcherServicejy1 start
Redirecting to /bin/systemctl start DmWatcherServicejy1.service

jy2:

[root@dm8rw2 ~]# service DmWatcherServicejy2 start
Redirecting to /bin/systemctl start DmWatcherServicejy2.service

jy3:

[root@dm8rw3 ~]# service DmWatcherServicejy3 start
Redirecting to /bin/systemctl start DmWatcherServicejy3.service

jy4:

[root@dm8rw5 ~]# service DmWatcherServicejy4 start
Redirecting to /bin/systemctl start DmWatcherServicejy4.service


[dmdba@dm8rw4 ~]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-02-17 16:30:16: DMMONITOR[4.0] V8
[monitor]         2022-02-17 16:30:16: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-17 16:30:16: Received message from(JY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-17 16:30:16  OPEN           OK        JY1              OPEN        PRIMARY   VALID    6        32418           32418

[monitor]         2022-02-17 16:30:16: Received message from(JY3)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-17 16:30:16  OPEN           OK        JY3              OPEN        STANDBY   VALID    6        32418           32418

[monitor]         2022-02-17 16:30:16: Received message from(JY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-17 16:30:16  OPEN           OK        JY2              OPEN        STANDBY   VALID    6        32418           32418

[monitor]         2022-02-17 16:30:16: Received message from(JY4)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-17 16:30:16  OPEN           OK        JY4              OPEN        STANDBY   VALID    6        32418           32418

DM8配置异步备库

配置异步备库
先搭建实时主备
下列机器事先都安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为实时主备,主库命名为“hy1”,备库命名为“hy2”。

机器名     IP地址                  初始状态                         操作系统
dm222     10.10.13.222(对外)     主库 hy1                         redhat 7.8
          10.10.13.222(mal对内)


dm223    10.10.13.223(对外)
         10.10.13.223(mal对内)     备库 hy2                       redhat 7.8

dm225    10.10.13.225            确认监视器                       redhat 7.8


实例名       port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port
hy1          5236                 5239                10.10.13.222          5237            5238
hy2          5236                 5239                10.10.13.223          5237            5238

数据准备
在主库机器上初始化数据库到目录/dm8/data:

[dmdba@dm222 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy1 port_num=5236 page_size=8 charset=0
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/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-14 16:20:46

注册服务用于启动数据库

[root@dm222 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/hy/dm.ini -p hy1 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicehy1.service to /usr/lib/systemd/system/DmServicehy1.service.
Finished to create the service (DmServicehy1)

正常启动数据库并正常关闭

[root@dm222 ~]# service DmServicehy1 start
Redirecting to /bin/systemctl start DmServicehy1.service
[root@dm222 ~]# ps -ef | grep dmserver
dmdba     8282     1 17 16:22 ?        00:00:02 /dm8/bin/dmserver path=/dm8/data/hy/dm.ini -noconsole
root      8373  8033  0 16:23 pts/2    00:00:00 grep --color=auto dmserver

[root@dm222 ~]# su - dmdba
Last login: Mon Feb 14 16:20:29 CST 2022 on pts/1
[dmdba@dm222 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 2.616(ms)
disql V8
SQL>

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

备份主库
1. 正常关闭数据库

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

2.使用dmrman来进行冷备份

[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full backupset  '/dm8/hy1_full_bak_1'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full backupset '/dm8/hy1_full_bak_1'
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[25300], file_lsn[25300]
Processing backupset /dm8/hy1_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.717

将主库的备份复制到备库:

[dmdba@dm222 dm8]$ scp -r hy1_full_bak_1 10.10.13.223:/dm8
The authenticity of host '10.10.13.223 (10.10.13.223)' 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.223' (ECDSA) to the list of known hosts.
dmdba@10.10.13.223's password:
hy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  12.8MB/s   00:00
hy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   1.6MB/s   00:00
[dmdba@dm222 dm8]$

创建备库备库并恢复

[dmdba@dm223 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy2 port_num=5236 page_size=8 charset=0
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/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-14 16:35:20

恢复备库:

[dmdba@dm223 dm8]$ dmrman CTLSTMT="RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'"
dmrman V8
RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'
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:06][Remaining:00:00:00]
restore successfully.
time used: 00:00:06.384


[dmdba@dm223 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_1'
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[25300], file_lsn[25300]
no log generates while the backupset [/dm8/hy1_full_bak_1] created
recover successfully!
time used: 359.697(ms)


[dmdba@dm223 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC
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[25300], file_lsn[25300]
recover successfully!
time used: 00:00:01.074

配置操作
一.主库
配置dm.ini文件,配置以下参数:

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5           #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5       #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = HY1              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.222          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.222     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = HY2              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.223          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.223     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm222 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
修改dmarch.ini,配置本地归档和实时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例HY1是主库,需要向HY2(实时备库)同步数据,因此实时归档的ARCH_DEST配置为HY2。

[ARCHIVE_REALTIME]                                #实时归档
ARCH_TYPE = REALTIME                              #实时归档类型
ARCH_DEST = HY2                                   #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                                 #本地归档类型
ARCH_DEST = /dm8/data/hy/arch                     #本地归档文件存放路径
ARCH_FILE_SIZE = 128                              #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0                              #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm222 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 555555                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/hy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm222 hy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 555555
INST_INI = /dm8/data/hy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

以mount模式启动主库

[root@dm222 ~]# su - dmdba
Last login: Mon Feb 14 16:23:39 CST 2022 on pts/2
[dmdba@dm222 ~]$ dmserver /dm8/data/hy/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: 25300
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.

设置主库 OGUID

[dmdba@dm222 hy]$ disql SYSDBA/SYSDBA@localhost:5236

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

修改主数据库模式

SQL> alter database primary;
executed successfully
used time: 185.004(ms). Execute id is 0.

将主库的dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini文件复制到备库

[dmdba@dm222 hy]$ scp dm*.ini 10.10.13.223:/dm8/data/hy
dmdba@10.10.13.223's password:
dmarch.ini                                                                                                                                                                                               100%  338    11.0KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   52KB  20.4MB/s   00:00
dmmal.ini                                                                                                                                                                                                100%  545    60.2KB/s   00:00
dmwatcher.ini                                                                                                                                                                                            100%  613    77.0KB/s   00:00
[dmdba@dm222 hy]$

二.备库
备机修改相关配置
修改dm.ini

INSTANCE_NAME = HY2

修改dmarch.ini

[dmdba@dm223 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

dmwatcher.ini 和主库一致

注册服务用于启动数据库

[root@dm223 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/hy/dm.ini -p hy2 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicehy2.service to /usr/lib/systemd/system/DmServicehy2.service.
Finished to create the service (DmServicehy2)

以mount方式启动备库

[dmdba@dm223 ~]$ dmserver /dm8/data/hy/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: 25300
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.

设置备库 OGUID

[dmdba@dm223 hy]$ disql SYSDBA/SYSDBA@localhost:5236

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

修改备数据库模式

SQL> alter database standby;
executed successfully
used time: 130.946(ms). Execute id is 0.

注册并启动守护进程
主库

[root@dm222 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy1 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy1.service to /usr/lib/systemd/system/DmWatcherServicehy1.service.
Finished to create the service (DmWatcherServicehy1)
[root@dm222 ~]# service DmWatcherServicehy1 start
Redirecting to /bin/systemctl start DmWatcherServicehy1.service

备库

[root@dm223 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy2 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy2.service to /usr/lib/systemd/system/DmWatcherServicehy2.service.
Finished to create the service (DmWatcherServicehy2)
[root@dm223 ~]# service DmWatcherServicehy2 start
Redirecting to /bin/systemctl start DmWatcherServicehy2.service

查看file_lsn与cur_lsn主备库是否一致
主库

[dmdba@dm222 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is primary, state is open
login used time : 2.370(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26559                26559

used time: 5.367(ms). Execute id is 600.

备库

[dmdba@dm223 hy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is standby, state is open
login used time : 1.921(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26559                26559

used time: 18.396(ms). Execute id is 100.

配置监视器(基本要求,安装dm8的软件)
由于主库和实时备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知实时备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间

[GRP1]
MON_INST_OGUID = 555555                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238

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

[GRP1]
MON_INST_OGUID = 555555


MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238

启动监视器:

[dmdba@dm225 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-02-14 17:11:11: DMMONITOR[4.0] V8
[monitor]         2022-02-14 17:11:11: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-14 17:11:12: Received message from(HY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-14 17:11:11  OPEN           OK        HY1              OPEN        PRIMARY   VALID    2        26559           26559

[monitor]         2022-02-14 17:11:12: Received message from(HY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-14 17:11:11  OPEN           OK        HY2              OPEN        STANDBY   VALID    2        26559           26559

show
2022-02-14 17:11:23
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             555555      TRUE            AUTO            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.222      5238         2022-02-14 17:11:22  GLOBAL    VALID     OPEN           HY1              OK        1     1     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.222      5236       OK        HY1              OPEN        PRIMARY   0          0            REALTIME  VALID    4204            26559           4204            26559           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.223      5238         2022-02-14 17:11:22  GLOBAL    VALID     OPEN           HY2              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.223      5236       OK        HY2              OPEN        STANDBY   0          0            REALTIME  VALID    4200            26559           4200            26559           NONE

DATABASE(HY2) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4204, 4204, 4204], (RLSN, SLSN, KLSN)[26559, 26559, 26559], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (26559)


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

主备同步测试
主库:

SQL> create table t1(id int);
executed successfully
used time: 56.331(ms). Execute id is 601.
SQL> insert into t1 values(1);
affect rows 1

used time: 0.832(ms). Execute id is 602.
SQL> commit;
executed successfully
used time: 2.878(ms). Execute id is 603.
SQL> select * from t1;

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

used time: 1.172(ms). Execute id is 604.

备库:

SQL> select * from t1;

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

used time: 2.349(ms). Execute id is 101.

在实际应用中,如果数据库规模很大,并且对数据的实时性要求不是很严格,则可以配置多个异步备库用于分担统计报表等任务。

这里以实时主备环境为例,仍然采用7.2 配置实时主备小节的配置环境,对异步备库的搭建步骤做举例说明,读写分离集群和MPP主备的异步备库搭建步骤是相同的,只需要根据实际情况调整配置项的具体值即可。

这里以一个异步备库为例,配置在主库HY1上,异步备库实例名为HY3。如果需要配置多个异步备库,对应的源实例配置可以参考主库HY1的配置步骤,异步备库自身的配置可以参考HY3的配置步骤。

源实例之间不能有相同的异步归档配置,避免同时向异步备库发送归档,导致异步备库数据乱掉的情况发生。

如果源实例自身出现故障,在故障恢复之前,都不会再发送归档到异步备库,所以如果有多个异步备库,可以考虑将异步备库分别配置到不同的源实例上。

环境说明
这里采用实时主备环境,增加一台机器用来部署异步备库,其他环境不变。

新增的机器事先安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

新增的异步备库实例名为“HY3”,按照“组名_守护环境_序号”的建议方式命名,注意总长度不能超过16。

机器名    IP地址             初始状态         操作系统              备注
dm224     10.10.13.224     异步备库HY3      redhat 7.8            10.10.13.224

数据准备
按照数据准备中的方法准备异步备库的数据。
如果实时主备守护环境已经处于运行状态,需要先正常退出主备库实例和守护进程。

先正常停止实时主备环境中的主库和备库
停止主库

[root@dm222 ~]# service DmWatcherServicehy1 stop
Redirecting to /bin/systemctl stop DmWatcherServicehy1.service
[root@dm222 ~]# ps -ef | grep dm.ini
root     29636 11271  0 16:47 pts/4    00:00:00 grep --color=auto dm.ini

停止备库

[root@dm223 ~]# service DmWatcherServicehy2 stop
Redirecting to /bin/systemctl stop DmWatcherServicehy2.service
[root@dm223 ~]# ps -ef | grep dm.ini
root     19132  5222  0 16:47 pts/3    00:00:00 grep --color=auto dm.ini

备份主库
1. 正常关闭数据库

[root@dm222 ~]# service DmServicehy1 stop
Redirecting to /bin/systemctl stop DmServicehy1.service

2.使用dmrman来进行冷备份

[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full to backup_file1 backupset  '/dm8/hy1_full_bak_2'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full to backup_file1 backupset '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
Processing backupset /dm8/hy1_full_bak_2
[-8216]:Archive log absence, repair archive log with SQL 'repair archive log ...' in dmrman
[dmdba@dm222 dm8]$ dmrman
dmrman V8
RMAN> repair archivelog database '/dm8/data/hy/dm.ini'
repair archivelog database '/dm8/data/hy/dm.ini'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
repair archive log successfully.
repair time used: 349.630(ms)
time used: 353.380(ms)
RMAN> exit
time used: 0.842(ms)
[dmdba@dm222 dm8]$ dmrman CTLSTMT="backup database '/dm8/data/hy/dm.ini' full  backupset  '/dm8/hy1_full_bak_2'"
dmrman V8
backup database '/dm8/data/hy/dm.ini' full backupset '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
begin redo pwr log collect, last ckpt lsn: 26600 ...
redo pwr log collect finished
EP[0]'s cur_lsn[27968], file_lsn[27968]
Processing backupset /dm8/hy1_full_bak_2
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:02.007

将主库的备份复制到异步备库:

[dmdba@dm222 dm8]$ scp -r hy1_full_bak_2 10.10.13.224:/dm8
The authenticity of host '10.10.13.224 (10.10.13.224)' 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.224' (ECDSA) to the list of known hosts.
dmdba@10.10.13.224's password:
hy1_full_bak_2.bak                                                                                                                                                                                       100%   15MB  20.9MB/s   00:00
hy1_full_bak_2_1.bak                                                                                                                                                                                     100%  173KB   4.5MB/s   00:00
hy1_full_bak_2.meta                                                                                                                                                                                      100%   85KB  11.1MB/s   00:00
[dmdba@dm222 dm8]$

创建异步备库并恢复

[dmdba@dm224 dm8]$ dminit path=/dm8/data db_name=hy instance_name=hy3 port_num=5236 page_size=8 charset=0
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/hy/hy01.log


 log file path: /dm8/data/hy/hy02.log

write to dir [/dm8/data/hy].
create dm database success. 2022-02-15 17:00:17

恢复异步备库:

[dmdba@dm224 dm8]$ dmrman CTLSTMT="RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'"
dmrman V8
RESTORE DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'
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:07][Remaining:00:00:00]
restore successfully.
time used: 00:00:07.883
[dmdba@dm224 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' FROM BACKUPSET '/dm8/hy1_full_bak_2'
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[26600], file_lsn[26600]
[Percent:100.00%][Speed:0.00PKG/s][Cost:00:00:00][Remaining:00:00:00]
recover successfully!
time used: 00:00:02.881
[dmdba@dm224 dm8]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/hy/dm.ini' UPDATE DB_MAGIC
file dm.key not found, use default license!
Database mode = 1, oguid = 555555
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[27968], file_lsn[27968]
recover successfully!
time used: 00:00:01.067

配置主库HY1
配置dm.ini
在实时主备环境下配置dm.ini的基础上,打开定时器配置,其他配置不变。
#配置有异步归档时,打开定时器,定时同步归档到异备库

TIMER_INI = 1

配置dmmal.ini
在实时主备环境下配置dmmal.ini的基础上,增加异步备库HY3的mal配置项。

[MAL_INST3]
MAL_INST_NAME = HY3              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.224          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.224     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm222 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
在实时主备环境下配置dmarchl.ini的基础上,增加异步归档的配置项。

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC              #异步归档类型
ARCH_DEST = HY3                #异步归档目标实例名
ARCH_TIMER_NAME = RT_TIMER     #定时器名称,和dmtimer.ini中的名称一致

[dmdba@dm222 hy]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC
ARCH_DEST = HY3
ARCH_TIMER_NAME = RT_TIMER

配置dmtimer.ini
配置dmtimer.ini,用于定时触发实例发送归档日志到异步备库。
下面示例中定时器配置为每天09:00:00触发主库发送归档日志到异步备库,可以根据实际情况再做调整。

[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 09:00:00
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

[dmdba@dm222 hy]$ vi dmtimer.ini
[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 09:00:00
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

配置备库HY2
该示例中备库上没有异步归档配置,但是由于dmmal.ini必须配置一致,因此需要修改备库上的dmmal.ini配置,其他已有的配置项不需要改动。

配置dmmal.ini
dmmal.ini中需要增加到异步备库HY3的mal配置项

[MAL_INST3]
MAL_INST_NAME = HY3              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.224          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.224     #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[dmdba@dm223 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239


2022-02-17 16:11:11: The asynchronous standby database configuration is different between instance[HY1] and instance[HY2]

对实时备库也要配置异步归档,否则会报上面的错误信息

配置dm.ini
在实时主备环境下配置dm.ini的基础上,打开定时器配置,其他配置不变。
#配置有异步归档时,打开定时器,定时同步归档到异备库

TIMER_INI = 1

[dmdba@dm223 ~]$ vi /dm8/data/hy/dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = HY1
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

[ARCHIVE_ASYNC]
ARCH_TYPE = ASYNC
ARCH_DEST = HY3
ARCH_TIMER_NAME = RT_TIMER


[dmdba@dm223 ~]$ vi /dm8/data/hy/dmtimer.ini
[RT_TIMER] #和dmarch.ini中的ARCH_TIMER_NAME一致
TYPE = 2
FREQ_MONTH_WEEK_INTERVAL = 1
FREQ_SUB_INTERVAL = 0
FREQ_MINUTE_INTERVAL = 0
START_TIME = 09:00:00
END_TIME = 23:59:59
DURING_START_DATE = 2022-02-15 17:30:00
DURING_END_DATE = 9999-12-31 23:59:59
NO_END_DATE_FLAG = 1
DESCRIBE = RT TIMER
IS_VALID = 1

配置异步备库HY3
配置dm.ini
在dm224机器上配置备库的实例名为HY31,dm.ini参数修改如下:

INSTANCE_NAME = HY3               #实例名,建议使用“组名_守护环境_序号”的命名方式,总长度不能超过16
PORT_NUM = 5236                   #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60         #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0             #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2             #不允许备库OFFLINE表空间
MAL_INI = 1                       #打开MAL系统
ARCH_INI = 1                      #打开归档配置
RLOG_SEND_APPLY_MON = 64          #统计最近64次的日志重演信息

配置dmmal.ini
同一个守护进程组中,所有主备库必须使用相同的dmmal.ini配置文件

[dmdba@dm224 hy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = HY1
MAL_HOST = 10.10.13.222
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.222
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = HY2
MAL_HOST = 10.10.13.223
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.223
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST3]
MAL_INST_NAME = HY3
MAL_HOST = 10.10.13.224
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.224
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
本地守护类型的备库只需要配置本地归档。

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/data/hy/arch      #本地归档文件路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm224 hy]$ vi dmarch.ini
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/hy/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为本地守护类型,异步备库不具备故障自动切换等功能,DW_MODE配置并不起作用,此处配置为MANUAL即可,另外异步备库不需要配置dmwatcher.ctl控制文件。

[GRP1]
DW_TYPE = LOCAL                                          #全局守护类型
DW_MODE = MANUAL                                         #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 555555                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/hy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动

[dmdba@dm224 hy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = LOCAL
DW_MODE = MANUAL
DW_ERROR_TIME = 10
INST_ERROR_TIME = 10
INST_OGUID = 555555
INST_INI = /dm8/data/hy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver

启动主库

[root@dm222 ~]# service DmWatcherServicehy1 start
Redirecting to /bin/systemctl start DmWatcherServicehy1.service
[root@dm222 ~]# ps -ef | grep dm.ini
dmdba    11148     1  2 15:14 ?        00:00:00 /dm8/bin/dmserver /dm8/data/hy/dm.ini mount
root     11276 11271  0 15:15 pts/4    00:00:00 grep --color=auto dm.ini

启动实时备库

[root@dm223 ~]# service DmWatcherServicehy2 start
Redirecting to /bin/systemctl start DmWatcherServicehy2.service
[root@dm223 ~]# ps -ef | grep dm.ini
dmdba    31842     1  1 15:15 ?        00:00:00 /dm8/bin/dmserver /dm8/data/hy/dm.ini mount
root     31947  5222  0 15:15 pts/3    00:00:00 grep --color=auto dm.ini

以mount方式启动异步备库

[dmdba@dm224 hy]$ dmserver /dm8/data/hy/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 = 1, oguid = 555555
License will expire on 2022-10-21
file lsn: 27968
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.

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

Server[localhost:5236]:mode is primary, state is mount
login used time : 3.554(ms)
disql V8
SQL> sp_set_oguid(555555);
sp_set_oguid(555555);
[-720]:Dmwatcher is active, or current configuration(ALTER_MODE_STATUS) not allowed to alter database.
used time: 8.410(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 8.953(ms). Execute id is 1.
SQL> sp_set_oguid(555555);
DMSQL executed successfully
used time: 66.419(ms). Execute id is 2.
SQL> alter database standby;
executed successfully
used time: 79.036(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 5.075(ms). Execute id is 3.

配置监视器
在实时主备配置监视器的配置基础上,需要增加到异步备库守护进程的“IP:PORT”信息,否则监视器无法收到异步备库消息,其他配置项不需要改动。

修改dmmonitor.ini配置确认监视器,增加到HY3守护进程的MON_DW_IP配置项,需要找到dmmal.ini中实例HY3的配置项信息,MON_DW_IP中的IP信息和dmmal.ini配置项中的MAL_HOST一致,PORT信息和dmmal.ini配置项中的MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                  #确认监视器模式
MON_LOG_PATH = /dm/data/log         #监视器日志文件存放路径
MON_LOG_INTERVAL = 60               #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32              #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0             #不限定日志文件总占用空间
[GRP1]
MON_INST_OGUID = 555555             #组GRP1的唯一OGUID值
#以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
#IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238
#新增到异步备库GRP1_LOCAL_01守护进程的连接信息
MON_DW_IP = 10.10.13.224:5238

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

[GRP1]
MON_INST_OGUID = 555555


MON_DW_IP = 10.10.13.222:5238
MON_DW_IP = 10.10.13.223:5238
MON_DW_IP = 10.10.13.224:5238

启动守护进程
启动异步备库的守护进程:

[root@dm224 ~]# /dm8/script/root/dm_service_installer.sh -watcher_ini /dm8/data/hy/dmwatcher.ini -p hy3 -t dmwatcher
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServicehy3.service to /usr/lib/systemd/system/DmWatcherServicehy3.service.
Finished to create the service (DmWatcherServicehy3)
[root@dm224 ~]# service DmWatcherServicehy3 start
Redirecting to /bin/systemctl start DmWatcherServicehy3.service

守护进程启动后,进入Startup状态,此时实例处于Mount状态,异步备库的守护进程会将本地实例自动Open,并切换守护进程自身为Open状态。

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

Server[localhost:5236]:mode is standby, state is open
login used time : 2.335(ms)
disql V8
SQL>

启动监视器
修改监视器配置后,需要重新启动监视器:

[dmdba@dm225 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-02-16 15:33:08: DMMONITOR[4.0] V8
[monitor]         2022-02-16 15:33:08: DMMONITOR[4.0] IS READY.

[monitor]         2022-02-16 15:33:08: Received message from(HY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY2              OPEN        STANDBY   NULL     4        29115           29115

[monitor]         2022-02-16 15:33:08: Received message from(HY3)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY3              OPEN        STANDBY   NULL     0        27968           27968

[monitor]         2022-02-16 15:33:08: Received message from(HY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-02-16 15:33:08  OPEN           OK        HY1              OPEN        PRIMARY   VALID    4        29115           29115

show
2022-02-17 16:20:32
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             555555      TRUE            AUTO            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.222      5238         2022-02-17 16:20:31  GLOBAL    VALID     OPEN           HY1              OK        1     1     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.222      5236       OK        HY1              OPEN        PRIMARY   0          0            REALTIME  VALID    4307            34882           4307            34882           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.223      5238         2022-02-17 16:20:31  GLOBAL    VALID     OPEN           HY2              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.223      5236       OK        HY2              OPEN        STANDBY   0          0            REALTIME  VALID    4301            34882           4301            34882           NONE

DATABASE(HY2) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4306, 4306, 4307], (RLSN, SLSN, KLSN)[34882, 34882, 34882], N_TSK[0], TSK_MEM_USE[1024]
REDO_LSN_ARR: (34882)


ASYNC SOURCE INSTANCE: HY1

< >
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.224      5238         2022-02-17 16:20:32  LOCAL     VALID     OPEN           HY3              OK        1     1     OPEN        STANDBY   DSC_OPEN       NONE      NULL

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.224      5236       OK        HY3              OPEN        STANDBY   0          0            NONE      NULL     4276            34882           4276            34882           NONE

DATABASE(HY3) APPLY INFO FROM (HY1), REDOS_PARALLEL_NUM (1), ARCH_SEND_UNTIL_TIME[NONE], APPLY_UNTIL_TIME[FALSE]:
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4306, 4306, 4306], (RLSN, SLSN, KLSN)[34882, 34882, 34882], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (34882)

DM8配置MPP主备

配置MPP主备
为了提高MPP系统可靠性,克服由于单节点故障导致整个系统不能继续正常工作,DM在普通的MPP系统基础上,引入主备守护机制,将MPP节点作为主库节点,增加备库作为备份节点,必要时可切换为主库代替故障节点工作,提高系统的可靠性和可用性。

环境说明
本例配置2个MPP节点数,每个节点作为主库,与其备库组成一个守护组,因此需要配置两个守护组,取名分别为GRP1、GRP2,主库名为mpp01/mpp02,对应的备库实例名分别为mpp11/mpp12。

准备5台机器dm8mppdw1,dm8mppdw2,dm8mppdw3,dm8mppdw4和dm8mppdw5,dm8mppdw1和dm8mppdw2为主库,dm8mppdw3和dm8mppdw4和备库,dm8mppdw5部署监视器。

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

机器名 IP地址 初始状态 操作系统

dm8mppdw1  10.10.13.217(对外)        主库 mpp01                         redhat 7.8
           10.10.13.217(mal对内)

dm8mppdw2  10.10.13.218(对外)
           10.10.13.218(mal对内)     主库 mpp02                         redhat 7.8

dm8mppdw3  10.10.13.219(对外)
           10.10.13.219(mal对内)     备库 mpp11                         redhat 7.8

dm8mppdw4  10.10.13.220(对外)
           10.10.13.220(mal对内)     备库 mpp12                         redhat 7.8


dm8mppdw5  10.10.13.221              确认监视器                         redhat 7.8

端口规划—主库

实例名              port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port  mpp实例序号
mpp01               5236                 5237                10.10.13.217          5238            5239         0
mpp02               5236                 5237                10.10.13.218          5238            5239         1

端口规划—备库

实例名              port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port  对应主库
mpp11               5236                 5237                10.10.13.219          5238            5239         mpp01
mpp12               5236                 5237                10.10.13.220          5238            5239         mpp02

守护进程规划

组名                实例名                     所在机器
grp1                mpp01                      10.10.13.217
                    mpp11                      10.10.13.219

grp2                mpp02                      10.10.13.218
                    mpp12                      10.10.13.220

安装DM数据库软件

数据准备
在主库机器上初始化数据库到目录/dm8/data:
mpp01:

[dmdba@dm8mppdw1 ~]$ dminit path=/dm8/data db_name=mpp01 instance_name=mpp01 port_num=5236 page_size=16 case_sensitive=1 charset=0
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/mpp01/mpp0101.log


 log file path: /dm8/data/mpp01/mpp0102.log

write to dir [/dm8/data/mpp01].
create dm database success. 2022-01-20 16:50:09


mpp02:

[dmdba@dm8mppdw2 ~]$ dminit path=/dm8/data db_name=mpp02 instance_name=mpp02 port_num=5236 page_size=16 case_sensitive=1 charset=0
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/mpp02/mpp0201.log


 log file path: /dm8/data/mpp02/mpp0202.log

write to dir [/dm8/data/mpp02].
create dm database success. 2022-01-20 16:50:41

创建DmAPService用于dmrman来执行备份
mpp01:

[root@dm8mppdw1 ~]# /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)

mpp02:

[root@dm8mppdw2 ~]# /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)

mpp11:

[root@dm8mppdw3 ~]# /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)

mpp12:

[root@dm8mppdw4 ~]# /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)

主库中注册服务用于启动数据库
mpp01:

[root@dm8mppdw1 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/mpp01/dm.ini -p mpp01 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicempp01.service to /usr/lib/systemd/system/DmServicempp01.service.
Finished to create the service (DmServicempp01)

mpp02:

[root@dm8mppdw2 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/mpp02/dm.ini -p mpp02 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicempp02.service to /usr/lib/systemd/system/DmServicempp02.service.
Finished to create the service (DmServicempp02)

正常启动主数据库并正常关闭
mpp01:

[root@dm8mppdw1 ~]# service DmServicempp01 start
Redirecting to /bin/systemctl start DmServicempp01.service

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

Server[localhost:5236]:mode is normal, state is open
login used time : 2.484(ms)
disql V8
SQL> select instance_name from v$instance;

LINEID     INSTANCE_NAME
---------- -------------
1          MPP01

used time: 5.715(ms). Execute id is 53700.

[root@dm8mppdw1 ~]# service DmServicempp01 stop
Redirecting to /bin/systemctl stop DmServicempp01.service

mpp02:

[root@dm8mppdw2 ~]# service DmServicempp02 start
Redirecting to /bin/systemctl start DmServicempp02.service

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

Server[localhost:5236]:mode is normal, state is open
login used time : 2.821(ms)
disql V8
SQL> select instance_name from v$instance;

LINEID     INSTANCE_NAME
---------- -------------
1          MPP02

used time: 6.061(ms). Execute id is 53700.
SQL>

[root@dm8mppdw2 ~]# service DmServicempp02 stop
Redirecting to /bin/systemctl stop DmServicempp02.service

备份主库
1. 正常关闭数据库
mpp01:

[root@dm8mppdw1 ~]# service DmServicempp01 stop
Redirecting to /bin/systemctl stop DmServicempp01.service

mpp02:

[root@dm8mppdw2 ~]# service DmServicempp02 stop
Redirecting to /bin/systemctl stop DmServicempp02.service

2.使用dmrman来进行冷备份
mpp01:

[dmdba@dm8mppdw1 ~]$ dmrman CTLSTMT="backup database '/dm8/data/mpp01/dm.ini' full backupset  '/dm8/mpp01_full_bak_1'"
dmrman V8
backup database '/dm8/data/mpp01/dm.ini' full backupset '/dm8/mpp01_full_bak_1'
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[24618], file_lsn[24618]
Processing backupset /dm8/mpp01_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.913

mpp02:

[dmdba@dm8mppdw2 ~]$ dmrman CTLSTMT="backup database '/dm8/data/mpp02/dm.ini' full backupset  '/dm8/mpp02_full_bak_1'"
dmrman V8
backup database '/dm8/data/mpp02/dm.ini' full backupset '/dm8/mpp02_full_bak_1'
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[24618], file_lsn[24618]
Processing backupset /dm8/mpp02_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.750

将主库的备份复制备库:
将mpp01的备份复制到mpp11所在主机上:

[dmdba@dm8mppdw1 dm8]$ scp -r mpp01_full_bak_1 10.10.13.219:/dm8
The authenticity of host '10.10.13.219 (10.10.13.219)' 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.219' (ECDSA) to the list of known hosts.
dmdba@10.10.13.219's password:
mpp01_full_bak_1.bak                                                                                                                                                                                     100% 9942KB  13.1MB/s   00:00
mpp01_full_bak_1.meta                                                                                                                                                                                    100%   77KB   3.4MB/s   00:00
[dmdba@dm8mppdw1 dm8]$

将mpp02的备份复制到mpp12所在主机上:

[dmdba@dm8mppdw2 dm8]$ scp -r mpp02_full_bak_1 10.10.13.220:/dm8
The authenticity of host '10.10.13.220 (10.10.13.220)' 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.220' (ECDSA) to the list of known hosts.
dmdba@10.10.13.220's password:
mpp02_full_bak_1.bak                                                                                                                                                                                     100% 9942KB  16.7MB/s   00:00
mpp02_full_bak_1.meta                                                                                                                                                                                    100%   77KB   2.5MB/s   00:00
[dmdba@dm8mppdw2 dm8]$

创建备库备库并恢复
备库mpp11:

[dmdba@dm8mppdw3 dm8]$ dminit path=/dm8/data db_name=mpp01 instance_name=mpp11 port_num=5236 page_size=16 case_sensitive=1 charset=0
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/mpp01/mpp0101.log


 log file path: /dm8/data/mpp01/mpp0102.log

write to dir [/dm8/data/mpp01].
create dm database success. 2022-01-24 15:04:44

备库mpp12:

[dmdba@dm8mppdw4 dm8]$ dminit path=/dm8/data db_name=mpp02 instance_name=mpp12 port_num=5236 page_size=16 case_sensitive=1 charset=0
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/mpp02/mpp0201.log


 log file path: /dm8/data/mpp02/mpp0202.log

write to dir [/dm8/data/mpp02].
create dm database success. 2022-01-24 15:38:12

恢复备库
备库mpp11:

[dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="restore database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'"
dmrman V8
restore database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'
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:07][Remaining:00:00:00]
restore successfully.
time used: 00:00:07.659
[dmdba@dm8mppdw3 dm8]$
[dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'"
dmrman V8
recover database '/dm8/data/mpp01/dm.ini' from backupset '/dm8/mpp01_full_bak_1'
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[24618], file_lsn[24618]
no log generates while the backupset [/dm8/mpp01_full_bak_1] created
recover successfully!
time used: 317.800(ms)
[dmdba@dm8mppdw3 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp01/dm.ini' UPDATE DB_MAGIC"
dmrman V8
recover database '/dm8/data/mpp01/dm.ini' UPDATE DB_MAGIC
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[24618], file_lsn[24618]
recover successfully!
time used: 00:00:01.080

备库mpp12:

[dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="restore database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'"
dmrman V8
restore database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'
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:07][Remaining:00:00:00]
restore successfully.
time used: 00:00:07.202
[dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'"
dmrman V8
recover database '/dm8/data/mpp02/dm.ini' from backupset '/dm8/mpp02_full_bak_1'
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[24618], file_lsn[24618]
no log generates while the backupset [/dm8/mpp02_full_bak_1] created
recover successfully!
time used: 341.601(ms)
[dmdba@dm8mppdw4 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/mpp02/dm.ini' UPDATE DB_MAGIC"
dmrman V8
recover database '/dm8/data/mpp02/dm.ini' UPDATE DB_MAGIC
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[24618], file_lsn[24618]
recover successfully!
time used: 00:00:01.058

配置操作
主库mpp01
配置dm.ini
配置dm.ini文件,配置以下参数:

INSTANCE_NAME = MPP01
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
MPP_INI = :1                                 #启用MPP配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = MPP01                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.217            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.217       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = MPP02                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.218            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.218       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = MPP11                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.219            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.219       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST4]
MAL_INST_NAME = MPP12                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.220            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.220       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[dmdba@dm8mppdw1 mpp01]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = MPP01
MAL_HOST = 10.10.13.217
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.217
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = MPP02
MAL_HOST = 10.10.13.218
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.218
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = MPP11
MAL_HOST = 10.10.13.219
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.219
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = MPP12
MAL_HOST = 10.10.13.220
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.220
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例mpp01是主库,需要向即时备库mpp11同步数据,因此即时归档的ARCH_DEST配置为mpp11。

[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME               #即时归档类型
ARCH_DEST = MPP11                  #即时归档目标实例名

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M


[dmdba@dm8mppdw1 mpp01]$ vi dmarch.ini
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = MPP11

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmmpp.ctl
mmpp.ctl是二进制文件,由dmmpp.ini文本通过dmctlcvt工具转换而来,dmmpp.ini配置项如下表:

[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = MPP01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = MPP02

[dmdba@dm8mppdw1 mpp01]$ vi dmmpp.ini
[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = MPP01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = MPP02

使用DM提供的工具dmctlcvt将dmmpp.ini转换成dmmpp.ctl,dmctlcvt工具在DM安装目录的“bin”子目录中。转换生成的dmmpp.ctl需要放在与dm.ini同一个目录。假设DM的安装路径为c盘根目录,下面的命令将dmmpp.ini转换为dmmpp.ctl,命令中的
“TYPE=2”参数表示将文本文件转换成控制文件,也可以使用“TYPE=1”参数进行逆向转换。

[dmdba@dm8mppdw1 mpp01]$ dmctlcvt type=2 src=/dm8/data/mpp01/dmmpp.ini dest=/dm8/data/mpp01/dmmpp.ctl
DMCTLCVT V8
convert txt to ctl success!

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 333333                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/mpp01/dm.ini                        #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm8mppdw1 mpp01]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 333333
INST_INI = /dm8/data/mpp01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

主库mpp02
配置dm.ini
配置dm.ini文件,配置以下参数:

INSTANCE_NAME = MPP02
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
MPP_INI = 1                                 #启用MPP配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = MPP01                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.217            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.217       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = MPP02                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.218            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.218       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = MPP11                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.219            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.219       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST4]
MAL_INST_NAME = MPP12                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.220            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.220       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[dmdba@dm8mppdw2 mpp02]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = MPP01
MAL_HOST = 10.10.13.217
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.217
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = MPP02
MAL_HOST = 10.10.13.218
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.218
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = MPP11
MAL_HOST = 10.10.13.219
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.219
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = MPP12
MAL_HOST = 10.10.13.220
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.220
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例mpp02是主库,需要向即时备库mpp12同步数据,因此即时归档的ARCH_DEST配置为mpp12。

[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME               #即时归档类型
ARCH_DEST = MPP12                  #即时归档目标实例名

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M


[dmdba@dm8mppdw2 mpp02]$ vi dmarch.ini
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = MPP12

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmmpp.ctl
将主库mpp01上的dmpp.ctl拷贝过来

[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.218:/dm8/data/mpp02/
The authenticity of host '10.10.13.218 (10.10.13.218)' 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.218' (ECDSA) to the list of known hosts.
dmdba@10.10.13.218's password:
dmmpp.ctl                                                                                                                                                                                                100%   41KB   1.3MB/s   00:00
[dmdba@dm8mppdw1 mpp01]$

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP2]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 444444                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/mpp02/dm.ini                        #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm8mppdw2 mpp02]$ vi dmwatcher.ini
[GRP2]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 444444
INST_INI = /dm8/data/mpp02/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库
mpp11
配置dm.ini
配置dm.ini文件,配置以下参数:

INSTANCE_NAME = MPP11
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
MPP_INI = 1                                 #启用MPP配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = MPP01                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.217            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.217       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = MPP02                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.218            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.218       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = MPP11                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.219            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.219       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST4]
MAL_INST_NAME = MPP12                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.220            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.220       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[dmdba@dm8mppdw3 mpp01]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = MPP01
MAL_HOST = 10.10.13.217
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.217
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = MPP02
MAL_HOST = 10.10.13.218
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.218
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = MPP11
MAL_HOST = 10.10.13.219
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.219
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = MPP12
MAL_HOST = 10.10.13.220
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.220
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例mpp11是备库,守护系统配置完成后,可能在各种故障处理中,mpp11切换为新的主库,正常情况下,mpp01会切换为新的备库,需要向
mpp01同步数据,因此即时归档的ARCH_DEST配置为mpp01

[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME               #即时归档类型
ARCH_DEST = MPP01                  #即时归档目标实例名

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M


[dmdba@dm8mppdw3 mpp01]$ vi dmarch.ini
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = MPP01

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmmpp.ctl
将主库mpp01上的dmpp.ctl拷贝过来

[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.219:/dm8/data/mpp01/
dmdba@10.10.13.219's password:
dmmpp.ctl                                                                                                                                                                                                100%   41KB   1.4MB/s   00:00

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 333333                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/mpp01/dm.ini                        #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm8mppdw3 mpp01]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 333333
INST_INI = /dm8/data/mpp01/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库
mpp12
配置dm.ini
配置dm.ini文件,配置以下参数:

INSTANCE_NAME = MPP12
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
MPP_INI = 1                                 #启用MPP配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = MPP01                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.217            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.217       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = MPP02                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.218            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.218       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = MPP11                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.219            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.219       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST4]
MAL_INST_NAME = MPP12                #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.220            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.220       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[dmdba@dm8mppdw4 mpp02]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = MPP01
MAL_HOST = 10.10.13.217
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.217
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = MPP02
MAL_HOST = 10.10.13.218
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.218
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = MPP11
MAL_HOST = 10.10.13.219
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.219
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST4]
MAL_INST_NAME = MPP12
MAL_HOST = 10.10.13.220
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.220
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例mpp12是备库,守护系统配置完成后,可能在各种故障处理中,mpp12切换为新的主库,正常情况下,mpp02会切换为新的备库,需要向
mpp02同步数据,因此即时归档的ARCH_DEST配置为mpp02

[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME               #即时归档类型
ARCH_DEST = MPP02                  #即时归档目标实例名

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M


[dmdba@dm8mppdw4 mpp02]$ vi dmarch.ini
[ARCHIVE_REALTIME1]
ARCH_TYPE = REALTIME
ARCH_DEST = MPP02

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmmpp.ctl
将主库mpp01上的dmpp.ctl拷贝过来

[dmdba@dm8mppdw1 mpp01]$ scp dmmpp.ctl 10.10.13.220:/dm8/data/mpp02
The authenticity of host '10.10.13.220 (10.10.13.220)' 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.220' (ECDSA) to the list of known hosts.
dmdba@10.10.13.220's password:
dmmpp.ctl                                                                                                                                                                                                100%   41KB   2.1MB/s   00:00

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP2]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 444444                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/mpp02/dm.ini                        #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm8mppdw2 mpp02]$ vi dmwatcher.ini
[GRP2]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 444444
INST_INI = /dm8/data/mpp02/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

主库启动到mount状态设置oguid
主库mpp01:

[dmdba@dm8mppdw1 ~]$ dmserver /dm8/data/mpp01/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: 24618
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,使用 MPP 类型为 LOCAL 方式,登录主库修改数据库为Primary 模式。)

[dmdba@dm8mppdw1 ~]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}"

Server[localhost:5236]:mode is normal, state is mount
login used time : 2.701(ms)
disql V8
SQL>

SQL> sp_set_oguid(333333);
DMSQL executed successfully
used time: 77.628(ms). Execute id is 0.

修改数据库模式

SQL> alter database primary;
executed successfully
used time: 91.249(ms). Execute id is 0.

主库mpp02:

[dmdba@dm8mppdw2 mpp02]$ dmserver /dm8/data/mpp02/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
begin redo pwr log collect, last ckpt lsn: 24618 ...
redo pwr log collect finished
main rfil[/dm8/data/mpp02/mpp0201.log]'s grp collect 0 valid pwr record, discard 0 invalid pwr record
EP[0]'s cur_lsn[24618], file_lsn[24618]
begin redo log recover, last ckpt lsn: 24618 ...
redo log recover 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.

[dmdba@dm8mppdw2 mpp02]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}"

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

修改数据库模式

SQL> alter database primary;
executed successfully
used time: 98.390(ms). Execute id is 0.

备库启动到mount状态设置oguid
备库mpp11:

[dmdba@dm8mppdw3 ~]$ dmserver /dm8/data/mpp01/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: 24618
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.

[dmdba@dm8mppdw3 mpp01]$ disql SYSDBA/SYSDBA@localhost:5236

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

修改数据库模式

SQL> alter database standby;
executed successfully
used time: 114.912(ms). Execute id is 0.

备库mpp12:

[dmdba@dm8mppdw4 ~]$ dmserver /dm8/data/mpp02/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: 24618
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.

[dmdba@dm8mppdw4 mpp02]$ disql SYSDBA/SYSDBA@localhost:5236#"{mpp_type=local}"

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

修改数据库模式

SQL> alter database standby;
executed successfully
used time: 53.966(ms). Execute id is 0.

注册并启动守护进程
主库mpp01:

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

[root@dm8mppdw1 ~]# service DmWatcherServicempp01 start
Redirecting to /bin/systemctl start DmWatcherServicempp01.service

主库mpp02

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

[root@dm8mppdw2 ~]# service DmWatcherServicempp02 start
Redirecting to /bin/systemctl start DmWatcherServicempp02.service

备库mpp11:

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

[root@dm8mppdw3 ~]# service DmWatcherServicempp11 start
Redirecting to /bin/systemctl start DmWatcherServicempp11.service

备库mpp12:

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

[root@dm8mppdw4 ~]# service DmWatcherServicempp12 start
Redirecting to /bin/systemctl start DmWatcherServicempp12.service

查看file_lsn与cur_lsn主备库是否一致
主库mpp01:

SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          25877                25877

used time: 3.526(ms). Execute id is 700.

主库mpp02:

SQL>  select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          25877                25877

used time: 4.583(ms). Execute id is 700.

备库mpp11:

SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          25877                25877

used time: 1.855(ms). Execute id is 201.

备库mpp12:

SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          25877                25877

used time: 1.987(ms). Execute id is 201.

配置监视器
由于主备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间

[GRP1]
MON_INST_OGUID = 333333                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.217:5239
MON_DW_IP = 10.10.13.219:5239

[GRP2]
MON_INST_OGUID = 444444                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.218:5239
MON_DW_IP = 10.10.13.220:5239

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

[GRP1]
MON_INST_OGUID = 333333


MON_DW_IP = 10.10.13.217:5239
MON_DW_IP = 10.10.13.219:5239

[GRP2]
MON_INST_OGUID = 444444


MON_DW_IP = 10.10.13.218:5239
MON_DW_IP = 10.10.13.220:5239

启动监视器:

[dmdba@dm8mppdw5 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-01-28 09:29:19: DMMONITOR[4.0] V8
[monitor]         2022-01-28 09:29:19: DMMONITOR[4.0] IS READY.

[monitor]         2022-01-28 09:29:19: Received message from(MPP01)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-28 09:29:19  OPEN           OK        MPP01            OPEN        PRIMARY   VALID    2        25877           25877

[monitor]         2022-01-28 09:29:20: Received message from(MPP11)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-28 09:29:19  OPEN           OK        MPP11            OPEN        STANDBY   VALID    2        25877           25877

[monitor]         2022-01-28 09:29:20: Received message from(MPP02)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-28 09:29:19  OPEN           OK        MPP02            OPEN        PRIMARY   VALID    2        25877           25877

[monitor]         2022-01-28 09:29:20: Received message from(MPP12)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-28 09:29:19  OPEN           OK        MPP12            OPEN        STANDBY   VALID    2        25877           25877

show
2022-01-28 09:29:32
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             333333      TRUE            AUTO            TRUE


< >
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.217      5239         2022-01-28 09:29:31  GLOBAL    VALID     OPEN           MPP01            OK        1     1     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.217      5236       OK        MPP01            OPEN        PRIMARY   0          0            REALTIME  VALID    4213            25877           4213            25877           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.219      5239         2022-01-28 09:29:31  GLOBAL    VALID     OPEN           MPP11            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.219      5236       OK        MPP11            OPEN        STANDBY   0          0            REALTIME  VALID    4207            25877           4207            25877           NONE

DATABASE(MPP11) APPLY INFO FROM (MPP01), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4213, 4213, 4213], (RLSN, SLSN, KLSN)[25877, 25877, 25877], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (25877)


#--------------------------------------------------------------------------------#
2022-01-28 09:29:32
#--------------------------------------------------------------------------------#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP2             444444      TRUE            AUTO            TRUE


< >
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.218      5239         2022-01-28 09:29:31  GLOBAL    VALID     OPEN           MPP02            OK        1     1     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.218      5236       OK        MPP02            OPEN        PRIMARY   0          0            REALTIME  VALID    4217            25877           4217            25877           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.220      5239         2022-01-28 09:29:31  GLOBAL    VALID     OPEN           MPP12            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.220      5236       OK        MPP12            OPEN        STANDBY   0          0            REALTIME  VALID    4211            25877           4211            25877           NONE

DATABASE(MPP12) APPLY INFO FROM (MPP02), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4217, 4217, 4217], (RLSN, SLSN, KLSN)[25877, 25877, 25877], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (25877)


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

或者

[root@dm8mppdw5 ~]# /dm8/script/root/dm_service_installer.sh -monitor_ini /dm8/data/dmmonitor.ini -p mppdw -t dmmonitor
Created symlink from /etc/systemd/system/multi-user.target.wants/DmMonitorServicemppdw.service to /usr/lib/systemd/system/DmMonitorServicemppdw.service.
Finished to create the service (DmMonitorServicemppdw)

使用服务方式启动不能执行相关命令来显示监控信息所以一般不使用

验证
MPP 验证
在MPP主节点1(mpp01)创建测试表:

[dmdba@dm8mppdw1 ~]$ disql SYSDBA/SYSDBA

Server[LOCALHOST:5236]:mode is primary, state is open
login used time : 3.571(ms)
disql V8
SQL> create table test as select * from sysobjects;
executed successfully
used time: 209.673(ms). Execute id is 900.

到MPP主节点2(mpp02)查询:MPP运行正常:

[dmdba@dm8mppdw2 mpp02]$ disql SYSDBA/SYSDBA

Server[LOCALHOST:5236]:mode is primary, state is open
login used time : 3.175(ms)
disql V8
SQL> select count(*) from test;

LINEID     COUNT(*)
---------- --------------------
1          728

used time: 9.494(ms). Execute id is 415390.

数据守护验证
备库mpp11:

[dmdba@dm8mppdw3 mpp01]$ disql SYSDBA/SYSDBA@LOCALHOST:5236

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

LINEID     COUNT(*)
---------- --------------------
1          728

used time: 6.369(ms). Execute id is 300.

备库mpp12:

SQL> select count(*) from test;

LINEID     COUNT(*)
---------- --------------------
1          0

used time: 0.310(ms). Execute id is 201.

确认下守护进程的信息,运行是正常的:
备库mpp11:

SQL> select * from v$dmwatcher;

LINEID     N_GROUP     GROUP_NAME INST_NAME DW_TYPE DW_MODE AUTO_RESTART DW_STATUS DW_SUB_STATUS   LAST_MSG_TIME              SWITCH_COUNT CTL_NUM     INST_NUM    MAX_CONN_NUM
---------- ----------- ---------- --------- ------- ------- ------------ --------- --------------- -------------------------- ------------ ----------- ----------- ------------
1          1           GRP1       MPP11     GLOBAL  AUTO    1            OPEN      SUB_STATE_START 2022-01-28 11:08:34.000000 0            1           1           2

used time: 1.327(ms). Execute id is 203.
SQL> select * from v$mal_link_status;

LINEID     SRC_SITE DEST_SITE CTL_LINK_STATUS DATA_LINK_STATUS
---------- -------- --------- --------------- ----------------
1          MPP11    MPP01     CONNECTED       CONNECTED
2          MPP11    MPP02     CONNECTED       CONNECTED
3          MPP11    MPP12     CONNECTED       CONNECTED

used time: 0.798(ms). Execute id is 204.

备库mpp12:

SQL> select * from v$dmwatcher;

LINEID     N_GROUP     GROUP_NAME INST_NAME DW_TYPE DW_MODE AUTO_RESTART DW_STATUS DW_SUB_STATUS   LAST_MSG_TIME              SWITCH_COUNT CTL_NUM     INST_NUM    MAX_CONN_NUM
---------- ----------- ---------- --------- ------- ------- ------------ --------- --------------- -------------------------- ------------ ----------- ----------- ------------
1          1           GRP2       MPP12     GLOBAL  AUTO    1            OPEN      SUB_STATE_START 2022-01-28 11:08:30.000000 0            1           1           2

used time: 1.383(ms). Execute id is 203.
SQL> select * from v$mal_link_status;

LINEID     SRC_SITE DEST_SITE CTL_LINK_STATUS DATA_LINK_STATUS
---------- -------- --------- --------------- ----------------
1          MPP12    MPP01     CONNECTED       CONNECTED
2          MPP12    MPP02     CONNECTED       CONNECTED
3          MPP12    MPP11     CONNECTED       CONNECTED

used time: 0.986(ms). Execute id is 204.

DM8配置读写分离集群

配置读写分离集群
下列机器事先都安装了DM,安装路径为’/dm8’,执行程序保存在’/dm8/bin’目录中,数据存放路径为’/dm8/data’。

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为读写分离集群,主库命名为“JY1”,备库分别命名为JY2”和“JY3”。


机器名     IP地址                    初始状态                          操作系统
dm8rw1     10.10.13.213(对外)       主库 jy1                          redhat 7.8
           10.10.13.213(mal对内)

dm8rw2     10.10.13.214(对外)
           10.10.13.214(mal对内)     备库 jy2                          redhat 7.8

dm8rw3     10.10.13.215(对外)
           10.10.13.215(mal对内)     备库 jy3                          redhat 7.8

dm8rw4     10.10.13.216              确认监视器                       redhat 7.8



实例名              port_num             mal_inst_dw_port    mal_host                mal_port        mal_dw_port
jy1                 5236                 5237                10.10.13.213          5238            5239
jy2                 5236                 5237                10.10.13.214          5238            5239
jy3                 5236                 5237                10.10.13.215          5238            5239

安装DM数据库软件

数据准备
在主库机器上初始化数据库到目录/dm8/data:

[dmdba@dm8rw1 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy1 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:10:20


创建DmAPService用于dmrman来执行备份
主库

[root@dm8rw1 bin]# /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)

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

备库jy2

[root@dm8rw2 bin]# /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)

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

备库jy3

[root@dm8rw3 bin]# /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)
[root@dm8rw3 bin]# service DmAPService start
Redirecting to /bin/systemctl start DmAPService.service

注册服务用于启动数据库

[root@dm8rw1 bin]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy1 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy1.service to /usr/lib/systemd/system/DmServicejy1.service.
Finished to create the service (DmServicejy1)

正常启动数据库并正常关闭

[root@dm8rw1 bin]# service DmServicejy1 start
Redirecting to /bin/systemctl start DmServicejy1.service

[dmdba@dm8rw1 jy]$ disql SySDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 4.305(ms)
disql V8
SQL> select instance_name from v$instance;

LINEID     INSTANCE_NAME
---------- -------------
1          JY1

used time: 5.512(ms). Execute id is 53700.

[root@dm8rw1 bin]# service DmServicejy1 stop
Redirecting to /bin/systemctl stop DmServicejy1.service

备份主库

1. 正常关闭数据库

[root@dm8rw1 bin]# service DmServicejy1 stop
Redirecting to /bin/systemctl stop DmServicejy1.service

2.使用dmrman来进行冷备份

[dmdba@dm8rw1 jy]$ dmrman CTLSTMT="backup database '/dm8/data/jy/dm.ini' full backupset  '/dm8/jy1_full_bak_1'"
dmrman V8
backup database '/dm8/data/jy/dm.ini' full backupset '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
Processing backupset /dm8/jy1_full_bak_1
[Percent:100.00%][Speed:0.00M/s][Cost:00:00:00][Remaining:00:00:00]
backup successfully!
time used: 00:00:01.468



将主库的备份复制备库:

[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.214:/dm8
dmdba@10.10.13.214's password:
jy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  24.8MB/s   00:00
jy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   4.2MB/s   00:00
[dmdba@dm8rw1 dm8]$ scp -r jy1_full_bak_1 10.10.13.215:/dm8
dmdba@10.10.13.215's password:
jy1_full_bak_1.bak                                                                                                                                                                                       100% 6334KB  10.9MB/s   00:00
jy1_full_bak_1.meta                                                                                                                                                                                      100%   77KB   1.2MB/s   00:00
[dmdba@dm8rw1 dm8]$

创建备库备库并恢复
备库jy2:

[dmdba@dm8rw2 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy2 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:46:05

备库jy3:

[dmdba@dm8rw3 dm8]$ dminit path=/dm8/data db_name=jy instance_name=jy3 port_num=5236 page_size=8 charset=0
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/jy/jy01.log


 log file path: /dm8/data/jy/jy02.log

write to dir [/dm8/data/jy].
create dm database success. 2022-01-18 21:46:37

恢复备库
备库jy2:

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'"
dmrman V8
restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'
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.615

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
no log generates while the backupset [/dm8/jy1_full_bak_1] created
recover successfully!
time used: 345.359(ms)

[dmdba@dm8rw2 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC
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[26788], file_lsn[26788]
recover successfully!
time used: 00:00:01.066

备库jy3:

[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'"
dmrman V8
restore database '/dm8/data/jy/dm.ini' from backupset '/dm8/jy1_full_bak_1'
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:06][Remaining:00:00:00]
restore successfully.
time used: 00:00:06.606
[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' FROM BACKUPSET '/dm8/jy1_full_bak_1'
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[26788], file_lsn[26788]
no log generates while the backupset [/dm8/jy1_full_bak_1] created
recover successfully!
time used: 323.405(ms)
[dmdba@dm8rw3 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/jy/dm.ini' UPDATE DB_MAGIC
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[26788], file_lsn[26788]
recover successfully!
time used: 00:00:01.069


配置操作
一.主库
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy1
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw1 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。
除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例jy1是主库,需要向即时备库jy2/jy3同步数据,因此即时归档的ARCH_DEST分别配置为jy2和jy3。

[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY                 #即时归档类型
ARCH_DEST = jy2                    #即时归档目标实例名
[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY                 #即时归档类型
ARCH_DEST = jy3                    #即时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                  #本地归档类型
ARCH_DEST = /dm8/arch              #本地归档文件存放路径
ARCH_FILE_SIZE = 128               #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0               #单位Mb,0表示无限制,范围1024~4294967294M

[dmdba@dm8rw1 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw1 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库jy2
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy2
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw2 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。

除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名

当前实例jy2是备库,守护系统配置完成后,可能在各种故障处理中,jy2切换为新的主库,正常情况下,jy1会切换为新的备库,需要向jy1和jy3同步数据,因此即时归档的ARCH_DEST分别配置为jy1和jy3。

[dmdba@dm8rw2 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy3

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw2 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

配置备库jy3
配置dm.ini文件,配置以下参数

INSTANCE_NAME = jy3
PORT_NUM = 5236                             #数据库实例监听端口
DW_INACTIVE_INTERVAL = 60                   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0                       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINE_TS = 2                       #不允许备库OFFLINE表空间
MAL_INI = 1                                 #打开MAL系统
ARCH_INI = 1                                #打开归档配置
RLOG_SEND_APPLY_MON = 64                    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5               #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5           #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = jy1                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.213            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.213       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = jy2                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.214            #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.214       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口

[MAL_INST3]
MAL_INST_NAME = jy3                  #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 10.10.13.215              #MAL系统监听TCP连接的IP地址
MAL_PORT = 5238                      #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.215       #实例的对外服务IP地址
MAL_INST_PORT = 5236                 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5239                   #实例对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5237              #实例监听守护进程TCP连接的端口


[dmdba@dm8rw3 jy]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = jy1
MAL_HOST = 10.10.13.213
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.213
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST2]
MAL_INST_NAME = jy2
MAL_HOST = 10.10.13.214
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.214
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

[MAL_INST3]
MAL_INST_NAME = jy3
MAL_HOST = 10.10.13.215
MAL_PORT = 5238
MAL_INST_HOST = 10.10.13.215
MAL_INST_PORT = 5236
MAL_DW_PORT = 5239
MAL_INST_DW_PORT = 5237

配置dmarch.ini
修改dmarch.ini,配置本地归档和即时归档。

除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名

当前实例jy3是备库,守护系统配置完成后,可能在各种故障处理中,jy3切换为新的主库,正常情况下,jy1会切换为新的备库,需要向jy1和jy2同步数据,因此即时归档的ARCH_DEST分别配置为jy1和jy2。

[dmdba@dm215 jy]$ vi dmarch.ini
[ARCHIVE_TIMELY1]
ARCH_TYPE = TIMELY
ARCH_DEST = jy1

[ARCHIVE_TIMELY2]
ARCH_TYPE = TIMELY
ARCH_DEST = jy2

[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 222222                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/jy/dm.ini                           #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭


[dmdba@dm8rw3 jy]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 222222
INST_INI = /dm8/data/jy/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

二:
主库启动到mount状态设置oguid

[dmdba@dm8rw1 ~]$ dmserver /dm8/data/jy/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: 25300
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.


[dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 3.177(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 66.753(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 3.112(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.941(ms). Execute id is 2.

备库jy2启动到mount状态设置oguid

[dmdba@dm8rw2 ~]$ dmserver /dm8/data/jy/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: 26788
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.



[dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 5.278(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 114.383(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 19.022(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.356(ms). Execute id is 2.

备库jy3启动到mount状态设置oguid

[dmdba@dm8rw3 ~]$ dmserver /dm8/data/jy/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: 26788
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.


[dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is mount
login used time : 5.145(ms)
disql V8
SQL> sp_set_oguid(222222);
DMSQL executed successfully
used time: 110.938(ms). Execute id is 0.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          26788                26788

used time: 14.513(ms). Execute id is 1.
SQL> select permanent_magic;

LINEID     PERMANENT_MAGIC
---------- ---------------
1          518889968

used time: 1.549(ms). Execute id is 2.

备库jy2注册服务用于启动数据库

[root@dm8rw2 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy2 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy2.service to /usr/lib/systemd/system/DmServicejy2.service.
Finished to create the service (DmServicejy2)

备库jy3注册服务用于启动数据库

[root@dm8rw3 ~]# /dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/jy/dm.ini -p jy3 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicejy3.service to /usr/lib/systemd/system/DmServicejy3.service.
Finished to create the service (DmServicejy3)

三:
主库以primary打开

[dmdba@dm8rw1 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

备库jy2以standby 打开

[dmdba@dm8rw2 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

备库jy3以standby 打开

[dmdba@dm8rw3 jy]$ disql SYSDBA/SYSDBA@localhost:5236

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

启动命令行工具DIsql,登录备库修改数据库为Standby模式如果当前数据库不是normal模式,需要先修改dm.ini中ALTER_MODE_STATUS值为1,允许修改数据库模式,修改Standby模式成功后再改回为0。如果是normal模式,请忽略下面的第1步和第3步。

SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); ----第1步
SQL>alter database standby; ----第2步
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0); ----第3步

四:
启动守护进程
启动各个主备库上的守护进程:
主库

[dmdba@dm8rw1 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:19
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         RECOVERY        WAIT_SEND_ARCH  VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY1              PRIMARY   OPEN         TIMELY    4205            28044           4205            28044           4
---------------------------------------------------------------------------


备库jy2

[dmdba@dm8rw2 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:28
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         OPEN            SUB_STATE_START VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY2              STANDBY   OPEN         TIMELY    4204            28044           4204            28044           0

DATABASE(JY2) APPLY INFO:
REDOS_PARALLEL_NUM (1)
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)

---------------------------------------------------------------------------

备库jy3

[dmdba@dm8rw3 ~]$ dmwatcher /dm8/data/jy/dmwatcher.ini
DMWATCHER[4.0] V8
DMWATCHER[4.0] IS READY
show
2022-01-18 22:23:35
---------------------------------------------------------------------------
GROUP_NAME       TYPE      MODE      OGUID       MPP_FLAG  AUTO_RESTART DW_STATUS       DW_SUB_STATUS   DW_CTL_STATUS
GRP1             GLOBAL    AUTO      222222      FALSE     TRUE         OPEN            SUB_STATE_START VALID

INST_OK   NAME             SVR_MODE  SYS_STATUS   RTYPE     FSEQ            FLSN            CSEQ            CLSN            DW_STAT_FLAG
OK        JY3              STANDBY   OPEN         TIMELY    4204            28044           4204            28044           0

DATABASE(JY3) APPLY INFO:
REDOS_PARALLEL_NUM (1)
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4205, 4205, 4205], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)

---------------------------------------------------------------------------

也可以注册守护进程服务来进行启动
主库

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

[root@dm8rw1 ~]# service DmWatcherServicejy1 start
Redirecting to /bin/systemctl start DmWatcherServicejy1.service

备库1

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

[root@dm8rw2 ~]# service DmWatcherServicejy2 start
Redirecting to /bin/systemctl start DmWatcherServicejy2.service

备库2

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

[root@dm8rw3 ~]# service DmWatcherServicejy3 start
Redirecting to /bin/systemctl start DmWatcherServicejy3.service

配置监视器
由于主库和即时备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知即时备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间
[GRP1]
MON_INST_OGUID = 222222                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 10.10.13.213:5238
MON_DW_IP = 10.10.13.214:5238
MON_DW_IP = 10.10.13.215:5238


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

[GRP1]
MON_INST_OGUID = 222222



MON_DW_IP = 10.10.13.213:5238
MON_DW_IP = 10.10.13.214:5238
MON_DW_IP = 10.10.13.215:5238

启动监视器:

[dmdba@dm8rw4 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-01-18 22:28:01: DMMONITOR[4.0] V8
[monitor]         2022-01-18 22:28:02: DMMONITOR[4.0] IS READY.

[monitor]         2022-01-18 22:28:02: Received message from(JY1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY1              OPEN        PRIMARY   VALID    3        28044           28044

[monitor]         2022-01-18 22:28:02: Received message from(JY3)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY3              OPEN        STANDBY   VALID    3        28044           28044

[monitor]         2022-01-18 22:28:02: Received message from(JY2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-18 22:28:02  OPEN           OK        JY2              OPEN        STANDBY   VALID    3        28044           28044

show
2022-01-18 22:28:11
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             222222      TRUE            AUTO            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.213      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY1              OK        1     1     OPEN        PRIMARY   DSC_OPEN       TIMELY    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.213      5236       OK        JY1              OPEN        PRIMARY   0          0            TIMELY    VALID    4207            28044           4207            28044           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.214      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY2              OK        1     1     OPEN        STANDBY   DSC_OPEN       TIMELY    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.214      5236       OK        JY2              OPEN        STANDBY   0          0            TIMELY    VALID    4204            28044           4204            28044           NONE

DATABASE(JY2) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)


< >
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.215      5239         2022-01-18 22:28:10  GLOBAL    VALID     OPEN           JY3              OK        1     1     OPEN        STANDBY   DSC_OPEN       TIMELY    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.215      5236       OK        JY3              OPEN        STANDBY   0          0            TIMELY    VALID    4204            28044           4204            28044           NONE

DATABASE(JY3) APPLY INFO FROM (JY1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4207, 4207, 4207], (RLSN, SLSN, KLSN)[28044, 28044, 28044], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28044)


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

测试数据同步
主库:

SQL> create table test(id number(10));
executed successfully
used time: 198.382(ms). Execute id is 103.
SQL> insert into test values(1);
affect rows 1

SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 0.350(ms). Execute id is 501.



used time: 1.182(ms). Execute id is 104.
SQL> commit;
executed successfully
used time: 12.799(ms). Execute id is 105.

备库jy2:

SQL> select * from test;

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

used time: 2.615(ms). Execute id is 202.
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 5.798(ms). Execute id is 0.

备库jy3:

SQL> select * from test;

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

used time: 2.691(ms). Execute id is 202.
SQL> select file_LSN, cur_LSN from v$rlog;
LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          29574                29574

used time: 5.949(ms). Execute id is 0.

接口说明

DM多种客户端接口都支持读写分离集群连接设置,以下说明客户端连接服务器时如何设置读写分离属性,详细可参考《DM8程序员手册》。4

JDBC接口
在JDBC连接串中增加了两个连接属性:
n rwSeparate 是否使用读写分离系统,默认0;取值(0不使用,1使用)。
n rwPercent 分发到主库的事务占主备库总事务的百分比,有效值0~100,默认值25。
dm.jdbc.driver.DmDriver
jdbc:dm://192.168.0.206:5236?rwSeparate=1&rwPercent=10

DM8 数据守护实时主备搭建

数据守护实时主备搭建

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

各主备库的实例名建议采用“组名_守护环境_序号”的方式命名,方便按组区分不同实例,注意总长度不能超过16。本示例中组名为“GRP1”,配置为实时主备,主库命名为“GRP1_RT_01”,备库命名为“GRP1_RT_02”。

机器名     IP地址                  初始状态                         操作系统
dm209     10.10.13.209(对外)     主库 dm1                         redhat 7.8
          11.11.11.209(mal对内)


dm210    10.10.13.210(对外)
         11.11.11.210(mal对内)     备库 dm2                         redhat 7.8

dm211    11.11.11.211            确认监视器                       redhat 7.8


实例名       port_num             mal_inst_dw_port    mal_host              mal_port        mal_dw_port
dm1          5236                 5239                11.11.11.209          5237            5238
dm2          5236                 5239                11.11.11.210          5237            5238

数据准备
在主库机器上初始化数据库到目录/dm8/data:

[dmdba@dm209 dm8]$ dminit path=/dm8/data db_name=dm instance_name=dm1 port_num=5236 page_size=8 charset=0
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/dm/dm01.log


 log file path: /dm8/data/dm/dm02.log

write to dir [/dm8/data/dm].
create dm database success. 2022-01-13 10:28:01

注册服务用于启动数据库

[root@dm209 root]# ./dm_service_installer.sh -dm_ini /dm8/data/dm/dm.ini -p dm1 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedm1.service to /usr/lib/systemd/system/DmServicedm1.service.
Finished to create the service (DmServicedm1)

正常启动数据库并正常关闭

[root@dm209 root]# service DmServicedm1 start
Redirecting to /bin/systemctl start DmServicedm1.service
[root@dm209 root]# ps -ef | grep dmserver
dmdba    18402     1 17 10:33 ?        00:00:04 /dm8/bin/dmserver path=/dm8/data/dm/dm.ini -noconsole
root     18487  4030  0 10:34 pts/1    00:00:00 grep --color=auto dmserver

[root@dm209 ~]# su - dmdba
Last login: Thu Jan 13 10:16:30 CST 2022 on pts/1
[dmdba@dm209 ~]$ disql SYSDBA/SYSDBA@localhost:5236

Server[localhost:5236]:mode is normal, state is open
login used time : 7.108(ms)
disql V8
SQL> exit

[root@dm209 ~]# service DmServicedm1 stop
Redirecting to /bin/systemctl stop DmServicedm1.service

注册服务用于将数据库启动到mount状态

[root@dm209 root]# ./dm_service_installer.sh -dm_ini /dm8/data/dm/dm.ini -p dm1mount -t dmserver -m mount
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedm1mount.service to /usr/lib/systemd/system/DmServicedm1mount.service.
Finished to create the service (DmServicedm1mountT)

备份主库
使用联机备份:

[root@dm209 root]# ./dm_service_installer.sh -t dmap -dm_ini /dm8/data/dm/dm.ini
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)
[root@dm209 root]# service DmAPService start
Redirecting to /bin/systemctl start DmAPService.service


SQL> BACKUP DATABASE FULL BACKUPSET '/dm8/data/dm_full_01';
executed successfully
used time: 00:00:02.521. Execute id is 501.

创建备库备库并恢复

[dmdba@dm210 data]$ dminit path=/dm8/data db_name=dm instance_name=dm2 port_num=5236 page_size=8 charset=0
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/dm/dm01.log


 log file path: /dm8/data/dm/dm02.log

write to dir [/dm8/data/dm].
create dm database success. 2022-01-13 16:02:51


将主库的备份复制备库:

[root@dm209 data]# scp -r dm_full_01 10.10.13.210:/dm8/data
root@10.10.13.210's password:
dm_full_01.bak                                                                                                                                                                                           100%   15MB  30.7MB/s   00:00
dm_full_01_1.bak                                                                                                                                                                                         100%  164KB   6.2MB/s   00:00
dm_full_01.meta                                                                                                                                                                                          100%   85KB   3.6MB/s   00:00
[root@dm209 data]#

恢复备库:

[dmdba@dm210 data]$ dmrman CTLSTMT="RESTORE DATABASE '/dm8/data/dm/dm.ini' FROM BACKUPSET '/dm8/data/dm_full_01'"
dmrman V8
RESTORE DATABASE '/dm8/data/dm/dm.ini' FROM BACKUPSET '/dm8/data/dm_full_01'
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:06][Remaining:00:00:00]
restore successfully.
time used: 00:00:06.629

[dmdba@dm210 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/dm/dm.ini' FROM BACKUPSET '/dm8/data/dm_full_01'"
dmrman V8
RECOVER DATABASE '/dm8/data/dm/dm.ini' FROM BACKUPSET '/dm8/data/dm_full_01'
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[25922], file_lsn[25922]
[Percent:100.00%][Speed:0.00PKG/s][Cost:00:00:00][Remaining:00:00:00]
recover successfully!
time used: 00:00:02.895

[dmdba@dm210 ~]$ dmrman CTLSTMT="RECOVER DATABASE '/dm8/data/dm/dm.ini' UPDATE DB_MAGIC"
dmrman V8
RECOVER DATABASE '/dm8/data/dm/dm.ini' UPDATE DB_MAGIC
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[26568], file_lsn[26568]
recover successfully!
time used: 00:00:01.093


配置操作
一.主库
配置dm.ini文件,配置以下参数:

DW_INACTIVE_INTERVAL = 60   #接收守护进程消息超时时间
ALTER_MODE_STATUS = 0       #不允许手工方式修改实例模式/状态
ENABLE_OFFLINEi_TS = 2      #不允许备库OFFLINE表空间
MAL_INI = 1                 #打开MAL系统
ARCH_INI = 1                #打开归档配置
RLOG_SEND_APPLY_MON = 64    #统计最近64次的日志发送信息

配置dmmal.ini文件
配置MAL系统,各主备库的dmmal.ini配置必须完全一致,MAL_HOST使用内部网络IP,MAL_PORT与dm.ini中PORT_NUM使用不同的端口值,MAL_DW_PORT是各实例对应的守护进程之间,以及守护进程和监视器之间的通信端口,配置如下:

MAL_CHECK_INTERVAL = 5          #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5      #判定MAL链路断开的时间

[MAL_INST1]
MAL_INST_NAME = dm1              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 11.11.11.209          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.209   #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口

[MAL_INST2]
MAL_INST_NAME = dm2              #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 11.11.11.210          #MAL系统监听TCP连接的IP地址
MAL_PORT = 5237                  #MAL系统监听TCP连接的端口
MAL_INST_HOST = 10.10.13.210   #实例的对外服务IP地址
MAL_INST_PORT = 5236             #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238               #实例本地的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239          #实例监听守护进程TCP连接的端口
[dmdba@dm209 dm]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5

[MAL_INST1]
MAL_INST_NAME = dm1
MAL_HOST = 11.11.11.209
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.209
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

[MAL_INST2]
MAL_INST_NAME = dm2
MAL_HOST = 11.11.11.210
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.210
MAL_INST_PORT = 5236
MAL_DW_PORT = 5238
MAL_INST_DW_PORT = 5239

配置dmarch.ini
修改dmarch.ini,配置本地归档和实时归档。除了本地归档外,其他归档配置项中的ARCH_DEST表示实例是Primary模式时,需要同步归档数据的目标实例名。当前实例dm1是主库,需要向dm2(实时备库)同步数据,因此实时归档的ARCH_DEST配置为DM2。

[ARCHIVE_REALTIME]                                #实时归档
ARCH_TYPE = REALTIME                              #实时归档类型
ARCH_DEST = dm2                                   #实时归档目标实例名
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL                                 #本地归档类型
ARCH_DEST = /dm8/data/dm/arch                     #本地归档文件存放路径
ARCH_FILE_SIZE = 128                              #单位Mb,本地单个归档文件最大值
ARCH_SPACE_LIMIT = 0                              #单位Mb,0表示无限制,范围1024~4294967294M


[dmdba@dm209 dm]$ vi dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = dm2
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm8/data/dm/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0

配置dmwatcher.ini
修改dmwatcher.ini配置守护进程,配置为全局守护类型,使用自动切换模式。

[GRP1]
DW_TYPE = GLOBAL                                         #全局守护类型
DW_MODE = AUTO                                           #自动切换模式  生产建议设置成手动
DW_ERROR_TIME = 10                                       #远程守护进程故障认定时间
INST_RECOVER_TIME = 60                                   #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10                                     #本地实例故障认定时间
INST_OGUID = 111111                                      #守护系统唯一OGUID值
INST_INI = /dm8/data/dm/dm.ini                       #dm.ini配置文件路径
INST_AUTO_RESTART = 1                                    #打开实例的自动启动功能(建议设置成0)
INST_STARTUP_CMD = /dm8/bin/dmserver                     #命令行方式启动
RLOG_SEND_THRESHOLD = 0                                  #指定主库发送日志到备库的时间阀值,默认关闭
RLOG_APPLY_THRESHOLD = 0                                 #指定备库重演日志的时间阀值,默认关闭

[dmdba@dm209 dm]$ vi dmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 111111
INST_INI = /dm8/data/dm/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm8/bin/dmserver
RLOG_SEND_THRESHOLD = 0
RLOG_APPLY_THRESHOLD = 0

以mount模式启动主库

[root@dm209 root]# service DmServicedm1 stop
Redirecting to /bin/systemctl stop DmServicedm1.service

[root@dm209 root]# service DmServicedm1mountT start
Redirecting to /bin/systemctl start DmServicedm1mountT.service

设置主库 OGUID

SQL> sp_set_oguid(111111);
DMSQL executed successfully
used time: 115.044(ms). Execute id is 0.

修改主数据库模式

SQL> alter database primary;
executed successfully
used time: 80.002(ms). Execute id is 0.

将主库的dm.ini,dmmal.ini,dmarch.ini,dmwatcher.ini文件复制到备库

[root@dm209 dm]# scp dm*.ini 10.10.13.210:/dm8/data/dm
root@10.10.13.210's password:
dmarch.ini                                                                                                                                                                                               100%  346    18.3KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   52KB  29.9MB/s   00:00
dmmal.ini                                                                                                                                                                                                100%  547    16.9KB/s   00:00
dmwatcher.ini                                                                                                                                                                                            100%  568   332.1KB/s   00:00
[root@dm209 dm]#

二备库
备机修改相关配置
修改dm.ini

INSTANCE_NAME = DM2

dmmal.ini与主库一致不用修改

修改dmarch.ini

ARCH_DEST = DM1

dmwatcher.ini 和主库一致

注册服务用于启动数据库到mount状态

[root@dm210 root]# ./dm_service_installer.sh -dm_ini /dm8/data/dm/dm.ini -p dm2mount -t dmserver -m mount
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedm2mount.service to /usr/lib/systemd/system/DmServicedm2mount.service.
Finished to create the service (DmServicedm2mount)

注册服务用于启动数据库

[root@dm210 root]# ./dm_service_installer.sh -dm_ini /dm8/data/dm/dm.ini -p dm2  -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicedm2.service to /usr/lib/systemd/system/DmServicedm2.service.
Finished to create the service (DmServicedm2)

以mount方式启动备库

[root@dm210 root]# service DmServicedm2mount start
Redirecting to /bin/systemctl start DmServicedm2mount.service

设置备库 OGUID

SQL> sp_set_oguid(111111);
DMSQL executed successfully
used time: 115.044(ms). Execute id is 0.

修改备数据库模式
如果当前数据库不是normal模式,需要先修改dm.ini中ALTER_MODE_STATUS值为1,允许修改数据库模式,修改Standby模式成功后再改回为0。如果是normal模式,请忽略下面的第1步和第3步。

SQL> alter database standby;
alter database standby;
[-720]:Error in line: 1
Dmwatcher is active, or current configuration(ALTER_MODE_STATUS) not allowed to alter database.
used time: 0.636(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
DMSQL executed successfully
used time: 7.791(ms). Execute id is 1.
SQL> alter database standby;
executed successfully
used time: 94.298(ms). Execute id is 0.
SQL> SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
DMSQL executed successfully
used time: 8.414(ms). Execute id is 2.

注册并启动守护进程
主库

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

[root@dm209 root]# service DmWatcherServicedw1 start
Redirecting to /bin/systemctl start DmWatcherServicedw1.service

备库

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

[root@dm210 root]# service DmWatcherServicedw2 start
Redirecting to /bin/systemctl start DmWatcherServicedw2.service

查看file_lsn与cur_lsn主备库是否一致
主库

[dmdba@dm209 arch]$ disql SYSDBA/SYSDBA

Server[LOCALHOST:5236]:mode is primary, state is mount
login used time : 4.992(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          28059                28059

used time: 4.592(ms). Execute id is 700.

备库

[dmdba@dm210 ~]$ disql SYsDBA/SYSDBA

Server[LOCALHOST:5236]:mode is standby, state is open
login used time : 5.676(ms)
disql V8
SQL> select file_LSN, cur_LSN from v$rlog;

LINEID     FILE_LSN             CUR_LSN
---------- -------------------- --------------------
1          28059                28059

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

配置监视器(基本要求,安装dm8的软件)
由于主库和实时备库的守护进程配置为自动切换模式,因此这里选择配置确认监视器。和普通监视器相比,确认监视器除了相同的命令支持外,在主库发生故障时,能够自动通知实时备库接管为新的主库,具有自动故障处理的功能。

修改dmmonitor.ini配置确认监视器,其中MON_DW_IP中的IP和PORT和dmmal.ini中的MAL_HOST和MAL_DW_PORT配置项保持一致。

MON_DW_CONFIRM = 1                          #确认监视器模式
MON_LOG_PATH = /dm8/data/log                #监视器日志文件存放路径
MON_LOG_INTERVAL = 60                       #每隔60s定时记录系统信息到日志文件
MON_LOG_FILE_SIZE = 32                      #每个日志文件最大32M
MON_LOG_SPACE_LIMIT = 0                     #不限定日志文件总占用空间

[GRP1]
MON_INST_OGUID = 111111                     #组GRP1的唯一OGUID值
                                            #以下配置为监视器到组GRP1的守护进程的连接信息,以“IP:PORT”的形式配置
                                            #IP对应dmmal.ini中的MAL_HOST,PORT对应dmmal.ini中的MAL_DW_PORT
MON_DW_IP = 11.11.11.209:5238
MON_DW_IP = 11.11.11.210:5238

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

[GRP1]
MON_INST_OGUID = 111111


MON_DW_IP = 11.11.11.209:5238
MON_DW_IP = 11.11.11.210:5238

启动监视器:

[dmdba@dm211 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-01-14 10:43:58: DMMONITOR[4.0] V8
[monitor]         2022-01-14 10:43:58: DMMONITOR[4.0] IS READY.

[monitor]         2022-01-14 10:43:58: Received message from(DM1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 10:43:57  OPEN           OK        DM1              OPEN        PRIMARY   VALID    3        28059           28059

[monitor]         2022-01-14 10:43:58: Received message from(DM2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 10:43:57  OPEN           OK        DM2              OPEN        STANDBY   VALID    3        28059           28059


show
2022-01-14 10:44:26
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             111111      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.209        5238         2022-01-14 10:44:24  GLOBAL    VALID     OPEN           DM1              OK        1     1     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.209      5236       OK        DM1              OPEN        PRIMARY   0          0            REALTIME  VALID    4264            28059           4264            28059           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.210        5238         2022-01-14 10:44:25  GLOBAL    VALID     OPEN           DM2              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.210      5236       OK        DM2              OPEN        STANDBY   0          0            REALTIME  VALID    4210            28059           4210            28059           NONE

DATABASE(DM2) APPLY INFO FROM (DM1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4264, 4264, 4264], (RLSN, SLSN, KLSN)[28059, 28059, 28059], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28059)


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

或者[root@ora19c root]# ./dm_service_installer.sh -i /dm8/data/dmmonitor.ini -p DM -t dmmonitor

ln -s '/usr/lib/systemd/system/DmMonitorServiceDM.service' '/etc/systemd/system/multi-user.target.wants/DmMonitorServiceDM.service'
Finished to create the service (DmMonitorServiceDM)

使用服务方式启动不能执行相关命令来显示监控信息所以一般不使用

主备同步测试
主库:

[dmdba@dm209 arch]$ disql SYSDBA/SYSDBA@localhost:5236

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

used time: 1.253(ms). Execute id is 801.
SQL> commit;
executed successfully
used time: 2.770(ms). Execute id is 802.
SQL> select * from t1;

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

used time: 1.224(ms). Execute id is 803.

备库:

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

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

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

used time: 7.131(ms). Execute id is 300.

主库:

SQL> update t1 set id=2;
affect rows 1

used time: 1.081(ms). Execute id is 804.
SQL> commit;
executed successfully
used time: 2.552(ms). Execute id is 805.
SQL> select * from t1;

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

used time: 0.435(ms). Execute id is 806.

备库:

SQL> select * from t1;

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

used time: 2.014(ms). Execute id is 301.

主备切换测试
操作直接在监控器里执行。
Switchover 切换



show
2022-01-14 11:15:30
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             111111      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.209        5238         2022-01-14 11:15:29  GLOBAL    VALID     OPEN           DM1              OK        1     1     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.209      5236       OK        DM1              OPEN        PRIMARY   0          0            REALTIME  VALID    4288            28136           4288            28136           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.210        5238         2022-01-14 11:15:29  GLOBAL    VALID     OPEN           DM2              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.210      5236       OK        DM2              OPEN        STANDBY   0          0            REALTIME  VALID    4210            28136           4210            28136           NONE

DATABASE(DM2) APPLY INFO FROM (DM1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4288, 4288, 4288], (RLSN, SLSN, KLSN)[28136, 28136, 28136], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28136)


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

choose switchover grp1
Can choose one of the following instances to do switchover:
1: DM2

switchover grp1.dm2
[monitor]         2022-01-14 11:16:27: Not login dmmonitor or server public key changed, please try to login again!

login
username:SYSDBA
password:
[monitor]         2022-01-14 11:17:03: Login dmmonitor success!

switchover grp1.dm2
[monitor]         2022-01-14 11:17:23: Start to switchover instance DM2
[monitor]         2022-01-14 11:17:23: Notify dmwatcher(DM1) switch to SWITCHOVER status
[monitor]         2022-01-14 11:17:23: Dmwatcher process DM1 status switching [OPEN-->SWITCHOVER]
[monitor]         2022-01-14 11:17:23: Switch dmwatcher DM1 to SWITCHOVER status success
[monitor]         2022-01-14 11:17:23: Notify dmwatcher(DM2) switch to SWITCHOVER status
[monitor]         2022-01-14 11:17:23: Dmwatcher process DM2 status switching [OPEN-->SWITCHOVER]
[monitor]         2022-01-14 11:17:25: Switch dmwatcher DM2 to SWITCHOVER status success
[monitor]         2022-01-14 11:17:25: Instance DM1 start to execute sql SP_SET_GLOBAL_DW_STATUS(0, 6)
[monitor]         2022-01-14 11:17:25: Instance DM1 execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) success
[monitor]         2022-01-14 11:17:25: Instance DM2 start to execute sql SP_SET_GLOBAL_DW_STATUS(0, 6)
[monitor]         2022-01-14 11:17:25: Instance DM2 execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) success
[monitor]         2022-01-14 11:17:25: Instance DM1 start to execute sql ALTER DATABASE MOUNT
[monitor]         2022-01-14 11:17:25: Instance DM1 execute sql ALTER DATABASE MOUNT success
[monitor]         2022-01-14 11:17:25: Instance DM2 start to execute sql SP_APPLY_KEEP_PKG()
[monitor]         2022-01-14 11:17:25: Instance DM2 execute sql SP_APPLY_KEEP_PKG() success
[monitor]         2022-01-14 11:17:25: Instance DM2 start to execute sql ALTER DATABASE MOUNT
[monitor]         2022-01-14 11:17:25: Instance DM2 execute sql ALTER DATABASE MOUNT success
[monitor]         2022-01-14 11:17:25: Instance DM1 start to execute sql ALTER DATABASE STANDBY
[monitor]         2022-01-14 11:17:25: Instance DM1 execute sql ALTER DATABASE STANDBY success
[monitor]         2022-01-14 11:17:25: Instance DM2 start to execute sql ALTER DATABASE PRIMARY
[monitor]         2022-01-14 11:17:26: Instance DM2 execute sql ALTER DATABASE PRIMARY success
[monitor]         2022-01-14 11:17:26: Notify instance DM2 to change all arch status to be invalid
[monitor]         2022-01-14 11:17:26: Succeed to change all instances arch status to be invalid
[monitor]         2022-01-14 11:17:26: Instance DM1 start to execute sql ALTER DATABASE OPEN FORCE
[monitor]         2022-01-14 11:17:26: Instance DM1 execute sql ALTER DATABASE OPEN FORCE success
[monitor]         2022-01-14 11:17:26: Instance DM2 start to execute sql ALTER DATABASE OPEN FORCE
[monitor]         2022-01-14 11:17:26: Instance DM2 execute sql ALTER DATABASE OPEN FORCE success
[monitor]         2022-01-14 11:17:26: Instance DM1 start to execute sql SP_SET_GLOBAL_DW_STATUS(6, 0)
[monitor]         2022-01-14 11:17:26: Instance DM1 execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) success
[monitor]         2022-01-14 11:17:26: Instance DM2 start to execute sql SP_SET_GLOBAL_DW_STATUS(6, 0)
[monitor]         2022-01-14 11:17:26: Instance DM2 execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) success
[monitor]         2022-01-14 11:17:26: Notify dmwatcher(DM1) switch to OPEN status
[monitor]         2022-01-14 11:17:26: Dmwatcher process DM1 status switching [SWITCHOVER-->OPEN]
[monitor]         2022-01-14 11:17:27: Switch dmwatcher DM1 to OPEN status success
[monitor]         2022-01-14 11:17:27: Notify dmwatcher(DM2) switch to OPEN status
[monitor]         2022-01-14 11:17:28: Dmwatcher process DM2 status switching [SWITCHOVER-->OPEN]
[monitor]         2022-01-14 11:17:28: Switch dmwatcher DM2 to OPEN status success
[monitor]         2022-01-14 11:17:28: Notify group(GRP1)'s dmwatcher to do clear
[monitor]         2022-01-14 11:17:29: Clean request of dmwatcher processer DM1 success
[monitor]         2022-01-14 11:17:29: Clean request of dmwatcher processer DM2 success
[monitor]         2022-01-14 11:17:29: Switchover instance DM2 success

2022-01-14 11:17:29
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             111111      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.210        5238         2022-01-14 11:17:28  GLOBAL    VALID     OPEN           DM2              OK        1     1     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.210      5236       OK        DM2              OPEN        PRIMARY   0          0            REALTIME  VALID    4289            29494           4289            29494           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.209        5238         2022-01-14 11:17:28  GLOBAL    VALID     OPEN           DM1              OK        1     1     OPEN        STANDBY   DSC_OPEN       REALTIME  INVALID

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.209      5236       OK        DM1              OPEN        STANDBY   0          0            REALTIME  INVALID  4288            28136           4288            28136           NONE

DATABASE(DM1) APPLY INFO FROM (DM2), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4288, 4288, 4288], (RLSN, SLSN, KLSN)[28136, 28136, 28136], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (28136)


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

[monitor]         2022-01-14 11:17:30: Dmwatcher process DM2 status switching [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 11:17:30  RECOVERY       OK        DM2              OPEN        PRIMARY   VALID    4        29494           29494

[monitor]         2022-01-14 11:17:33: Dmwatcher process DM2 status switching [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 11:17:32  OPEN           OK        DM2              OPEN        PRIMARY   VALID    4        29494           29494

Takeover 接管

choose takeover grp1
Group(grp1) has active primary instance, not get standby instance list any more!

将主库网络直接中断:

[root@dm210 data]# systemctl stop network

#此时可以接管了:
[monitor]         2022-01-14 14:36:50: Received message timeout from(DM2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:36:39  ERROR          OK        DM2              OPEN        PRIMARY   VALID    4        29501           29501

[monitor]         2022-01-14 14:36:51: Check primary instance error in group(GRP1), start to auto takeover

[monitor]         2022-01-14 14:36:51: Notify group(GRP1)'s active dmwatcher to set MID
[monitor]         2022-01-14 14:36:51: Notify group(GRP1)'s active dmwatcher to set MID success
[monitor]         2022-01-14 14:36:51: Start to takeover use instance DM1
[monitor]         2022-01-14 14:36:51: Notify dmwatcher(DM1) switch to TAKEOVER status
[monitor]         2022-01-14 14:36:51: Dmwatcher process DM1 status switching [OPEN-->TAKEOVER]
[monitor]         2022-01-14 14:36:52: Switch dmwatcher DM1 to TAKEOVER status success
[monitor]         2022-01-14 14:36:52: Instance DM1 start to execute sql SP_SET_GLOBAL_DW_STATUS(0, 7)
[monitor]         2022-01-14 14:36:52: Instance DM1 execute sql SP_SET_GLOBAL_DW_STATUS(0, 7) success
[monitor]         2022-01-14 14:36:52: Instance DM1 start to execute sql SP_APPLY_KEEP_PKG()
[monitor]         2022-01-14 14:36:52: Instance DM1 execute sql SP_APPLY_KEEP_PKG() success
[monitor]         2022-01-14 14:36:52: Instance DM1 start to execute sql ALTER DATABASE MOUNT
[monitor]         2022-01-14 14:36:52: Instance DM1 execute sql ALTER DATABASE MOUNT success
[monitor]         2022-01-14 14:36:52: Instance DM1 start to execute sql ALTER DATABASE PRIMARY
[monitor]         2022-01-14 14:36:53: Instance DM1 execute sql ALTER DATABASE PRIMARY success
[monitor]         2022-01-14 14:36:53: Notify instance DM1 to change all arch status to be invalid
[monitor]         2022-01-14 14:36:53: Succeed to change all instances arch status to be invalid
[monitor]         2022-01-14 14:36:53: Instance DM1 start to execute sql ALTER DATABASE OPEN FORCE
[monitor]         2022-01-14 14:36:53: Instance DM1 execute sql ALTER DATABASE OPEN FORCE success
[monitor]         2022-01-14 14:36:53: Instance DM1 start to execute sql SP_SET_GLOBAL_DW_STATUS(7, 0)
[monitor]         2022-01-14 14:36:53: Instance DM1 execute sql SP_SET_GLOBAL_DW_STATUS(7, 0) success
[monitor]         2022-01-14 14:36:53: Notify dmwatcher(DM1) switch to OPEN status
[monitor]         2022-01-14 14:36:54: Dmwatcher process DM1 status switching [TAKEOVER-->OPEN]
[monitor]         2022-01-14 14:36:54: Switch dmwatcher DM1 to OPEN status success
[monitor]         2022-01-14 14:36:54: Notify group(GRP1)'s dmwatcher to do clear
[monitor]         2022-01-14 14:36:54: Clean request of dmwatcher processer DM1 success
[monitor]         2022-01-14 14:36:54: Success to takeover use instance DM1

[monitor]         2022-01-14 14:36:54: Group(GRP1) use instance DM1 auto takeover success

恢复DW环境
恢复原主库的网络后,监视器自动将原主库切换成了备库:

[monitor]         2022-01-14 14:42:19: Dmwatcher process DM2 status switching [NONE-->MON CONFIRM]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:19  MON CONFIRM    OK        DM2              SUSPEND     PRIMARY   VALID    4        29501           29501

[monitor]         2022-01-14 14:42:21: Dmwatcher process DM2 status switching [MON CONFIRM-->STARTUP]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:20  STARTUP        OK        DM2              SUSPEND     PRIMARY   VALID    4        29501           29501

[monitor]         2022-01-14 14:42:23: Instance DM2[PRIMARY, SUSPEND, ISTAT_SAME:TRUE] error
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:22  STARTUP        ERROR     DM2              SUSPEND     PRIMARY   VALID    4        29501           29501

[monitor]         2022-01-14 14:42:35: Instance DM2[STANDBY, MOUNT, ISTAT_SAME:TRUE] recover to OK
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:35  STARTUP        OK        DM2              MOUNT       STANDBY   INVALID  4        29501           29501

[monitor]         2022-01-14 14:42:36: Dmwatcher process DM2 status switching [STARTUP-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:36  OPEN           OK        DM2              OPEN        STANDBY   INVALID  4        29501           29501

[monitor]         2022-01-14 14:42:40: Dmwatcher process DM1 status switching [OPEN-->RECOVERY]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:39  RECOVERY       OK        DM1              OPEN        PRIMARY   VALID    5        30859           30859

[monitor]         2022-01-14 14:42:43: Dmwatcher process DM1 status switching [RECOVERY-->OPEN]
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 14:42:42  OPEN           OK        DM1              OPEN        PRIMARY   VALID    5        30859           30859

show
2022-01-14 14:43:05
#================================================================================#
GROUP            OGUID       MON_CONFIRM     MODE            MPP_FLAG
GRP1             111111      TRUE            AUTO            FALSE


< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.209        5238         2022-01-14 14:43:03  GLOBAL    VALID     OPEN           DM1              OK        1     1     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.209      5236       OK        DM1              OPEN        PRIMARY   0          0            REALTIME  VALID    4359            30859           4359            30859           NONE

< >
DW_IP               MAL_DW_PORT  WTIME                WTYPE     WCTLSTAT  WSTATUS        INAME            INST_OK   N_EP  N_OK  ISTATUS     IMODE     DSC_STATUS     RTYPE     RSTAT
11.11.11.210        5238         2022-01-14 14:43:03  GLOBAL    VALID     OPEN           DM2              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.210      5236       OK        DM2              OPEN        STANDBY   0          0            REALTIME  VALID    4356            30859           4356            30859           NONE

DATABASE(DM2) APPLY INFO FROM (DM1), REDOS_PARALLEL_NUM (1):
DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[4359, 4359, 4359], (RLSN, SLSN, KLSN)[30859, 30859, 30859], N_TSK[0], TSK_MEM_USE[0]
REDO_LSN_ARR: (30859)


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

DW 环境启动与关闭测试
因为Global 守护类型的守护进程,会自动将数据库实例切换到 Open 状态,并将守护进程状态也切换为 Open。因此在关闭DW系统时,必须按照一定的顺序来关闭守护进程和实例。

可以在监视器中执行 Stop Instance 命令关闭数据守护系统,命令执行成功后,数据库实例正常关闭。但守护进程并没有真正退出,而是将状态切换为Shutdown 状态。

如果使用手动方式关闭数据守护系统,请严格按照以下顺序:

1) 如果启动了确认监视器,先关闭确认监视器(防止自动接管)
2) 关闭主库守护进程(防止重启实例)
3) 关闭备库守护进程(防止重启实例)

在关闭守护进程时会自动关闭对应的DM实例。 所以我们这里只需要关闭对应的守护进程即可。

关闭DW 环境
我们这里使用手工方式关闭DW.
1.关闭监视器进程
直接ctrl + c 结束命令即可。

2.关闭主库守护进程

[root@dm209 root]# systemctl stop DmWatcherServicedw1
[root@dm209 root]# ps -ef|grep dm.ini
root      4515 18565  0 15:16 pts/1    00:00:00 grep --color=auto dm.ini

3.关闭备库守护进程

[root@dm210 log]# service DmWatcherServicedw2 stop
Redirecting to /bin/systemctl stop DmWatcherServicedw2.service
[root@dm210 log]# ps -ef | grep dm.ini
root      3725 20825  0 15:16 pts/2    00:00:00 grep --color=auto dm.ini

启动DW环境
启动备库守护进程

[root@dm210 log]# service DmWatcherServicedw2 start
Redirecting to /bin/systemctl start DmWatcherServicedw2.service
[root@dm210 log]# ps -ef | grep dm.ini
dmdba     3795     1  1 15:18 ?        00:00:00 /dm8/bin/dmserver /dm8/data/dm/dm.ini mount
root      3887 20825  0 15:18 pts/2    00:00:00 grep --color=auto dm.ini

启动守护进程时会自动启动DM 实例。

启动主库守护进程

[root@dm209 root]# service DmWatcherServicedw1 start
Redirecting to /bin/systemctl start DmWatcherServicedw1.service
[root@dm209 root]# ps -ef|grep dm.ini
dmdba     4598     1  0 15:20 ?        00:00:00 /dm8/bin/dmserver /dm8/data/dm/dm.ini mount
root      4713 18565  0 15:21 pts/1    00:00:00 grep --color=auto dm.ini

启动监视器

[dmdba@dm211 data]$ dmmonitor /dm8/data/dmmonitor.ini
[monitor]         2022-01-14 15:43:58: DMMONITOR[4.0] V8
[monitor]         2022-01-14 15:43:58: DMMONITOR[4.0] IS READY.

[monitor]         2022-01-14 15:43:58: Received message from(DM1)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 15:43:57  OPEN           OK        DM1              OPEN        PRIMARY   VALID    3        30859           30859

[monitor]         2022-01-14 15:43:58: Received message from(DM2)
                  WTIME                WSTATUS        INST_OK   INAME            ISTATUS     IMODE     RSTAT    N_OPEN   FLSN            CLSN
                  2022-01-14 15:43:57  OPEN           OK        DM2              OPEN        STANDBY   VALID    3        30859           30859

DM8搭建MPP集群

DM MPP环境搭建
我们将以一个简单的两节点MPP为例,介绍手动配置与搭建DM MPP环境的步骤。
一. 系统规划
本例配置一个两节点MPP。两个节点都配置两块网卡,一块接入内部网络交换模块,一块接入到外部交换机。两节点实例名分别为EP01和EP02,相关的IP、端口等规划见下表。

实例名  MAL_INST_HOST      MAL_INST_PORT     MAL_HOST       MAL端口     MPP_SEQNO
ep01    10.10.13.207     5236              11.11.11.6     5237        0
ep02    10.10.13.208     5236              11.11.11.7     5237        1

DM MPP各EP使用的DM服务器版本应一致,同时还应注意各EP所在主机的操作系统位数、大小端模式、时区及时间设置都应一致,否则可能造成意想不到的错误。

先在两个节点上安装DM数据库
二、操作系统配置
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 16 16:06:07 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 16 16:06:12 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 16 16:47:52 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 16 16:47:53 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 16 16:06:18 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 16 16:06:20 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 16 16:47:55 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 16 16:47:56 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 ~]# hostnamectl set-hostname dm8mpp1
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8mpp1:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.207   dm8mpp1
> 10.10.13.208   dm8mpp2" >> /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.207   dm8mpp1
10.10.13.208   dm8mpp2

[root@gbase ~]# hostnamectl set-hostname dm8mpp2
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8mpp2:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.201   dm8mpp1
> 10.10.13.202   dm8mpp2" >> /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.207   dm8mpp1
10.10.13.208   dm8mpp2

[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.207   dm8mpp1
10.10.13.208   dm8mpp2

三、 安装达梦软件

3.1检查Linux(Unix)系统信息

[root@dm8mpp1 ~]# getconf LONG_BIT
64

[root@dm8mpp2 ~]# getconf LONG_BIT
64

查询操作系统release信息
[root@dm8mpp1 ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.8 Beta (Maipo)

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

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

[root@dm8mpp1 ~]# groupadd dinstall

[root@dm8mpp2 ~]# groupadd dinstall

2. 创建安装用户dmdba。

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

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

3. 初始化用户密码。

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


[root@dm8mpp2 ~]# 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@dm8mpp1 ~]#  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@dm8mpp2 ~]#  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@dm8mpp1 ~]# 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@dm8mpp2 ~]# 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@dm8mpp1 ~]# su - dmdba
[dmdba@dm8mpp1 ~]$ 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@dm8mpp2 ~]# su - dmdba
[dmdba@dm8mpp2 ~]$ 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@dm8mpp1 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009072 kB

[root@dm8mpp2 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009072 kB

#获取交换分区大小

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

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

#获取内存使用详情

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


[root@dm8mpp2 ~]# 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@dm8mpp1 ~]# mkdir /dm8
[root@dm8mpp1 ~]#  chown -R dmdba:dinstall /dm8
[root@dm8mpp1 ~]# chmod -R 775 /dm8

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

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

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

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

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

[root@dm8mpp2 ~]# 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@dm8mpp1 ~]# cd /soft

[root@dm8mpp1 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@dm8mpp1 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@dm8mpp1 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8mpp1 soft]# mkdir dmsoft
[root@dm8mpp1 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@dm8mpp1 soft]# cd dmsoft
[root@dm8mpp1 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@dm8mpp2 ~]# cd /soft
[root@dm8mpp2 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@dm8mpp2 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@dm8mpp2 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8mpp2 soft]# mkdir dmsoft
[root@dm8mpp2 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@dm8mpp2 soft]# cd dmsoft
[root@dm8mpp2 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@dm8mpp1 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

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

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

[root@dm8mpp1 dmsoft]# su - dmdba
Last login: Fri Dec 17 15:57:31 CST 2021 on pts/0
[dmdba@dm8mpp1 ~]$ cd /soft/dmsoft
[dmdba@dm8mpp1 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-17 16:16:08
[INFO] Installing DM DBMS...
2021-12-17 16:16:08
[INFO] Installing BASE Module...
2021-12-17 16:16:10
[INFO] Installing SERVER Module...
2021-12-17 16:16:15
[INFO] Installing CLIENT Module...
2021-12-17 16:16:25
[INFO] Installing DRIVERS Module...
2021-12-17 16:16:26
[INFO] Installing MANUAL Module...
2021-12-17 16:16:26
[INFO] Installing SERVICE Module...
2021-12-17 16:16:31
[INFO] Move log file to log directory.
2021-12-17 16:16:32
[INFO] Installed DM DBMS completely.

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

End

[root@dm8mpp2 dmsoft]# su - dmdba
Last login: Fri Dec 17 15:57:45 CST 2021 on pts/0
[dmdba@dm8mpp2 ~]$ cd /soft/dmsoft
[dmdba@dm8mpp2 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-17 16:18:44
[INFO] Installing DM DBMS...
2021-12-17 16:18:44
[INFO] Installing BASE Module...
2021-12-17 16:18:46
[INFO] Installing SERVER Module...
2021-12-17 16:18:49
[INFO] Installing CLIENT Module...
2021-12-17 16:19:04
[INFO] Installing DRIVERS Module...
2021-12-17 16:19:04
[INFO] Installing MANUAL Module...
2021-12-17 16:19:05
[INFO] Installing SERVICE Module...
2021-12-17 16:19:11
[INFO] Move log file to log directory.
2021-12-17 16:19:12
[INFO] Installed DM DBMS completely.

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

End

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

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

[root@dm8mpp1 ~]# su - dmdba
Last login: Fri Dec 17 16:14:18 CST 2021 on pts/1
[dmdba@dm8mpp1 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH



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

[root@dm8mpp2 ~]# su - dmdba
Last login: Fri Dec 17 16:17:23 CST 2021 on pts/1
[dmdba@dm8mpp2 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH

4.2.2 配置dm.ini
首先,在dmmpp1和dmmpp2上分别创建数据库,用户可以使用DM的图形化客户端工具“数据库配置助手”或命令行工具dminit 创建数据库。

[dmdba@dm8mpp1 ~]$ dminit path=/dm8/data page_size=16 case_sensitive=1 charset=0 db_name=ep01 instance_name=ep01 port_num=5236
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/ep01/ep0101.log


 log file path: /dm8/data/ep01/ep0102.log

write to dir [/dm8/data/ep01].
create dm database success. 2021-12-17 16:29:12

[dmdba@dm8mpp2 ~]$ dminit path=/dm8/data page_size=16 case_sensitive=1 charset=0 db_name=ep02 instance_name=ep02 port_num=5236
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/ep02/ep0201.log


 log file path: /dm8/data/ep02/ep0202.log

write to dir [/dm8/data/ep02].
create dm database success. 2021-12-17 16:29:35

分别对两个实例的dm.ini进行配置。
修改ep01的dm.ini的以下几个参数如下:

MAL_INI = 1
MPP_INI = 1

修改ep02的dm.ini的以下几个参数如下:

MAL_INI = 1
MPP_INI = 1

4.2.3 配置dmmal.ini
为两个EP配置dmmal.ini如下,配置完全一样,EP间可互相拷贝。dmmal.ini与dm.ini放在相同的目录下。

[dmdba@dm8mpp1 ep01]$ vi dmmal.ini
[MAL_INST1]
MAL_INST_NAME = ep01
MAL_HOST = 11.11.11.6
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.207
MAL_INST_PORT = 5236
[MAL_INST2]
MAL_INST_NAME = ep02
MAL_HOST = 11.11.11.7
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.208
MAL_INST_PORT = 5236


[dmdba@dm8mpp2 ep02]$ vi dmmal.ini
[MAL_INST1]
MAL_INST_NAME = ep01
MAL_HOST = 11.11.11.6
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.207
MAL_INST_PORT = 5236
[MAL_INST2]
MAL_INST_NAME = ep02
MAL_HOST = 11.11.11.7
MAL_PORT = 5237
MAL_INST_HOST = 10.10.13.208
MAL_INST_PORT = 5236

4.2.4 配置dmmpp.ctl
dmmpp.ctl是一个二进制文件,用户不能直接配置,需要先配置dmmpp.ini。
配置dmmpp.ini如下:

[dmdba@dm8mpp1 ep01]$ vi dmmpp.ini
[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = ep01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = ep02


[dmdba@dm8mpp1 ep02]$ vi dmmpp.ini
[SERVICE_NAME1]
MPP_SEQ_NO = 0
MPP_INST_NAME = ep01
[SERVICE_NAME2]
MPP_SEQ_NO = 1
MPP_INST_NAME = ep02

使用DM提供的工具dmctlcvt将dmmpp.ini转换成dmmpp.ctl,dmctlcvt工具在DM安装目录的“bin”子目录中。转换生成的dmmpp.ctl需要放在与dm.ini同一个目录。假设DM的安装路径为c盘根目录,下面的命令将dmmpp.ini转换为dmmpp.ctl,命令中的
“TYPE=2”参数表示将文本文件转换成控制文件,也可以使用“TYPE=1”参数进行逆向转换。

[dmdba@dm8mpp1 ~]$ dmctlcvt type=2 src=/dm8/data/ep01/dmmpp.ini dest=/dm8/data/ep01/dmmpp.ctl
DMCTLCVT V8
convert txt to ctl success!

[dmdba@dm8mpp1 ep01]$ ls -lrt dmmpp.ctl
-rw-r--r-- 1 dmdba dinstall 41540 Dec 17 16:40 dmmpp.ctl

将生成的dmmpp.ctl拷贝至另一EP,保证MPP系统中所有EP的dmmpp.ctl完全相同。

[dmdba@dm8mpp1 ep01]$ scp  dmmpp.ctl dmdba@10.10.13.208:/dm8/data/ep02/
The authenticity of host '10.10.13.208 (10.10.13.208)' 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.208' (ECDSA) to the list of known hosts.
dmdba@10.10.13.208's password:
dmmpp.ctl                                                                                                                                                                                                100%   41KB   1.2MB/s   00:00
[dmdba@dm8mpp2 ep02]$ ls -lrt dmmpp.ctl
-rw-r--r-- 1 dmdba dinstall 41540 Dec 17 16:41 dmmpp.ctl

4.2.5 运行MPP
经过前面四个步骤,DM MPP环境已经配置完成了。分别启动EP01和EP02的DM数据库实例(顺序不分先后),DM MPP系统即能正常运行,用户就可以登录任一EP进行数据库操作了。

[root@dm8mpp1 /]# ./dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/ep01/dm.ini -p ep01 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceep01.service to /usr/lib/systemd/system/DmServiceep01.service.
Finished to create the service (DmServiceep01)


[root@dm8mpp2 /]# ./dm8/script/root/dm_service_installer.sh -dm_ini /dm8/data/ep02/dm.ini -p ep02 -t dmserver
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServiceep02.service to /usr/lib/systemd/system/DmServiceep02.service.
Finished to create the service (DmServiceep02)

[root@dm8mpp1 /]# service DmServiceep01 start
Redirecting to /bin/systemctl start DmServiceep01.service
[root@dm8mpp1 /]# ps -ef | grep dmserver
dmdba    19859     1 13 16:47 ?        00:00:04 /dm8/bin/dmserver path=/dm8/data/ep01/dm.ini -noconsole
root     19947 16769  0 16:48 pts/1    00:00:00 grep --color=auto dmserver

[root@dm8mpp2 /]# service DmServiceep02 start
Redirecting to /bin/systemctl start DmServiceep02.service
[root@dm8mpp2 /]# ps -ef | grep dmserver
dmdba    19722     1 12 16:47 ?        00:00:03 /dm8/bin/dmserver path=/dm8/data/ep02/dm.ini -noconsole
root     19816 16615  0 16:48 pts/1    00:00:00 grep --color=auto dmserver

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

Server[localhost:5236]:mode is normal, state is open
login used time : 3.987(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- --------
1          EP01 EP01          1               dm8mpp1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:27 OPEN    NORMAL 0           0           NULL
2          EP02 EP02          2               dm8mpp2   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:46 OPEN    NORMAL 0           0           NULL

used time: 10.969(ms). Execute id is 312185.

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

Server[localhost:5236]:mode is normal, state is open
login used time : 4.392(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- --------
1          EP02 EP02          2               dm8mpp2   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:46 OPEN    NORMAL 0           0           NULL
2          EP01 EP01          1               dm8mpp1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-17 16:47:27 OPEN    NORMAL 0           0           NULL

used time: 11.362(ms). Execute id is 747780.

4.3 建立分布表
DM MPP支持表数据的哈希分布、随机分布、复制分布、范围分布、LIST分布类型,用户可根据实际情况选择合适的分布类型。MPP的数据分布类型和具体设置在建表时指定,语法如下,建表的其他语法分支可参见《DM8_SQL语言使用手册》。

CREATE [[GLOBAL] TEMPORARY] TABLE < 表名定义> < 表结构定义>;
< 表结构定义>::=< 表结构定义1> | < 表结构定义2>
< 表结构定义1>::= (< 列定义> {,< 列定义>} [,< 表级约束定义>{,< 表级约束定义>}]) [ON COMMIT  ROWS] [][< 空间限制子句>] [][< 压缩子句>] [][]
< 表结构定义2>::= [ON COMMIT  ROWS] [< 空间限制子句>] [] [< 压缩子句>]AS < 不带INTO的SELECT语句>[];
::=DISTRIBUTED[|]
|DISTRIBUTED BY [](< 列名> {,< 列名>})
|DISTRIBUTED BY RANGE (< 列名> {,< 列名>})(< 范围分布项> {,< 范围分布项>})
|DISTRIBUTED BY LIST (< <列名> {,< 列名>}>)( {,})
< 范围分布项>::= VALUES LESS THAN (< 表达式>{,< 表达式>}) ON < 实例名>
|VALUES EQU OR LESS THAN (< 表达式>{,< 表达式>}) ON < 实例名>
::= VALUES (< 表达式>{,< 表达式>}) ON < 实例名>

下面给出几个简单的创建不同类型分布表的例子。
例1:创建哈希分布表T_HASH,分布列为C1。

SQL> create table t_hash(c1 int,c2 varchar(50)) distributed by hash(c1);
executed successfully
used time: 92.798(ms). Execute id is 53801.

SQL> begin
2   for i in 1 .. 100000 loop
3    insert into t_hash values(i,'a'||i);
4   end loop;
5   commit;
6   end;
7   /
DMSQL executed successfully
used time: 00:00:32.408. Execute id is 412195.

SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 0          0         2         0             Y       0          0          Parallel policy IN FILE
2          PARALLEL_POLICY 0          0         2         0             Y       0          0          Parallel policy IN FILE

used time: 14.487(ms). Execute id is 747782.
SQL> sp_set_para_value(2,'PARALLEL_POLICY',2);
DMSQL executed successfully
used time: 18.129(ms). Execute id is 747783.
SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 0          0         2         0             Y       0          2          Parallel policy IN FILE
2          PARALLEL_POLICY 0          0         2         0             Y       0          2          Parallel policy IN FILE

used time: 11.234(ms). Execute id is 747785.

重启数据库

[root@dm8mpp1 /]# service DmServiceep01 restart
Redirecting to /bin/systemctl restart DmServiceep01.service

[root@dm8mpp2 /]# service DmServiceep02 restart
Redirecting to /bin/systemctl restart DmServiceep02.service

SQL> select * from v$dm_ini where para_name='PARALLEL_POLICY';

LINEID     PARA_NAME       PARA_VALUE MIN_VALUE MAX_VALUE DEFAULT_VALUE MPP_CHK SESS_VALUE FILE_VALUE DESCRIPTION     PARA_TYPE
---------- --------------- ---------- --------- --------- ------------- ------- ---------- ---------- --------------- ---------
1          PARALLEL_POLICY 2          0         2         0             Y       2          2          Parallel policy IN FILE
2          PARALLEL_POLICY 2          0         2         0             Y       2          2          Parallel policy IN FILE

used time: 11.378(ms). Execute id is 119090.

SQL> explain select * from t_hash;

1   #NSET2: [5, 50000, 60]
2     #MPP COLLECT: [5, 50000, 60]; op_id(1) n_grp_by (0) n_cols(0) n_keys(0) for_sync(FALSE)
3       #PRJT2: [5, 50000, 60]; exp_num(3), is_atom(FALSE)
4         #CSCN2: [5, 50000, 60]; INDEX33555458(T_HASH)

used time: 1.401(ms). Execute id is 0.

使用python解密工具来解密SecureCRT会话中保存的登录密码

使用python解密工具来解密SecureCRT会话中保存的登录密码
环境为windows7,SecureCRT7,Python 3.8.8

操作步骤如下:
1.安装python
从下载python3.8.8,下载时查看该版本是否支持你的操作系统下载软件包后直接双击安装包进行安装,安装时可以选择自动配置环境变量。安装完成后查看python版本。

C:\Users\Administrator>python –version
Python 3.8.8
2.从github下下载how-does-SecureCRT-encrypt-password工具(https://github.com/HyperSine/how-does-SecureCRT-encrypt-password)一个名为SecureCRTCipher.py的python文件,使用方法如下:

F:\how-does-SecureCRT-encrypt-password-master\python3>python SecureCRTCipher.py
Usage:
SecureCRTCipher.py [-v2] [-p ConfigPassphrase]
“enc” for encryption, “dec” for decryption.
This parameter must be specified. –(加密|解密)必选项
[-v2] Encrypt/Decrypt with “Password V2″ algorithm.
This parameter is optional.–(如果加密使用的是Password V2算法则加上这个参数)可选项
[-p ConfigPassphrase] The config passphrase that SecureCRT uses.
This parameter is optional.–(如果你的SecureCRT打开时要密码,则要加上这个参数,并在后面加上你使用的密码)可选项
Plaintext string or ciphertext string.
NOTICE: Ciphertext string must be a hex string.
This parameter must be specified.–(明文或密文,密文必须是16进制的字符串)必选项
3.安装pycryptodome模块

C:\Users\Administrator>pip3 install pycryptodome
Collecting pycryptodome
Downloading pycryptodome-3.14.1-cp35-abi3-win_amd64.whl (1.8 MB)
|████████████████████████████████| 1.8 MB 30 kB/s
Installing collected packages: pycryptodome
Successfully installed pycryptodome-3.14.1
WARNING: You are using pip version 20.2.3; however, version 22.0.4 is available.
You should consider upgrading via the ‘c:\program files\python38\python.exe -m pip install –upgrade pip’ command.
上面提示我升级一下pip3的版本

C:\Users\Administrator>python -m pip install –upgrade pip
Collecting pip
Downloading pip-22.0.4-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 142 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Successfully installed pip-22.0.4
4.找到SecureCRT会话配置文件
Options->Global Options->Category->Configuration Paths->Configuration folder文件夹下的对应的会话配置文件xxx.ini,并将其打开例如:

D:”Is Session”=00000001
S:”Protocol Name”=SSH2
D:”Request pty”=00000001
S:”Shell Command”=
D:”Use Shell Command”=00000000
D:”Force Close On Exit”=00000000
D:”Forward X11″=00000000
S:”XAuthority File”=
S:”XServer Host”=127.0.0.1
D:”XServer Port”=00001770
D:”XServer Screen Number”=00000000
D:”Enforce X11 Authentication”=00000001
D:”Request Shell”=00000001
S:”Port Forward Filter”=allow,127.0.0.0/255.0.0.0,0 deny,0.0.0.0/0.0.0.0,0
S:”Reverse Forward Filter”=allow,127.0.0.1,0 deny,0.0.0.0/0.0.0.0,0
D:”Max Packet Size”=00001000
D:”Pad Password Packets”=00000001
S:”Sftp Tab Local Directory”=C:\Users\Administrator\Documents
S:”Sftp Tab Remote Directory”=
S:”Hostname”=12.18.1.23
S:”Firewall Name”=None
S:”Username”=root
D:”[SSH2] Port”=00000016
S:”Password”=uc71bd1c86f3b804e42432f53247c50d9287f410c7e59166969acab69daa6eaadbe15c0c54c0e076e945a6d82f9e13df2
5.在SecureCRTCipher.py文件目录下cmd命令行窗口中执行命令即可查看明文(命令行中字符串比Password中的字符串少个u):

F:\how-does-SecureCRT-encrypt-password-master\python3>python SecureCRTCipher.py dec c71bd1c86f3b804e42432f53247c50d9287f410c7e59166969acab69daa6eaadbe15c0c54c0e076e945a6d82f9e13df2
DoubleLabyrinth
6.解密脚本文件SecureCRTCipher.py的内容如下:

#!/usr/bin/env python3
import os
from Crypto.Hash import SHA256
from Crypto.Cipher import AES, Blowfish
class SecureCRTCrypto:
def __init__(self):
”’
Initialize SecureCRTCrypto object.
”’
self.IV = b’\x00′ * Blowfish.block_size
self.Key1 = b’\x24\xA6\x3D\xDE\x5B\xD3\xB3\x82\x9C\x7E\x06\xF4\x08\x16\xAA\x07′
self.Key2 = b’\x5F\xB0\x45\xA2\x94\x17\xD9\x16\xC6\xC6\xA2\xFF\x06\x41\x82\xB7′
def Encrypt(self, Plaintext : str):
”’
Encrypt plaintext and return corresponding ciphertext.
Args:
Plaintext: A string that will be encrypted.
Returns:
Hexlified ciphertext string.
”’
plain_bytes = Plaintext.encode(‘utf-16-le’)
plain_bytes += b’\x00\x00′
padded_plain_bytes = plain_bytes + os.urandom(Blowfish.block_size – len(plain_bytes) % Blowfish.block_size)
cipher1 = Blowfish.new(self.Key1, Blowfish.MODE_CBC, iv = self.IV)
cipher2 = Blowfish.new(self.Key2, Blowfish.MODE_CBC, iv = self.IV)
return cipher1.encrypt(os.urandom(4) + cipher2.encrypt(padded_plain_bytes) + os.urandom(4)).hex()
def Decrypt(self, Ciphertext : str):
”’
Decrypt ciphertext and return corresponding plaintext.
Args:
Ciphertext: A hex string that will be decrypted.
Returns:
Plaintext string.
”’
cipher1 = Blowfish.new(self.Key1, Blowfish.MODE_CBC, iv = self.IV)
cipher2 = Blowfish.new(self.Key2, Blowfish.MODE_CBC, iv = self.IV)
ciphered_bytes = bytes.fromhex(Ciphertext)
if len(ciphered_bytes) < = 8: raise ValueError('Invalid Ciphertext.') padded_plain_bytes = cipher2.decrypt(cipher1.decrypt(ciphered_bytes)[4:-4]) i = 0 for i in range(0, len(padded_plain_bytes), 2): if padded_plain_bytes[i] == 0 and padded_plain_bytes[i + 1] == 0: break plain_bytes = padded_plain_bytes[0:i] try: return plain_bytes.decode('utf-16-le') except UnicodeDecodeError: raise(ValueError('Invalid Ciphertext.')) class SecureCRTCryptoV2: def __init__(self, ConfigPassphrase : str = ''): ''' Initialize SecureCRTCryptoV2 object. Args: ConfigPassphrase: The config passphrase that SecureCRT uses. Leave it empty if config passphrase is not set. ''' self.IV = b'\x00' * AES.block_size self.Key = SHA256.new(ConfigPassphrase.encode('utf-8')).digest() def Encrypt(self, Plaintext : str): ''' Encrypt plaintext and return corresponding ciphertext. Args: Plaintext: A string that will be encrypted. Returns: Hexlified ciphertext string. ''' plain_bytes = Plaintext.encode('utf-8') if len(plain_bytes) > 0xffffffff:
raise OverflowError(‘Plaintext is too long.’)
plain_bytes = \
len(plain_bytes).to_bytes(4, ‘little’) + \
plain_bytes + \
SHA256.new(plain_bytes).digest()
padded_plain_bytes = \
plain_bytes + \
os.urandom(AES.block_size – len(plain_bytes) % AES.block_size)
cipher = AES.new(self.Key, AES.MODE_CBC, iv = self.IV)
return cipher.encrypt(padded_plain_bytes).hex()
def Decrypt(self, Ciphertext : str):
”’
Decrypt ciphertext and return corresponding plaintext.
Args:
Ciphertext: A hex string that will be decrypted.
Returns:
Plaintext string.
”’
cipher = AES.new(self.Key, AES.MODE_CBC, iv = self.IV)
padded_plain_bytes = cipher.decrypt(bytes.fromhex(Ciphertext))
plain_bytes_length = int.from_bytes(padded_plain_bytes[0:4], ‘little’)
plain_bytes = padded_plain_bytes[4:4 + plain_bytes_length]
if len(plain_bytes) != plain_bytes_length:
raise ValueError(‘Invalid Ciphertext.’)
plain_bytes_digest = padded_plain_bytes[4 + plain_bytes_length:4 + plain_bytes_length + SHA256.digest_size]
if len(plain_bytes_digest) != SHA256.digest_size:
raise ValueError(‘Invalid Ciphertext.’)
if SHA256.new(plain_bytes).digest() != plain_bytes_digest:
raise ValueError(‘Invalid Ciphertext.’)
return plain_bytes.decode(‘utf-8’)
if __name__ == ‘__main__’:
import sys
def Help():
print(‘Usage:’)
print(‘ SecureCRTCipher.py [-v2] [-p ConfigPassphrase] ‘)
print(”)
print(‘ “enc” for encryption, “dec” for decryption.’)
print(‘ This parameter must be specified.’)
print(”)
print(‘ [-v2] Encrypt/Decrypt with “Password V2″ algorithm.’)
print(‘ This parameter is optional.’)
print(”)
print(‘ [-p ConfigPassphrase] The config passphrase that SecureCRT uses.’)
print(‘ This parameter is optional.’)
print(”)
print(‘ Plaintext string or ciphertext string.’)
print(‘ NOTICE: Ciphertext string must be a hex string.’)
print(‘ This parameter must be specified.’)
print(”)
def EncryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Plaintext : str):
try:
if UseV2:
print(SecureCRTCryptoV2(ConfigPassphrase).Encrypt(Plaintext))
else:
print(SecureCRTCrypto().Encrypt(Plaintext))
return True
except:
print(‘Error: Failed to encrypt.’)
return False
def DecryptionRoutine(UseV2 : bool, ConfigPassphrase : str, Ciphertext : str):
try:
if UseV2:
print(SecureCRTCryptoV2(ConfigPassphrase).Decrypt(Ciphertext))
else:
print(SecureCRTCrypto().Decrypt(Ciphertext))
return True
except:
print(‘Error: Failed to decrypt.’)
return False
def Main(argc : int, argv : list):
if 3 < = argc and argc <= 6: bUseV2 = False ConfigPassphrase = '' if argv[1].lower() == 'enc': bEncrypt = True elif argv[1].lower() == 'dec': bEncrypt = False else: Help() return -1 i = 2 while i < argc - 1: if argv[i].lower() == '-v2': bUseV2 = True i += 1 elif argv[i].lower() == '-p' and i + 1 < argc - 1: ConfigPassphrase = argv[i + 1] i += 2 else: Help() return -1 if bUseV2 == False and len(ConfigPassphrase) != 0: print('Error: ConfigPassphrase is not supported if "-v2" is not specified') return -1 if bEncrypt: return 0 if EncryptionRoutine(bUseV2, ConfigPassphrase, argv[-1]) else -1 else: return 0 if DecryptionRoutine(bUseV2, ConfigPassphrase, argv[-1]) else -1 else: Help() exit(Main(len(sys.argv), sys.argv))

DM8 DMDSC动态扩展节点

DMDSC动态扩展节点
DMDSC集群支持动态扩展节点,每次扩展可以在原有基础上增加一个节点。动态扩展节点要求当前DMDSC集群的所有节点都为OK状态,所有dmserver实例都处于OPEN状态,且可以正常访问。

注意:扩展节点过程中,不应该有修改数据库状态或模式的操作

一. 环境说明
新增节点环境为: 操作系统:RedHat Linux 64位。
网络配置:eth0网卡为10.10.13.0外网网段,该机器为10.10.13.203;eth1为11.11.11.0内网网段,该机器为11.11.11.5内网网段用于MAL通讯。
DM各种工具位于目录:/dm8/bin。
配置文件位于目录:/dm8/data。

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

[root@dm8rac3 ~]# systemctl stop firewalld
[root@dm8rac3 ~]# 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@dm8rac3 ~]# 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 09 17:28:02 dm8rac3 systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 09 17:28:04 dm8rac3 systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 10 08:29:20 dm8rac3 systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 10 08:29:21 dm8rac3 systemd[1]: Stopped firewalld - dynamic firewall daemon.

[root@dm8rac3 ~]# setenforce 0
[root@dm8rac3 ~]# sed -i s:^SELINUX=.*$:SELINUX=disabled:g /etc/selinux/config
[root@dm8rac3 ~]# 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@dm8rac3 ~]# hostnamectl set-hostname dm8rac3
[root@dm8rac3 ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8rac3:g /etc/sysconfig/network
[root@dm8rac3 ~]# echo "
>  10.10.13.201   dm8rac1
>  10.10.13.202   dm8rac2
>  10.10.13.203   dm8rac3" >> /etc/hosts
[root@dm8rac3 ~]# 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
 10.10.13.203   dm8rac3

[root@dm8rac1 ~]# vi /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
 10.10.13.203   dm8rac3

[root@dm8rac2 ~]# vi /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
 10.10.13.203   dm8rac3

三、 安装达梦软件

3.1检查Linux(Unix)系统信息

[root@dm8rac3 ~]# getconf LONG_BIT
64

查询操作系统release信息

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

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

[root@dm8rac3 ~]# groupadd dinstall

2. 创建安装用户dmdba。

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

3. 初始化用户密码。

[root@dm8rac3 ~]# 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@dm8rac3 ~]# 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@dm8rac3 ~]# 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@dm8rac3 ~]# su - dmdba
[dmdba@dm8rac3 ~]$ 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@dm8rac3 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009068 kB

#获取交换分区大小
[root@dm8rac3 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

#获取内存使用详情
[root@dm8rac3 ~]# 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@dm8rac3 ~]# mkdir /dm8
[root@dm8rac3 ~]# chown -R dmdba:dinstall /dm8
[root@dm8rac3 ~]# chmod -R 775 /dm8

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

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

[root@dm8rac3 ~]# 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@dm8rac3 ~]# cd /soft
[root@dm8rac3 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@dm8rac3 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@dm8rac3 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8rac3 soft]# mkdir dmsoft
[root@dm8rac3 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@dm8rac3 soft]# cd dmsoft
[root@dm8rac3 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@dm8rac3 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

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

[dmdba@dm8rac3 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-10 08:52:34
[INFO] Installing DM DBMS...
2021-12-10 08:52:34
[INFO] Installing BASE Module...
2021-12-10 08:52:36
[INFO] Installing SERVER Module...
2021-12-10 08:52:39
[INFO] Installing CLIENT Module...
2021-12-10 08:52:54
[INFO] Installing DRIVERS Module...
2021-12-10 08:52:55
[INFO] Installing MANUAL Module...
2021-12-10 08:52:55
[INFO] Installing SERVICE Module...
2021-12-10 08:53:03
[INFO] Move log file to log directory.
2021-12-10 08:53:04
[INFO] Installed DM DBMS completely.

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

End

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

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

[dmdba@dm8rac3 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH

四、绑定UDEV
编辑/etc/udev/rules.d/99-dm-devices.rules文件

[root@dm8rac3 ~]# vi /etc/udev/rules.d/99-dm-devices.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@dm8rac3 ~]# ls -lrt /dev/raw/
total 0
crw-rw---- 1 root  disk     162, 0 Dec 10 09:01 rawctl
crw-rw---- 1 dmdba dinstall 162, 6 Dec 10 09:01 raw6
crw-rw---- 1 dmdba dinstall 162, 5 Dec 10 09:01 raw5
crw-rw---- 1 dmdba dinstall 162, 4 Dec 10 09:01 raw4
crw-rw---- 1 dmdba dinstall 162, 3 Dec 10 09:01 raw3
crw-rw---- 1 dmdba dinstall 162, 1 Dec 10 09:01 raw1
crw-rw---- 1 dmdba dinstall 162, 2 Dec 10 09:01 raw2

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

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

四. 操作流程
1. 在10.10.13.201机器上使用DMASMCMD工具export出备份dmdcr_cfg_bak.ini

[dmdba@dm8rac1 ~]$ dmasmcmd
DMASMCMD V8
ASM>export dcrdisk '/dev/raw/raw1' to '/dm8/data/dmdcr_cfg_bak.ini'
ASMCMD export DCRDISK success.
Used time: 59.153(ms).

2. 为新增节点准备日志文件
1) 使用DIsql登录任意一个节点执行添加日志文件操作:
至少两个日志文件,路径必须是ASM文件格式,大小可以参考其他两个活动节点。

SQL> alter database add node logfile '+DMLOG/log/rac2_log01.log' size 256,'+DMLOG/log/rac2_log02.log' size 256;
executed successfully
used time: 00:00:01.419. Execute id is 208.

2)使用dmctlcvt工具将dm.ctl转换为文本文件dmctl.txt,查看dmctl.txt,新增节点的日志文件信息已经添加进dm.ctl。

[dmdba@dm8rac1 data]$ dmctlcvt TYPE=1 SRC=+DMDATA/data/rac/dm.ctl DEST=/dm8/data/dmctl.txt DCR_INI=/dm8/data/dmdcr.ini
DMCTLCVT V8
convert ctl to txt success!
[dmdba@dm8rac1 data]$ ls -lrt
total 28
-rw-r--r-- 1 dmdba dinstall  956 Dec  8 09:24 dmdcr_cfg.ini
-rw-r--r-- 1 dmdba dinstall  143 Dec  8 09:29 dmasvrmal.ini
-rw-r--r-- 1 dmdba dinstall  328 Dec  8 09:37 dmdcr.ini
-rw-r--r-- 1 dmdba dinstall  864 Dec  8 10:13 dminit.ini
drwxr-xr-x 2 dmdba dinstall   55 Dec  8 10:17 rac1_config
drwxr-xr-x 3 dmdba dinstall  100 Dec  8 10:36 rac0_config
-rw-r--r-- 1 dmdba dinstall 1647 Dec 10 09:06 dmdcr_cfg_bak.ini
-rw-r--r-- 1 dmdba dinstall 8158 Dec 10 09:23 dmctl.txt

[dmdba@dm8rac1 data]$ more dmctl.txt
# file path
fil_path=+DMLOG/log/rac2_log01.log
# mirror path
mirror_path=
# file id
fil_id=0
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2021-12-10 9:20:50'
# file modify time
fil_modify_time=DATETIME '2021-12-10 9:20:50'
# the max size of file
fil_max_size=0
# next size of file
fil_next_size=0

# file path
fil_path=+DMLOG/log/rac2_log02.log
# mirror path
mirror_path=
# file id
fil_id=1
# whether the file is auto extend
autoextend=1
# file create time
fil_create_time=DATETIME '2021-12-10 9:20:50'
# file modify time
fil_modify_time=DATETIME '2021-12-10 9:20:50'
# the max size of file

3)使用dmasmtool工具登录ASM文件系统,也可以看到新增的节点日志文件

[dmdba@dm8rac1 ~]$ dmasmtool DCR_INI=/dm8/data/dmdcr.ini
DMASMTOOL V8
ASM>ls  +DMLOG/log
        file : rac0_log01.log
        file : rac0_log02.log
        file : rac1_log01.log
        file : rac1_log02.log
        file : rac2_log01.log
        file : rac2_log02.log
total count 6.
Used time: 6.598(ms).

3. 为新增节点准备config_path
将10.10.13.201机器/dm8/data/rac0_config目录拷贝到10.10.13.203机器相同目录下,修改名字为/dm8/data/rac2_config。

[dmdba@dm8rac1 data]$ scp -r rac0_config 10.10.13.203:`pwd`
The authenticity of host '10.10.13.203 (10.10.13.203)' 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.203' (ECDSA) to the list of known hosts.
dmdba@10.10.13.203's password:
dmmal.ini                                                                                                                                                                                                100%  200     8.5KB/s   00:00
dminit20211208101727.log                                                                                                                                                                                 100% 1144    70.0KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   53KB   3.2MB/s   00:00
sqllog.ini                                                                                                                                                                                               100%  481    19.3KB/s   00:00
[dmdba@dm8rac1 data]$

[dmdba@dm8rac3 data]$ mv rac0_config rac2_config
[dmdba@dm8rac3 data]$ ls -lrt
total 0
drwxr-xr-x 2 dmdba dinstall   6 Dec 10 09:54 trace
drwxr-xr-x 3 dmdba dinstall 100 Dec 10 09:56 rac2_config

修改dsc2_config文件夹下的配置文件:
1) 修改dm.ini

[dmdba@dm8rac3 rac2_config]$ vi dm.ini
CONFIG_PATH                     = /dm8/data/rac2_config            #config path

INSTANCE_NAME                   = RAC2              #Instance name

2) 如果打开了归档参数,修改dmarch.ini

4. 新建dmdcr.ini配置文件,保存到节点10.0.2.103的/dm8/data/目录下面注意设置dmdcr_seqo为2,修改dm.ini路径。

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

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

#DB
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/rac2_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini

5. 修改当前环境的MAL配置文件
直接修改当前环境的dmasvrmal.ini文件,添加新增节点信息,使用DMASM的所有节点都要配置,内容完全一样,并且将新增信息后的dmasvrmal.ini文件拷贝到节点10.10.13.203的/dm8/data目录下。

[dmdba@dm8rac1 data]$ vi dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 11.11.11.1
MAL_PORT = 7236

[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 11.11.11.2
MAL_PORT = 7236

[MAL_INST3]
MAL_INST_NAME = ASM2
MAL_HOST = 11.11.11.5
MAL_PORT = 7236

[dmdba@dm8rac2 data]$ vi dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 11.11.11.1
MAL_PORT = 7236

[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 11.11.11.2
MAL_PORT = 7236

[MAL_INST3]
MAL_INST_NAME = ASM2
MAL_HOST = 11.11.11.5
MAL_PORT = 7236

[dmdba@dm8rac3 data]$ vi dmasvrmal.ini
[MAL_INST1]
MAL_INST_NAME = ASM0
MAL_HOST = 11.11.11.1
MAL_PORT = 7236

[MAL_INST2]
MAL_INST_NAME = ASM1
MAL_HOST = 11.11.11.2
MAL_PORT = 7236

[MAL_INST3]
MAL_INST_NAME = ASM2
MAL_HOST = 11.11.11.5
MAL_PORT = 7236

直接修改dmserver三个实例的dmmal.ini,添加新增节点信息,所有节点都要配置相同内容,保存到各自的rac_config目录下

[dmdba@dm8rac1 rac0_config]$ vi dmmal.ini
[mal_inst0]
    mal_inst_name  = RAC0
    mal_host       = 11.11.11.1
    mal_port       = 9340

[mal_inst1]
    mal_inst_name  = RAC1
    mal_host       = 11.11.11.2
    mal_port       = 9340

[mal_inst2]
    mal_inst_name  = RAC2
    mal_host       = 11.11.11.5
    mal_port       = 9340

[dmdba@dm8rac2 rac1_config]$ vi dmmal.ini
[mal_inst0]
    mal_inst_name  = RAC0
    mal_host       = 11.11.11.1
    mal_port       = 9340

[mal_inst1]
    mal_inst_name  = RAC1
    mal_host       = 11.11.11.2
    mal_port       = 9340

[mal_inst2]
    mal_inst_name  = RAC2
    mal_host       = 11.11.11.5
    mal_port       = 9340



[dmdba@dm8rac3 rac2_config]$ vi dmmal.ini
[mal_inst0]
    mal_inst_name  = RAC0
    mal_host       = 11.11.11.1
    mal_port       = 9340

[mal_inst1]
    mal_inst_name  = RAC1
    mal_host       = 11.11.11.2
    mal_port       = 9340

[mal_inst2]
    mal_inst_name  = RAC2
    mal_host       = 11.11.11.5
    mal_port       = 9340

后续实例会重新读MAL配置文件,更新内存信息。

6. 修改dmdcr_cfg_bak.ini,添加新增节点信息,CSS/ASMSVR/DB都要配置
所有组信息修改:

DCR_GRP_N_EP = 3
DCR_GRP_EP_ARR = {0,1,2}

每个组增加一个节点信息,注意DCR_EP_SHM_KEY、端口号不能冲突;各组信息要放在各自的后面,即[GRP_CSS]中CSS2放在CSS1后面,[GRP_ASM]中ASM2放在ASM1后面,RAC2放在RAC1后面。

[dmdba@dm8rac1 data]$ cat dmdcr_cfg_bak.ini
# the file is auto-created by system, self edit is invalid!
#DCR HDR
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           = 3
DCR_GRP_EP_ARR         = {0,1,2}
DCR_GRP_N_ERR_EP       = 0
DCR_GRP_ERR_EP_ARR     = {}
DCR_GRP_DSKCHK_CNT     = 60

[GRP]
DCR_GRP_TYPE           = ASM
DCR_GRP_NAME           = GRP_ASM
DCR_GRP_N_EP           = 3
DCR_GRP_EP_ARR         = {0,1,2}
DCR_GRP_N_ERR_EP       = 0
DCR_GRP_ERR_EP_ARR     = {}
DCR_GRP_DSKCHK_CNT     = 60

[GRP]
DCR_GRP_TYPE           = DB
DCR_GRP_NAME           = GRP_RAC
DCR_GRP_N_EP           = 3
DCR_GRP_EP_ARR         = {0,1,2}
DCR_GRP_N_ERR_EP       = 0
DCR_GRP_ERR_EP_ARR     = {}
DCR_GRP_DSKCHK_CNT     = 60

[GRP_CSS]
DCR_EP_NAME        = CSS0
DCR_EP_HOST        = 11.11.11.1
DCR_EP_PORT        = 9541

[GRP_CSS]
DCR_EP_NAME        = CSS1
DCR_EP_HOST        = 11.11.11.2
DCR_EP_PORT        = 9541

[GRP_CSS]
DCR_EP_NAME        = CSS2
DCR_EP_HOST        = 11.11.11.5
DCR_EP_PORT        = 9541

[GRP_ASM]
DCR_EP_NAME        = ASM0
DCR_EP_SHM_KEY     = 93360
DCR_EP_SHM_SIZE    = 10
DCR_EP_HOST        = 10.10.13.201
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        = 10.10.13.202
DCR_EP_PORT        = 9641
DCR_EP_ASM_LOAD_PATH  = /dev/raw

[GRP_ASM]
DCR_EP_NAME        = ASM2
DCR_EP_SHM_KEY     = 93362
DCR_EP_SHM_SIZE    = 10
DCR_EP_HOST        = 10.10.13.203
DCR_EP_PORT        = 9641
DCR_EP_ASM_LOAD_PATH  = /dev/raw

[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     = 9741

[GRP_RAC]
DCR_EP_NAME        = RAC2
DCR_EP_SEQNO       = 2
DCR_EP_PORT        = 5236
DCR_CHECK_PORT     = 9741

7. 使用DMASMCMD工具将新增节点信息写回磁盘,新增节点作为error节点

[dmdba@dm8rac1 ~]$ dmasmcmd
DMASMCMD V8
ASM>extend dcrdisk '/dev/raw/raw1' from '/dm8/data/dmdcr_cfg_bak.ini'
ASMCMD extend node for dcr disk success.
ASMCMD extend node for vote disk success.
Used time: 00:00:02.362.

8. 在dmcssm控制台执行扩展节点命令

先配置dmcssm.ini文件

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

启动dmcssm监视器

[dmdba@dm8rac1 ~]$ dmcssm INI_PATH=/dm8/data/dmcssm.ini
[monitor]         2021-12-10 10:46:32: CSS MONITOR V8
[monitor]         2021-12-10 10:46:32: CSS MONITOR SYSTEM IS READY.

[monitor]         2021-12-10 10:46:32: Wait CSS Control Node choosed...
[monitor]         2021-12-10 10:46:33: Wait CSS Control Node choosed succeed.

show

monitor current time:2021-12-10 10:46:57, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS0] auto check = TRUE, global info:
[ASM0] auto restart = FALSE
[RAC0] auto restart = FALSE

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


ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2021-12-10 10:46:57    CSS0          0         9541    Control Node OPEN               WORKING      OK           TRUE         738576474         738751954
        2021-12-10 10:46:57    CSS1          1         9541    Normal Node  OPEN               WORKING      OK           TRUE         738606319         738781682

=================== group[name = GRP_ASM, seq = 1, type = ASM, 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
        2021-12-10 10:46:57    ASM0          0         9641    Control Node OPEN               WORKING      OK           TRUE         738588988         738764427
        2021-12-10 10:46:57    ASM1          1         9641    Normal Node  OPEN               WORKING      OK           TRUE         738624010         738799326

=================== 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
        2021-12-10 10:46:57    RAC0          0         5236    Control Node OPEN               WORKING      OK           TRUE         2383210041        2383382787
        2021-12-10 10:46:57    RAC1          1         5236    Normal Node  OPEN               WORKING      OK           TRUE         2383231629        2383404339

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

extend node
[monitor]         2021-12-10 10:47:13: Extend node

[monitor]         2021-12-10 10:47:15: Notify current active CSS to do clear
[monitor]         2021-12-10 10:47:16: Clean request of CSS(0) success
[monitor]         2021-12-10 10:47:17: Clean request of CSS(1) success
[monitor]         2021-12-10 10:47:17: Command EXTENT NODE  execute success

show

monitor current time:2021-12-10 10:47:22, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS0] auto check = TRUE, global info:
[ASM0] auto restart = FALSE
[RAC0] auto restart = FALSE

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

[CSS2] auto check = FALSE, global info:
Connect to [CSS2] failed, please check the network or the CSSM_CSS_IP config in [/dm8/data/dmcssm.ini] .

ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2021-12-10 10:47:22    CSS0          0         9541    Control Node OPEN               WORKING      OK           TRUE         738576474         738751979
        2021-12-10 10:47:22    CSS1          1         9541    Normal Node  OPEN               WORKING      OK           TRUE         738606319         738781707
        2021-12-10 10:47:22    CSS2          2         9541    Normal Node  SHUTDOWN           UNKNOWN      OK           FALSE        0                 0

=================== group[name = GRP_ASM, seq = 1, type = ASM, 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
        2021-12-10 10:47:22    ASM0          0         9641    Control Node OPEN               WORKING      OK           TRUE         738588988         738764452
        2021-12-10 10:47:22    ASM1          1         9641    Normal Node  OPEN               WORKING      OK           TRUE         738624010         738799351
        2021-12-10 10:47:22    ASM2          2         9641    Normal Node  SHUTDOWN           UNKNOWN      ERROR        FALSE        0                 0

=================== 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
        2021-12-10 10:47:22    RAC0          0         5236    Control Node OPEN               WORKING      OK           TRUE         2383210041        2383382812
        2021-12-10 10:47:22    RAC1          1         5236    Normal Node  OPEN               WORKING      OK           TRUE         2383231629        2383404364
        2021-12-10 10:47:22    RAC2          2         5236    Normal Node  SHUTDOWN           UNKNOWN      ERROR        FALSE        0                 0

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

程序会通知所有实例(CSS/ASMSVR/dmserver)更新信息,在CSS控制台执行SHOW命令,能看到新增节点信息,ASMSVR/dmserver是error节点,程序会通知ASMSVR/dmserver更新MAL信息。

注意:如果由于配置文件错误,动态扩展节点失败,只能停掉所有实例,重新init dcr磁盘,不影响dmserver数据

9. 启动新的DMCSS、DMASM服务程序
在10.10.13.203节点启动dmcss、dmasmsvr程序。
手动启动新的dmcss,dcr_ini指向新的dmdcr.ini文件:

[/opt/dmdbms/bin]# ./dmcss DCR_INI=/home/data/dmdcr.ini

手动启动新的dmasmsvr,dcr_ini指向新的dmdcr.ini文件,asmsvr启动故障重加入流程:

[/opt/dmdbms/bin]# ./dmasmsvr DCR_INI=/home/data/dmdcr.ini

如果DMCSS配置有自动拉起dmasmsvr的功能,可以等待DMCSS自动拉起dmasmsvr程序,不需要手动启动。

我这里将服务注册成服务

[root@dm8rac3 system]# /dm8/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm8/data/dmdcr.ini -p rac3
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicerac3.service to /usr/lib/systemd/system/DmCSSServicerac3.service.
Finished to create the service (DmCSSServicerac3)
[root@dm8rac3 system]# /dm8/script/root/dm_service_installer.sh -t dmasmsvr -dcr_ini /dm8/data/dmdcr.ini -p rac3 -y DmCSSServicerac3
Created symlink from /etc/systemd/system/multi-user.target.wants/DmASMSvrServicerac3.service to /usr/lib/systemd/system/DmASMSvrServicerac3.service.
Finished to create the service (DmASMSvrServicerac3)
[root@dm8rac3 system]#
[root@dm8rac3 system]# service DmCSSServicerac3 start
Redirecting to /bin/systemctl start DmCSSServicerac3.service
[root@dm8rac3 system]# service DmCSSServicerac3 status
Redirecting to /bin/systemctl status DmCSSServicerac3.service
   DmCSSServicerac3.service - DM Cluster Synchronization Services Service(DmCSSServicerac3).
   Loaded: loaded (/usr/lib/systemd/system/DmCSSServicerac3.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-12-10 10:59:41 CST; 19s ago
  Process: 4340 ExecStart=/dm8/bin/DmCSSServicerac3 start (code=exited, status=0/SUCCESS)
 Main PID: 4368 (dmcss)
    Tasks: 12
   CGroup: /system.slice/DmCSSServicerac3.service
           └─4368 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini

Dec 10 10:59:26 dm8rac3 systemd[1]: Starting DM Cluster Synchronization Services Service(DmCSSServicerac3)....
Dec 10 10:59:41 dm8rac3 DmCSSServicerac3[4340]: [38B blob data]
Dec 10 10:59:41 dm8rac3 systemd[1]: Started DM Cluster Synchronization Services Service(DmCSSServicerac3)..
[root@dm8rac3 system]# service DmASMSvrServicerac3 start
Redirecting to /bin/systemctl start DmASMSvrServicerac3.service
[root@dm8rac3 system]# service DmASMSvrServicerac3 status
Redirecting to /bin/systemctl status DmASMSvrServicerac3.service
   DmASMSvrServicerac3.service - DM Auto Storage Manager Service(DmASMSvrServicerac3).
   Loaded: loaded (/usr/lib/systemd/system/DmASMSvrServicerac3.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-12-10 11:00:23 CST; 7s ago
  Process: 4441 ExecStart=/dm8/bin/DmASMSvrServicerac3 start (code=exited, status=0/SUCCESS)
 Main PID: 4467 (dmasmsvr)
    Tasks: 18
   CGroup: /system.slice/DmASMSvrServicerac3.service
           └─4467 /dm8/bin/dmasmsvr dcr_ini=/dm8/data/dmdcr.ini

Dec 10 11:00:08 dm8rac3 systemd[1]: Starting DM Auto Storage Manager Service(DmASMSvrServicerac3)....
Dec 10 11:00:23 dm8rac3 DmASMSvrServicerac3[4441]: [41B blob data]
Dec 10 11:00:23 dm8rac3 systemd[1]: Started DM Auto Storage Manager Service(DmASMSvrServicerac3)..

show

monitor current time:2021-12-10 11:01:08, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS0] auto check = TRUE, global info:
[ASM0] auto restart = FALSE
[RAC0] auto restart = FALSE

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

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


ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2021-12-10 11:01:08    CSS0          0         9541    Control Node OPEN               WORKING      OK           TRUE         738576474         738752802
        2021-12-10 11:01:08    CSS1          1         9541    Normal Node  OPEN               WORKING      OK           TRUE         738606319         738782529
        2021-12-10 11:01:08    CSS2          2         9541    Normal Node  OPEN               WORKING      OK           TRUE         790591989         790592089

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

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

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
        2021-12-10 11:01:08    ASM0          0         9641    Control Node OPEN               WORKING      OK           TRUE         738588988         738765275
        2021-12-10 11:01:08    ASM1          1         9641    Normal Node  OPEN               WORKING      OK           TRUE         738624010         738800174
        2021-12-10 11:01:08    ASM2          2         9641    Normal Node  OPEN               WORKING      OK           TRUE         790605125         790605178

=================== 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
        2021-12-10 11:01:08    RAC0          0         5236    Control Node OPEN               WORKING      OK           TRUE         2383210041        2383383635
        2021-12-10 11:01:08    RAC1          1         5236    Normal Node  OPEN               WORKING      OK           TRUE         2383231629        2383405186
        2021-12-10 11:01:08    RAC2          2         5236    Normal Node  SHUTDOWN           UNKNOWN      ERROR        FALSE        0                 0

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

10. 启动新的数据库服务器
如果DMCSS配置有自动拉起dmserver的功能,可以等待DMCSS自动拉起实例,不需要手动启动。
如果需要手动启动,可参考下面的操作步骤:
10.10.13.203机器:

./dmserver /home/data/dsc2_config/dm.ini dcr_ini=/home/data/dmdcr.ini

我这里注册成服务来启动数据库

[root@dm8rac3 system]# /dm8/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm8/data/rac2_config/dm.ini -dcr_ini /dm8/data/dmdcr.ini -p rac3 -y DmASMSvrServicerac3
Created symlink from /etc/systemd/system/multi-user.target.wants/DmServicerac3.service to /usr/lib/systemd/system/DmServicerac3.service.
Finished to create the service (DmServicerac3)
[root@dm8rac3 system]# service DmServicerac3 start
Redirecting to /bin/systemctl start DmServicerac3.service
[root@dm8rac3 system]# service DmServicerac3 status
Redirecting to /bin/systemctl status DmServicerac3.service
   DmServicerac3.service - DM Instance Service(DmServicerac3).
   Loaded: loaded (/usr/lib/systemd/system/DmServicerac3.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2021-12-10 11:05:56 CST; 7s ago
  Process: 4673 ExecStart=/dm8/bin/DmServicerac3 start (code=exited, status=0/SUCCESS)
 Main PID: 4704 (dmserver)
    Tasks: 105
   CGroup: /system.slice/DmServicerac3.service
           └─4704 /dm8/bin/dmserver path=/dm8/data/rac2_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini -noconsole

Dec 10 11:05:40 dm8rac3 systemd[1]: Starting DM Instance Service(DmServicerac3)....
Dec 10 11:05:41 dm8rac3 DmServicerac3[4673]: Starting DmServicerac3: connnect dmasmtool successfully.
Dec 10 11:05:56 dm8rac3 DmServicerac3[4673]: [11B blob data]
Dec 10 11:05:56 dm8rac3 systemd[1]: Started DM Instance Service(DmServicerac3)..

show

monitor current time:2021-12-10 11:06:09, n_group:3
=================== group[name = GRP_CSS, seq = 0, type = CSS, Control Node = 0] ========================================

[CSS0] auto check = TRUE, global info:
[ASM0] auto restart = FALSE
[RAC0] auto restart = FALSE

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

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


ep:     css_time               inst_name     seqno     port    mode         inst_status        vtd_status   is_ok        active       guid              ts
        2021-12-10 11:06:09    CSS0          0         9541    Control Node OPEN               WORKING      OK           TRUE         738576474         738753101
        2021-12-10 11:06:09    CSS1          1         9541    Normal Node  OPEN               WORKING      OK           TRUE         738606319         738782829
        2021-12-10 11:06:09    CSS2          2         9541    Normal Node  OPEN               WORKING      OK           TRUE         790591989         790592389

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

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

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
        2021-12-10 11:06:09    ASM0          0         9641    Control Node OPEN               WORKING      OK           TRUE         738588988         738765574
        2021-12-10 11:06:09    ASM1          1         9641    Normal Node  OPEN               WORKING      OK           TRUE         738624010         738800474
        2021-12-10 11:06:09    ASM2          2         9641    Normal Node  OPEN               WORKING      OK           TRUE         790605125         790605478

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

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

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
        2021-12-10 11:06:09    RAC0          0         5236    Control Node OPEN               WORKING      OK           TRUE         2383210041        2383383934
        2021-12-10 11:06:09    RAC1          1         5236    Normal Node  OPEN               WORKING      OK           TRUE         2383231629        2383405486
        2021-12-10 11:06:09    RAC2          2         5236    Normal Node  OPEN               WORKING      OK           TRUE         2557760476        2557760496

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

五.注意事项
1. 扩展节点前由用户保证所有dmcss/dmasmsvr/dmserver节点都是OK的,且都是活动的;
2. 每次扩展节点只能扩一个节点,扩展完成后可以再继续扩展节点;
3. 扩展节点的过程中不能出现修改实例状态或模式的操作;
4. 扩展节点的过程中,如果发生dmcss/dmasmsvr/dmserver实例故障,会导致扩展失败;
5. 扩展过程中操作失误(比如未修改dmmal.ini、asmsvrmal.ini,未增加日志文件),会导致扩展失败;
6. 执行完extend node命令,用户需要查看log文件,确认扩展操作是否成功;
7. 扩展失败可能会导致集群环境异常,需要退出所有dmcss/dmasmsvr/dmserver,重新init dcr磁盘。

DM8 使用裸设备搭建DMRAC

使用裸设备搭建DMRAC
一、操作环境

主机	IP地址(对外服务)	        IP地址(内部通信)	       实例名	操作系统
dm8dsc1	10.10.13.205	        11.11.11.3	        dsc0	Redhat 7.8
dm8dsc2	10.10.13.206	        11.11.11.4	        dsc1	Redhat 7.8

共享存储

/dev/sdb	/dev/raw/raw1	dcr disk	2G
/dev/sdc	/dev/raw/raw2	voting disk	2G
/dev/sdd1	/dev/raw/raw3	log disk1	2G
/dev/sdd2	/dev/raw/raw4	log disk2	2G
/dev/sdd3	/dev/raw/raw5	log disk3	2G
/dev/sdd5	/dev/raw/raw6	log disk4	2G
/dev/sde1	/dev/raw/raw7	data disk1	5G
/dev/sde2	/dev/raw/raw8	data disk2	5G
/dev/sdf1	/dev/raw/raw9	data disk3	5G
/dev/sdf2	/dev/raw/raw10	data disk4	5G
/dev/sdg1	/dev/raw/raw11	data disk5	5G
/dev/sdg2	/dev/raw/raw12	data disk6	5G

二、操作系统配置
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 08 10:57:13 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 08 10:57:17 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 08 14:46:41 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 08 14:46:42 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 08 10:57:19 gbase systemd[1]: Starting firewalld - dynamic firewall daemon...
Dec 08 10:57:21 gbase systemd[1]: Started firewalld - dynamic firewall daemon.
Dec 08 14:46:45 gbase systemd[1]: Stopping firewalld - dynamic firewall daemon...
Dec 08 14:46:46 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 ~]# hostnamectl set-hostname dm8dsc1
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8dsc1:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.205   dm8dsc1
> 10.10.13.206   dm8dsc2" >> /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.205   dm8dsc1
10.10.13.206   dm8dsc2


[root@gbase ~]# hostnamectl set-hostname dm8dsc2
[root@gbase ~]# sed -i s:^HOSTNAME=.*$:HOSTNAME=dm8dsc2:g /etc/sysconfig/network
[root@gbase ~]# echo "
> 10.10.13.205   dm8dsc1
> 10.10.13.206   dm8dsc2" >> /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.205   dm8dsc1
10.10.13.206   dm8dsc2

三、 安装达梦软件

3.1检查Linux(Unix)系统信息

[root@dm8dsc1 ~]# getconf LONG_BIT
64

[root@dm8dsc2 ~]# getconf LONG_BIT
64

查询操作系统release信息

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


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

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

[root@dm8dsc1 ~]# groupadd dinstall

[root@dm8dsc2 ~]# groupadd dinstall

2. 创建安装用户dmdba。

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

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

3. 初始化用户密码。

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


[root@dm8dsc2 ~]# 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@dm8dsc1 ~]# 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@dm8dsc2 ~]# 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@dm8dsc1 ~]# 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@dm8dsc2 ~]# 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@dm8dsc1 ~]# su - dmdba
[dmdba@dm8dsc1 ~]$ 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@dm8dsc2 ~]# su - dmdba
[dmdba@dm8dsc2 ~]$ 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@dm8dsc1 ~]# grep MemTotal /proc/meminfo
MemTotal:        8009068 kB

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

#获取交换分区大小
[root@dm8dsc1 ~]# grep SwapTotal /proc/meminfo
SwapTotal:       8257532 kB

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

#获取内存使用详情
[root@dm8dsc1 ~]# free -g
              total        used        free      shared  buff/cache   available
Mem:              7           0           6           0           0           6
Swap:             7           0           7

[root@dm8dsc2 ~]# 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@dm8dsc1 ~]# mkdir /dm8
[root@dm8dsc1 ~]# chown -R dmdba:dinstall /dm8
[root@dm8dsc1 ~]# chmod -R 775 /dm8

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

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

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

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

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

[root@dm8dsc2 ~]# 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@dm8dsc1 ~]# cd /soft
[root@dm8dsc1 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@dm8dsc1 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@dm8dsc1 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8dsc1 soft]# mkdir dmsoft
[root@dm8dsc1 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@dm8dsc1 soft]# cd dmsoft
[root@dm8dsc1 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@dm8dsc2 ~]# cd /soft
[root@dm8dsc2 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@dm8dsc2 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@dm8dsc2 soft]# mv dm8_20211021_x86_rh6_64_ent dm8
[root@dm8dsc2 soft]# mkdir dmsoft
[root@dm8dsc2 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@dm8dsc2 soft]# cd dmsoft
[root@dm8dsc2 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@dm8dsc1 dmsoft]# chmod 755  DMInstall.bin
chmod: changing permissions of ‘DMInstall.bin’: Read-only file system

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

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

[dmdba@dm8dsc1 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-08 15:24:33
[INFO] Installing DM DBMS...
2021-12-08 15:24:34
[INFO] Installing BASE Module...
2021-12-08 15:24:36
[INFO] Installing SERVER Module...
2021-12-08 15:24:36
[INFO] Installing CLIENT Module...
2021-12-08 15:24:37
[INFO] Installing DRIVERS Module...
2021-12-08 15:24:37
[INFO] Installing MANUAL Module...
2021-12-08 15:24:37
[INFO] Installing SERVICE Module...
2021-12-08 15:24:43
[INFO] Move log file to log directory.
2021-12-08 15:24:45
[INFO] Installed DM DBMS completely.

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

End

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

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

[root@dm8dsc1 dmsoft]# su - dmdba
Last login: Wed Dec  8 15:22:23 CST 2021 on pts/2
[dmdba@dm8dsc1 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
[dmdba@dm8dsc1 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH



[dmdba@dm8dsc2 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-08 15:26:51
[INFO] Installing DM DBMS...
2021-12-08 15:26:51
[INFO] Installing BASE Module...
2021-12-08 15:26:54
[INFO] Installing SERVER Module...
2021-12-08 15:26:55
[INFO] Installing CLIENT Module...
2021-12-08 15:27:03
[INFO] Installing DRIVERS Module...
2021-12-08 15:27:03
[INFO] Installing MANUAL Module...
2021-12-08 15:27:03
[INFO] Installing SERVICE Module...
2021-12-08 15:27:10
[INFO] Move log file to log directory.
2021-12-08 15:27:15
[INFO] Installed DM DBMS completely.

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

End

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

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

[root@dm8dsc2 dmsoft]# su - dmdba
Last login: Wed Dec  8 15:22:48 CST 2021 on pts/2
[dmdba@dm8dsc2 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
[dmdba@dm8dsc2 ~]$ vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/dm8/bin"
export DM_HOME="/dm8"
export PATH=$PATH:$LD_LIBRARY_PATH

四、绑定UDEV
编辑/etc/udev/rules.d/99-dm-devices.rules文件

[root@dm8dsc1 dmsoft]# cd /etc/udev/rules.d/
[root@dm8dsc1 rules.d]# vi 99-dm-devices.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=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdd2", RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add", KERNEL=="sdd3", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdd4", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sde2", RUN+="/bin/raw /dev/raw/raw8 %N"

ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add", KERNEL=="sdf2", RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add", KERNEL=="sdg1", RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add", KERNEL=="sdg2", RUN+="/bin/raw /dev/raw/raw12 %N"



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


[root@dm8dsc2 dmsoft]# cd /etc/udev/rules.d/
[root@dm8dsc2 rules.d]# vi 99-dm-devices.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=="sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", KERNEL=="sdd2", RUN+="/bin/raw /dev/raw/raw4 %N"

ACTION=="add", KERNEL=="sdd3", RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdd4", RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add", KERNEL=="sde1", RUN+="/bin/raw /dev/raw/raw7 %N"
ACTION=="add", KERNEL=="sde2", RUN+="/bin/raw /dev/raw/raw8 %N"

ACTION=="add", KERNEL=="sdf1", RUN+="/bin/raw /dev/raw/raw9 %N"
ACTION=="add", KERNEL=="sdf2", RUN+="/bin/raw /dev/raw/raw10 %N"
ACTION=="add", KERNEL=="sdg1", RUN+="/bin/raw /dev/raw/raw11 %N"
ACTION=="add", KERNEL=="sdg2", RUN+="/bin/raw /dev/raw/raw12 %N"



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

[root@dm8dsc1 rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@dm8dsc1 rules.d]# ls -lrt /dev/raw
total 0
crw-rw----. 1 root disk 162, 0 Dec  8 15:37 rawctl

[root@dm8dsc2 rules.d]# /sbin/udevadm trigger --type=devices --action=change
[root@dm8dsc2 rules.d]# ls -lrt /dev/raw
total 0
crw-rw----. 1 root disk 162, 0 Dec  8 15:37 rawctl

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

[root@dm8dsc1 ~]# ls -lrt /dev/raw
total 0
crw-rw---- 1 root  disk     162,  0 Dec  8 15:38 rawctl
crw-rw---- 1 root  disk     162,  5 Dec  8 15:38 raw5
crw-rw---- 1 root  disk     162,  4 Dec  8 15:38 raw4
crw-rw---- 1 root  disk     162,  3 Dec  8 15:38 raw3
crw-rw---- 1 dmdba dinstall 162,  2 Dec  8 15:38 raw2
crw-rw---- 1 dmdba dinstall 162,  1 Dec  8 15:38 raw1
crw-rw---- 1 root  disk     162,  9 Dec  8 15:38 raw9
crw-rw---- 1 root  disk     162,  8 Dec  8 15:38 raw8
crw-rw---- 1 root  disk     162,  7 Dec  8 15:38 raw7
crw-rw---- 1 root  disk     162,  6 Dec  8 15:38 raw6
crw-rw---- 1 root  disk     162, 12 Dec  8 15:38 raw12
crw-rw---- 1 root  disk     162, 11 Dec  8 15:38 raw11
crw-rw---- 1 root  disk     162, 10 Dec  8 15:38 raw10

[root@dm8dsc2 ~]# ls -lrt /dev/raw
total 0
crw-rw---- 1 root  disk     162,  0 Dec  8 15:38 rawctl
crw-rw---- 1 root  disk     162,  7 Dec  8 15:38 raw7
crw-rw---- 1 dmdba dinstall 162,  2 Dec  8 15:38 raw2
crw-rw---- 1 dmdba dinstall 162,  1 Dec  8 15:38 raw1
crw-rw---- 1 root  disk     162,  9 Dec  8 15:38 raw9
crw-rw---- 1 root  disk     162,  8 Dec  8 15:38 raw8
crw-rw---- 1 root  disk     162,  5 Dec  8 15:38 raw5
crw-rw---- 1 root  disk     162,  4 Dec  8 15:38 raw4
crw-rw---- 1 root  disk     162,  3 Dec  8 15:38 raw3
crw-rw---- 1 root  disk     162, 11 Dec  8 15:38 raw11
crw-rw---- 1 root  disk     162, 10 Dec  8 15:38 raw10
crw-rw---- 1 root  disk     162,  6 Dec  8 15:38 raw6
crw-rw---- 1 root  disk     162, 12 Dec  8 15:38 raw12

[root@dm8dsc1 ~]# vi /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
chown dmdba:dinstall /dev/raw/raw[1-12]
chmod 660 /dev/raw/raw[1-12]


[root@dm8dsc1 ~]# vi /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
chown dmdba:dinstall /dev/raw/raw[1-12]
chmod 660 /dev/raw/raw[1-12]

修改裸设备的权限防止因为重启权限不正确导致dmasmcmd不能识别

[root@dm8dsc1 ~]# ls -lrt /dev/raw/
total 0
crw-rw---- 1 root  disk     162,  0 Dec  8 16:27 rawctl
crw-rw---- 1 dmdba dinstall 162,  9 Dec  8 16:27 raw9
crw-rw---- 1 dmdba dinstall 162, 10 Dec  8 16:27 raw10
crw-rw---- 1 dmdba dinstall 162,  6 Dec  8 16:27 raw6
crw-rw---- 1 dmdba dinstall 162,  5 Dec  8 16:27 raw5
crw-rw---- 1 dmdba dinstall 162,  3 Dec  8 16:27 raw3
crw-rw---- 1 dmdba dinstall 162,  2 Dec  8 16:27 raw2
crw-rw---- 1 dmdba dinstall 162,  1 Dec  8 16:27 raw1
crw-rw---- 1 dmdba dinstall 162,  8 Dec  8 16:27 raw8
crw-rw---- 1 dmdba dinstall 162,  7 Dec  8 16:27 raw7
crw-rw---- 1 dmdba dinstall 162,  4 Dec  8 16:27 raw4
crw-rw---- 1 dmdba dinstall 162, 12 Dec  8 16:27 raw12
crw-rw---- 1 dmdba dinstall 162, 11 Dec  8 16:27 raw11


[root@dm8dsc2 ~]# ls -lrt /dev/raw/
total 0
crw-rw---- 1 root  disk     162,  0 Dec  8 16:26 rawctl
crw-rw---- 1 dmdba dinstall 162,  1 Dec  8 16:26 raw1
crw-rw---- 1 dmdba dinstall 162,  5 Dec  8 16:26 raw5
crw-rw---- 1 dmdba dinstall 162,  2 Dec  8 16:26 raw2
crw-rw---- 1 dmdba dinstall 162,  8 Dec  8 16:26 raw8
crw-rw---- 1 dmdba dinstall 162,  7 Dec  8 16:26 raw7
crw-rw---- 1 dmdba dinstall 162,  6 Dec  8 16:26 raw6
crw-rw---- 1 dmdba dinstall 162,  4 Dec  8 16:26 raw4
crw-rw---- 1 dmdba dinstall 162,  3 Dec  8 16:26 raw3
crw-rw---- 1 dmdba dinstall 162, 11 Dec  8 16:26 raw11
crw-rw---- 1 dmdba dinstall 162,  9 Dec  8 16:26 raw9
crw-rw---- 1 dmdba dinstall 162, 12 Dec  8 16:26 raw12
crw-rw---- 1 dmdba dinstall 162, 10 Dec  8 16:26 raw10


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

[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw1
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw2
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw3
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw4
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw5
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw6
2147483648
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw7
5368709120
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw8
5367660544
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw9
5368709120
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw10
5367660544
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw11
5368709120
[root@dm8dsc1 ~]# blockdev --getsize64 /dev/raw/raw12
5367660544


[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw1
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw2
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw3
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw4
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw5
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw6
2147483648
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw7
5368709120
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw8
5367660544
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw9
5368709120
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw10
5367660544
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw11
5368709120
[root@dm8dsc2 ~]# blockdev --getsize64 /dev/raw/raw12
5367660544

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

[root@dm8dsc1 ~]# su - dmdba
Last login: Wed Dec  8 15:27:56 CST 2021 on pts/1
[dmdba@dm8dsc1 ~]$ mkdir /dm8/data

[root@dm8dsc2 ~]# su - dmdba
Last login: Wed Dec  8 15:27:32 CST 2021 on pts/1
[dmdba@dm8dsc2 ~]$ mkdir /dm8/data

[dmdba@dm8dsc1 ~]$ cd /dm8/data
[dmdba@dm8dsc1 data]$ vi dmdcr_cfg.ini
DCR_N_GRP = 2
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 = 11.11.11.3
DCR_EP_PORT = 9541
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 11.11.11.4
DCR_EP_PORT = 9541



[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_DSC]
DCR_EP_NAME = DSC0
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741

[dmdba@dm8dsc2 ~]$ cd /dm8/data
[dmdba@dm8dsc2 data]$ vi dmdcr_cfg.ini
DCR_N_GRP = 2
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 = 11.11.11.3
DCR_EP_PORT = 9541
[GRP_CSS]
DCR_EP_NAME = CSS1
DCR_EP_HOST = 11.11.11.4
DCR_EP_PORT = 9541



[GRP]
DCR_GRP_TYPE = DB
DCR_GRP_NAME = GRP_DSC
DCR_GRP_N_EP = 2
DCR_GRP_DSKCHK_CNT = 60
[GRP_DSC]
DCR_EP_NAME = DSC0
DCR_EP_SEQNO = 0
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741
[GRP_DSC]
DCR_EP_NAME = DSC1
DCR_EP_SEQNO = 1
DCR_EP_PORT = 5236
DCR_CHECK_PORT = 9741

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

[dmdba@dm8dsc1 ~]$ dmasmcmd
DMASMCMD V8
ASM>create dcrdisk '/dev/raw/raw1' 'dcr'
[Trace]The ASM initialize dcrdisk /dev/raw/raw1 to name DMASMdcr
Used time: 269.118(ms).
ASM>create votedisk '/dev/raw/raw2' 'vote'
[Trace]The ASM initialize votedisk /dev/raw/raw2 to name DMASMvote
Used time: 108.701(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.244.
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: 431.131(ms).

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

[dmdba@dm8dsc1 data]$ vi dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_SEQNO = 0



#DB
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/dsc0_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini

节点2:

[dmdba@dm8dsc2 data]$ vi dmdcr.ini
DMDCR_PATH = /dev/raw/raw1
DMDCR_SEQNO = 1



#DB
DMDCR_DB_RESTART_INTERVAL = 0
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/dsc1_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini

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

[root@dm8dsc1 ~]# /dm8/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm8/data/dmdcr.ini -p dsc1
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicedsc1.service to /usr/lib/systemd/system/DmCSSServicedsc1.service.
Finished to create the service (DmCSSServicedsc1)

节点二:

[root@dm8dsc2 ~]# /dm8/script/root/dm_service_installer.sh -t dmcss -dcr_ini /dm8/data/dmdcr.ini -p dsc2
Created symlink from /etc/systemd/system/multi-user.target.wants/DmCSSServicedsc2.service to /usr/lib/systemd/system/DmCSSServicedsc2.service.
Finished to create the service (DmCSSServicedsc2)

2、启动DMCSS 服务
节点一:

[root@dm8dsc1 ~]# service DmCSSServicedsc1 start
Redirecting to /bin/systemctl start DmCSSServicedsc1.service
[root@dm8dsc1 ~]# service DmCSSServicedsc1 status
Redirecting to /bin/systemctl status DmCSSServicedsc1.service
 DmCSSServicedsc1.service - DM Cluster Synchronization Services Service(DmCSSServicedsc1).
   Loaded: loaded (/usr/lib/systemd/system/DmCSSServicedsc1.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-12-08 17:19:47 CST; 38s ago
  Process: 3776 ExecStart=/dm8/bin/DmCSSServicedsc1 start (code=exited, status=0/SUCCESS)
 Main PID: 3800 (dmcss)
    Tasks: 9
   CGroup: /system.slice/DmCSSServicedsc1.service
           └─3800 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini

Dec 08 17:19:32 dm8dsc1 systemd[1]: Starting DM Cluster Synchronization Services Service(DmCSSServicedsc1)....
Dec 08 17:19:47 dm8dsc1 DmCSSServicedsc1[3776]: [38B blob data]
Dec 08 17:19:47 dm8dsc1 systemd[1]: Started DM Cluster Synchronization Services Service(DmCSSServicedsc1)..

节点二:

[root@dm8dsc2 ~]# service DmCSSServicedsc2 start
Redirecting to /bin/systemctl start DmCSSServicedsc2.service
[root@dm8dsc2 ~]# service DmCSSServicedsc2 status
Redirecting to /bin/systemctl status DmCSSServicedsc2.service
 DmCSSServicedsc2.service - DM Cluster Synchronization Services Service(DmCSSServicedsc2).
   Loaded: loaded (/usr/lib/systemd/system/DmCSSServicedsc2.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2021-12-08 17:20:19 CST; 13s ago
  Process: 3546 ExecStart=/dm8/bin/DmCSSServicedsc2 start (code=exited, status=0/SUCCESS)
 Main PID: 3569 (dmcss)
    Tasks: 9
   CGroup: /system.slice/DmCSSServicedsc2.service
           └─3569 /dm8/bin/dmcss dcr_ini=/dm8/data/dmdcr.ini

Dec 08 17:20:04 dm8dsc2 systemd[1]: Starting DM Cluster Synchronization Services Service(DmCSSServicedsc2)....
Dec 08 17:20:19 dm8dsc2 DmCSSServicedsc2[3546]: [38B blob data]
Dec 08 17:20:19 dm8dsc2 systemd[1]: Started DM Cluster Synchronization Services Service(DmCSSServicedsc2)..

九.操作系统配置准备配置dminit.ini文件,存放在/dm8/data目录中(数据文件存储在/dev/raw/raw3-6裸设备上,日志文件存储在/dev/raw/raw7-10

[dmdba@dm8dsc1 data]$ vi dminit.ini
system_path = /dm8/data
db_name=dsc
main = /dev/raw/raw3
main_size = 128
roll = /dev/raw/raw4
roll_size = 128
system = /dev/raw/raw5
system_size = 128
ctl_path = /dev/raw/raw6
ctl_size = 8
dcr_path=/dev/raw/raw1
dcr_seqno=0

[dsc0]
config_path=/dm8/data/dsc0_config
port_num = 5236
mal_host = 11.11.11.3
mal_port = 9340
log_size = 256
log_path = /dev/raw/raw7
log_path = /dev/raw/raw8
[dsc1]
config_path=/dm8/data/dsc1_config
port_num = 5236
mal_host = 11.11.11.4
mal_port = 9341
log_size = 256
log_path = /dev/raw/raw9
log_path = /dev/raw/raw10

十、操作系统配置使用dminit初始化DB环境
在任意节点启动 dminit 工具初始化数据库。dminit 执行完成后,会在 config_path 目录(/dm8/data/dsc0_config 和/dm8/data/dsc1_config)下生成配置文件 dm.ini 和 dmmal.ini。

[dmdba@dm8dsc1 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: /dev/raw/raw7


 log file path: /dev/raw/raw8


 log file path: /dev/raw/raw9


 log file path: /dev/raw/raw10

FILE "/dev/raw/raw5" has already existed
FILE "/dev/raw/raw4" has already existed
FILE "/dev/raw/raw3" has already existed
FILE "/dev/raw/raw6" has already existed
FILE "/dev/raw/raw7" has already existed
FILE "/dev/raw/raw8" has already existed
FILE "/dev/raw/raw9" has already existed
FILE "/dev/raw/raw10" has already existed
File "/dev/raw/raw5" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw4" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw3" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw6" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw7" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw8" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw9" has already existed,
whether overwrite(y/n, 1/0): y
File "/dev/raw/raw10" has already existed,
whether overwrite(y/n, 1/0): y
write to dir [/dm8/data/dsc].
create dm database success. 2021-12-08 17:30:36
[dmdba@dm8dsc1 data]$ ls -lrt
total 12
-rw-r--r-- 1 dmdba dinstall 563 Dec  8 16:49 dmdcr_cfg.ini
-rw-r--r-- 1 dmdba dinstall 182 Dec  8 17:05 dmdcr.ini
-rw-r--r-- 1 dmdba dinstall 546 Dec  8 17:28 dminit.ini
drwxr-xr-x 2 dmdba dinstall  87 Dec  8 17:30 dsc0_config
drwxr-xr-x 2 dmdba dinstall  55 Dec  8 17:30 dsc1_config
drwxr-xr-x 5 dmdba dinstall  70 Dec  8 17:30 dsc

将节点一的配置文件复制到节点二:

[dmdba@dm8dsc1 data]$ scp -r dsc1_config 10.10.13.206:`pwd`
The authenticity of host '10.10.13.206 (10.10.13.206)' 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.206' (ECDSA) to the list of known hosts.
dmdba@10.10.13.206's password:
dmmal.ini                                                                                                                                                                                                100%  200    17.0KB/s   00:00
dm.ini                                                                                                                                                                                                   100%   52KB   2.2MB/s   00:00
sqllog.ini                                                                                                                                                                                               100%  481    53.4KB/s   00:00

一定要将节点一/dm8/data/目录中生成的dsc目录复制到节点二的/dm8/data目录中,否则在节点二中启动数据库时会出现以下错误,原因就是因为使用裸设备时生成的dsc目录及其文件不是存储在共享存储中可以让集群节点都能访问。

Starting DmServicerac2: [ FAILED ]
file dm.key not found, use default license!
Read ini warning, default dm.ctl backup path [/dm8/data/dsc/ctl_bak] does not exist.
Read ini error, name:SYSTEM_PATH, value:/dm8/data/dsc
dmserver startup failed, code = -803 [Invalid ini config value]

将节点一/dm8/data/目录中生成的dsc目录复制到节点二的/dm8/data目录

[dmdba@dm8dsc1 data]$ scp -r dsc  10.10.13.206:`pwd`
dmdba@10.10.13.206's password:
dm_20211208173029_111982.ctl                                                                                                                                                                             100% 6144   493.8KB/s   00:00
dm_service.prikey                                                                                                                                                                                        100%  633    57.0KB/s   00:00

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

[root@dm8dsc1 init.d]# /dm8/script/root/dm_service_installer.sh -t dmserver -dm_ini /dm8/data/dsc0_config/dm.ini -dcr_ini /dm8/data/dmdcr.ini -p dsc1
dmserver(RAC) need to be set the dependent service(dmasmsvr)!

提示需要依赖服务dmasmsvr,但使用裸设备没有配置dmasm实例,所以只能手动启动服务
手工启动命令如下,手工启动后窗口不能关闭

[dmdba@dm8dsc1 ~]$ dmserver /dm8/data/dsc0_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini &

[dmdba@dm8dsc2 ~]$ dmserver /dm8/data/dsc1_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini &

如果DMCSS配置有自动拉起dmserver的功能,可以等待DMCSS自动拉起实例,不需要手动启动。在dmdcr.ini文件中配置如下选项

#DB
DMDCR_DB_RESTART_INTERVAL = 10
DMDCR_DB_STARTUP_CMD = /dm8/bin/dmserver path=/dm8/data/dsc0_config/dm.ini dcr_ini=/dm8/data/dmdcr.ini

十二.连接数据库验证
1.配置服务名文件

[dmdba@dm8dsc1 ~]$ vi /etc/dm_svc.conf
TIME_ZONE=(480)
LANGUAGE=(en)
rac=(10.10.13.205:5236,10.10.13.206:5236)
SWITCH_TIME=(10000)
SWITCH_INTERVAL=(10)

[dmdba@dm8dsc2 ~]$ vi /etc/dm_svc.conf
TIME_ZONE=(480)
LANGUAGE=(en)
rac=(10.10.13.205:5236,10.10.13.206:5236)
SWITCH_TIME=(10000)
SWITCH_INTERVAL=(10)

2.连接RAC集群
节点一:

[dmdba@dm8dsc1 ~]$ disql SYSDBA/SYSDBA@rac

Server[10.10.13.205:5236]:mode is normal, state is open
login used time : 4.303(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- ------------
1          DSC0 DSC0          1               dm8dsc1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-09 12:56:06 OPEN    NORMAL 0           0           Control node

used time: 6.832(ms). Execute id is 400.
SQL> select * from v$dsc_ep_info;

LINEID     EP_NAME EP_SEQNO    EP_GUID              EP_TIMESTAMP         EP_MODE      EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1          DSC0    0           2477818562           2477826305           Control Node OK
2          DSC1    1           2477823752           2477831486           Normal Node  OK

used time: 1.221(ms). Execute id is 401.
SQL>

节点二:

[dmdba@dm8dsc2 ~]$ disql SYSDBA/SYSDBA@rac

Server[10.10.13.205:5236]:mode is normal, state is open
login used time : 3.048(ms)
disql V8
SQL> select * from v$instance;

LINEID     NAME INSTANCE_NAME INSTANCE_NUMBER HOST_NAME SVR_VERSION                DB_VERSION          START_TIME          STATUS$ MODE$  OGUID       DSC_SEQNO   DSC_ROLE
---------- ---- ------------- --------------- --------- -------------------------- ------------------- ------------------- ------- ------ ----------- ----------- ------------
1          DSC0 DSC0          1               dm8dsc1   DM Database Server x64 V8  DB Version: 0x7000c 2021-12-09 12:56:06 OPEN    NORMAL 0           0           Control node

used time: 5.261(ms). Execute id is 500.
SQL> select * from v$dsc_ep_info;

LINEID     EP_NAME EP_SEQNO    EP_GUID              EP_TIMESTAMP         EP_MODE      EP_STATUS
---------- ------- ----------- -------------------- -------------------- ------------ ---------
1          DSC0    0           2477818562           2477826342           Control Node OK
2          DSC1    1           2477823752           2477831523           Normal Node  OK

used time: 1.499(ms). Execute id is 501.