注册
【与达梦同行】HS备份还原操作流程
技术分享/ 文章详情 /

【与达梦同行】HS备份还原操作流程

S-surprise-H 2022/12/29 1485 5 1

1环境检查

Xx系统	
源端中心IP	数据库版本
13.x.x.34	1-2-18-21.06.28-142526-10013-ENT  Pack7
目的中心IP	数据库版本
10.x.x.82	1-2-18-21.06.28-142526-10013-ENT  Pack7

登录信息	数据库用户名	数据库密码
源端	SYSDBA	SYSDBA
目的	SYSDBA	SYSDBA

2 整体流程

2.1停止装载同步链路

2.1.1停止源端cpt

(1)13.x.x.34:

[root@ZWDEEPIN-03 ~]# su - dmdba
[dmdba@ZWDEEPIN-03 ~]$ cd dmhs/INST_HS/CPTCX
[dmdba@ZWDEEPIN-03 CPTCX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

连接到DMHS:127.0.0.1:5345
执行成功
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS> stop cpt

2.1.2停止目的端exec

(2)10.x.x.82:

[root@DMDB0002 ~]# su - dmdba
Last login: Mon Jun  6 18:43:13 CST 2022 on pts/1
[dmdba@DMDB0002 ~]$ cd dmhs/INST_HS/exec_CX/
[dmdba@DMDB0002 exec_CX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

连接到DMHS:127.0.0.1:5345
执行成功
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS> stop exec

2.2源端手动备份

(1)13.x.x.34:

[dmdba@ZWDEEPIN-03 ~]$ cd dmdbms/bin
[dmdba@ZWDEEPIN-03 bin]$ ./disql

disql V8
用户名:密码:

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 3.541(ms)
SQL>  backup database backupset '/home/dmdba/0606bak';
操作已执行
已用时间: 00:02:41.138. 执行号:228500.

2.3将目的端RECV_DIR目录做软连接

(2)10.x.x.82:

[dmdba@DMDB0002 ~]$ cd dmhs/INST_HS/exec_CX
[dmdba@DMDB0002 exec_CX]$ ln -s /home/dmdba/dmhs/INST_HS/exec_CX/RECV_DIR /home/dmdba/DBBAK

2.4目的端数据库的dm.ini文件cp到RECV_DIR目录里

(2)10.x.x.82:

[dmdba@DMDB0002 ~]$ 
[dmdba@DMDB0002 ~]$ ps -ef|grep dms
dmdba     6307     1  0 17:18 pts/0    00:00:05 /home/dmdba/dmdbms218/bin/dmserver path=/dmdata/data/DAMENG/dm.ini -noconsole
dmdba    32121  5235  0 18:50 pts/1    00:00:00 grep --color=auto dms
[dmdba@DMDB0002 ~]$ cp /dmdata/data/DAMENG/dm.ini /home/dmdba/dmhs/INST_HS/exec_CX/RECV_DIR/

2.5目的端下设置disql的环境变量

(2)10.x.x.82:

[dmdba@DMDB0002 ~]$ vim .bash_profile
export PATH=$PATH:/home/dmdba/dmdbms218/bin

2.6停止目的端数据库服务

10.x.x.82:

[dmdba@DMDB0002 ~]$ cd dmdbms218/bin
[dmdba@DMDB0002 bin]$ ./DmServiceDM stop

2.7源端进行备份装载

(1)13.x.x.34:

[dmdba@ZWDEEPIN-03 CPTCX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

l½ӵ½DMHS£º127.0.0.1:5345
ִѐ³ɹ¦
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS> copy 0 backup|file|"/home/dmdba/0606bak"|dir|"/home/dmdba/0606bak"
copy mask is : BACKUP|FILE
执行完成,请查看执行模块日志,检查数据装载是否成功

DMHS> 

(2)源端监控资源使用情况:

装载中的资源使用情况:
image.png

装载完成后的使用资源情况:

image.png

无明显变化,对数据库基本无压力。

2.8装载完成后启动目的端数据库

(2)10.x.x.82:

[dmdba@DMDB0002 ~]$ cd dmdbms218/bin
[dmdba@DMDB0002 bin]$ ./DmServiceDM start

2.9将目的端数据库中hs的DDL表及触发器删除

(2)10.x.x.82:
目的端首先删除触发器,在删表,直接删表删不掉
image.png
image.png

3开启同步

3.0在源端测试表中插入一些数据

(1)13.x.x.34:

测试表"TEST"."T1"插一些数据:
create table TEST.T1 (id int);
INSERT INTO "TEST"."T1"VALUES(1);
INSERT INTO "TEST"."T1"VALUES(1);
INSERT INTO "TEST"."T1"VALUES(1);
INSERT INTO "TEST"."T1"VALUES(1);
commit;

3.1启动目的端EXEC服务

(2)10.x.x.82:

[root@DMDB0002 ~]# su - dmdba
Last login: Mon Jun  6 18:43:13 CST 2022 on pts/1
[dmdba@DMDB0002 ~]$ cd dmhs/INST_HS/exec_CX/
[dmdba@DMDB0002 exec_CX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

连接到DMHS:127.0.0.1:5345
执行成功
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS> start exec

3.2源端装载字典

(1)13.x.x.34:

[root@ZWDEEPIN-03 ~]# su - dmdba
[dmdba@ZWDEEPIN-03 ~]$ cd dmhs/INST_HS/CPTCX
[dmdba@ZWDEEPIN-03 CPTCX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

连接到DMHS:127.0.0.1:5345
执行成功
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS>copy 0 "sch.name='QUERY' " DICT 

3.3开启源端cpt服务并检查数据是否同步到目的端

13.x.x.34:

[root@ZWDEEPIN-03 ~]# su - dmdba
[dmdba@ZWDEEPIN-03 ~]$ cd dmhs/INST_HS/CPTCX
[dmdba@ZWDEEPIN-03 CPTCX]$ ./dmhs_console 
DMHS console tool: V4.2.83-Build(2022.05.27-109384trunc)_D64
Copyright (c) 2020, DMHS. All rights reserved.
Type ? or "help" for help, type "quit" to quit console.

连接到DMHS:127.0.0.1:5345
执行成功
Dameng HS Server V4.2.83-Build(2022.05.27-109384trunc)_D64

DMHS>start cpt

10.x.x.82检查数据是否同步:

[dmdba@DMDB0002 ~]$ 
[dmdba@DMDB0002 ~]$ cd dmdbms218/bin
[dmdba@DMDB0002 bin]$ ./disql
disql V8
用户名:
密码:

服务器[LOCALHOST:5236]:处于普通打开状态
登录使用时间 : 1.569(ms)
SQL> select * from "QUERY"."t2";
评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服