数据守护进程可以在数据库被关闭状态下拉起数据库服务
现在环境为已安装并初始化且注册数据库,未启动
目录为/home/dmdbms
1.进入dmdba用户
vi dm.ini
将MAL_INI和ARCH_INI改为1
#configuration file
MAL_INI = 1 #dmmal.ini
ARCH_INI = 1 #dmarch.ini
vi dmmal.ini
MAL_CHECK_INTERVAL = 5 #MAL链路检测时间间隔
MAL_CONN_FAIL_INTERVAL = 5 #判定MAL链路断开的时间
[MAL_INST1]
MAL_INST_NAME = DMSERVER #实例名,和dm.ini中的INSTANCE_NAME一致
MAL_HOST = 192.168.62.198 #MAL系统监听的TCP连接的IP地址
MAL_PORT = 5237 #MAL系统监听的TCP连接的端口
MAL_INST_HOST = 192.168.62.198 #实例的对外服务IP地址
MAL_INST_PORT = 5236 #实例的对外服务端口,和dm.ini中的PORT_NUM一致
MAL_DW_PORT = 5238 #实例监听对应的守护进程监听TCP连接的端口
MAL_INST_DW_PORT = 5239 #实例监听守护进程监听TCP连接的端口
vi dmarch.ini
#DaMeng Database Archive Configuration file
#this is comments
ARCH_WAIT_APPLY = 0
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /home/dmdbms/DAMENG/arch
ARCH_FILE_SIZE = 2048
ARCH_SPACE_LIMIT = 20480
ARCH_FLUSH_BUF_SIZE = 0
vi dmwatcher.ini
[DMSERVER]
DW_TYPE = LOCAL
DW_ERROR_TIME = 10 #远程守护进程故障认定时间
INST_RECOVER_TIME = 60 #主库守护进程启动恢复的间隔时间
INST_ERROR_TIME = 10 #本地实例故障认定时间
INST_OGUID = 453330 #守护系统唯一OGUID值
INST_INI = /home/dmdbms/DAMENG/dm.ini #dm.ini配置文件路径
INST_AUTO_RESTART = 1 #打开实例的自动启动功能
INST_STARTUP_CMD = /home/dmdbms/bin/dmserver #命令行方式启动
进入数据库进行修改OGUID与dmwatcher.ini的INST_OGUID一致
[dmdba@localhost bin]$ ./disql SYSDBA/SYSDBA
服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 3.053(ms)
disql V8
SQL> ALTER DATABASE MOUNT;
操作已执行
已用时间: 00:00:01.760. 执行号:0.
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',1);
DMSQL 过程已成功完成
已用时间: 6.286(毫秒). 执行号:3400.
SQL> SP_SET_OGUID(453330);
DMSQL 过程已成功完成
已用时间: 3.182(毫秒). 执行号:3401.
SQL> SP_SET_PARA_VALUE(1,'ALTER_MODE_STATUS',0);
DMSQL 过程已成功完成
已用时间: 3.577(毫秒). 执行号:3402.
SQL> ALTER DATABASE OPEN;
操作已执行
已用时间: 00:00:01.736. 执行号:0.
SQL> exit
2.进入root用户
ps -ef| grep dm查看一下数据库的进程
[root@localhost ~]# ps -ef| grep dm
dmdba 9956 1 0 Feb28 ? 00:00:01 /home/dmdbms/bin/dmap
root 41222 40566 0 01:59 pts/0 00:00:00 grep --color=auto dm
进入/script/root/目录,使用脚本新建数据守护服务
[root@localhost ~]# cd /home/dmdbms/script/root/
[root@localhost root]# ./dm_service_installer.sh -t dmwatcher -p DMSERVER -watcher_ini /home/dmdbms/DAMENG/dmwatcher.ini
Created symlink from /etc/systemd/system/multi-user.target.wants/DmWatcherServiceDMSERVER.service to /usr/lib/systemd/system/DmWatcherServiceDMSERVER.service.
创建服务(DmWatcherServiceDMSERVER)完成
3.进入dmdba用户
进入bin目录查看一下服务是否存在
[root@localhost root]# su - dmdba
Last login: Mon Mar 1 01:49:53 PST 2021 on pts/0
[dmdba@localhost ~]$ cd /home/dmdbms/bin
[dmdba@localhost bin]$ ls -l Dm*
-rwxr-xr-x 1 dmdba dinstall 13835 Feb 28 18:27 DmAPService
-rwxr-xr-x 1 dmdba dinstall 14487 Feb 28 18:27 DmAuditMonitorService
-rwxr-xr-x 1 dmdba dinstall 13663 Feb 28 18:27 DmInstanceMonitorService
-rwxr-xr-x 1 dmdba dinstall 14134 Feb 28 18:27 DmJobMonitorService
-rwxr-xr-x 1 dmdba dinstall 16133 Feb 28 20:52 DmServiceDMSERVER
-rwxr-xr-x 1 dmdba dinstall 13758 Mar 1 02:00 DmWatcherServiceDMSERVER
启动数据库和数据守护进程(用root用户通过systemctl命令也可以启动)
[dmdba@localhost bin]$ DmServiceDMSERVER start
Starting DmServiceDMSERVER: [ OK ]
[dmdba@localhost bin]$ DmWatcherServiceDMSERVER start
Starting DmWatcherServiceDMSERVER: [ OK ]
[dmdba@localhost bin]$ ps -ef | grep dm
dmdba 9956 1 0 Feb28 ? 00:00:01 /home/dmdbms/bin/dmap
root 41309 40566 0 02:01 pts/0 00:00:00 su - dmdba
dmdba 41310 41309 0 02:01 pts/0 00:00:00 -bash
dmdba 41383 1 0 02:03 pts/0 00:00:00 /home/dmdbms/bin/dmserver /home/dmdbms/DAMENG/dm.ini -noconsole mount
dmdba 41478 1 0 02:04 pts/0 00:00:00 /home/dmdbms/bin/dmwatcher /home/dmdbms/DAMENG/dmwatcher.ini
dmdba 41502 41310 0 02:04 pts/0 00:00:00 ps -ef
dmdba 41503 41310 0 02:04 pts/0 00:00:00 grep --color=auto dm
kill -9 尝试一下(这是测试环境,正式环境不建议使用kill -9 命令)
[dmdba@localhost bin]$ ps -ef | grep dm
dmdba 9956 1 0 Feb28 ? 00:00:01 /home/dmdbms/bin/dmap
root 41309 40566 0 02:01 pts/0 00:00:00 su - dmdba
dmdba 41310 41309 0 02:01 pts/0 00:00:00 -bash
dmdba 41383 1 0 02:03 pts/0 00:00:00 /home/dmdbms/bin/dmserver /home/dmdbms/DAMENG/dm.ini -noconsole mount
dmdba 41478 1 0 02:04 pts/0 00:00:00 /home/dmdbms/bin/dmwatcher /home/dmdbms/DAMENG/dmwatcher.ini
dmdba 41502 41310 0 02:04 pts/0 00:00:00 ps -ef
dmdba 41503 41310 0 02:04 pts/0 00:00:00 grep --color=auto dm
[dmdba@localhost bin]$ exit
logout
[root@localhost root]# kill -9 41383
[root@localhost root]# ps -ef | grep dm
dmdba 9956 1 0 Feb28 ? 00:00:01 /home/dmdbms/bin/dmap
dmdba 41478 1 0 02:04 pts/0 00:00:00 /home/dmdbms/bin/dmwatcher /home/dmdbms/DAMENG/dmwatcher.ini
root 41506 40566 0 02:06 pts/0 00:00:00 grep --color=auto dm
[root@localhost root]# ps -ef | grep dm
dmdba 9956 1 0 Feb28 ? 00:00:01 /home/dmdbms/bin/dmap
dmdba 41478 1 0 02:04 pts/0 00:00:00 /home/dmdbms/bin/dmwatcher /home/dmdbms/DAMENG/dmwatcher.ini
dmdba 41508 1 2 02:06 ? 00:00:00 /home/dmdbms/bin/dmserver /home/dmdbms/DAMENG/dm.ini mount
root 41577 40566 0 02:06 pts/0 00:00:00 grep --color=auto dm
成功
更多资讯请上达梦技术社区了解: https://eco.dameng.com