达梦单机恢复到2节点的DSC

环境:
OS:Centos 7
DB:DMV8
单机实例名:HXL
DSC实例名:SLNNGK

 

1.单机备份

disql SYSDBA/SYSDBA
SQL>backup database full backupset '/dmdbms/backup/single_fullbak_20240411';
SQL>backup archivelog all delete input to "singe_archbak_20240411" backupset '/dmdbms/backup/single_archbak_20240411';

 

2.备份文件拷贝到dsc的其中一台机器上
scp -r single_fullbak_20240411 dmdba@192.168.56.101:/dmdbms/backup/
scp -r single_archbak_20240411 dmdba@192.168.56.101:/dmdbms/backup/

 

3.停掉dsc数据库
这里需要停掉2个节点的数据库,但是drs和asm不能停掉

 

4.删除旧实例的相应文件
在一个实例上执行即可,我这里是在节点1上操作

[dmdba@dsc1 bin]$ cd /dmdbms/product/bin
./dmasmtool dcr_ini=/dmdbms/config/dmdcr.ini

删除DMDATA目录下的文件
ASM>pwd
+DMDATA/data/SLNNGK
Used time: 0.161(ms).

ASM>rm dm_service.prikey
Used time: 13.047(ms).
ASM>rm main.dbf
Used time: 24.151(ms).
ASM>rm roll.dbf
Used time: 25.235(ms).
ASM>rm -rf HMAIN
Used time: 20.013(ms).
ASM>rm TEMP0.DBF
Used time: 15.715(ms).
ASM>rm TEMP1.DBF
Used time: 21.627(ms).
ASM>rm tps_hxl01.dbf
Used time: 26.113(ms).

ASM>ls
        dir : bak
        file : dm.ctl
        dir : ctl_bak
        file : system.dbf
total count 4.
Used time: 1.939(ms).
ASM>

删除DMLOG
ASM>pwd
+DMLOG/log
ASM>ls
        file : SLNNGK1_log01.log
        file : SLNNGK1_log02.log
        file : SLNNGK2_log01.log
        file : SLNNGK2_log02.log

ASM>rm *

 

5.恢复
只在一个节点上操作,我这里是在节点1上操作
su - dmdba
dmrman DCR_INI=/dmdbms/config/dmdcr.ini ##这里很关键需要使用dmcdr.ini配置文件
RMAN>restore archive log from backupset '/dmdbms/backup/single_archbak_20240411' TO ARCHIVEDIR'+DMDATA/arch' overwrite 2;
1表示认为归档文件完好,不再还原该归档文件,添加一条日志记录;
2表示存在同名归档立即报错返回,终止还原;
3表示强制删除归档,重新还原同名归档.

 

B.恢复
RMAN> RESTORE DATABASE '/dmdbms/config/slnngk1/dm.ini' FROM BACKUPSET '/dmdbms/backup/single_fullbak_20240411';
RMAN> recover database '/dmdbms/config/slnngk1/dm.ini' with archivedir '+DMDATA/arch';
RMAN> recover database '/dmdbms/config/slnngk1/dm.ini' update db_magic;

 

查看DMDATA文件
ASM>ls
        dir : bak
        file : dm.ctl
        dir : ctl_bak
        file : system.dbf
        file : roll.dbf
        file : main.dbf
        file : tps_hxl01.dbf
        dir : HMAIN
        file : dm_service.prikey
total count 9.
Used time: 0.992(ms).
ASM>pwd
+DMDATA/data/SLNNGK
Used time: 0.157(ms).

DMLOG日志文件
ASM>ls
        file : SLNNGK1_log01.log
        file : SLNNGK1_log02.log
        file : SLNNGK2_log01.log
        file : SLNNGK2_log02.log
total count 4.
Used time: 1.517(ms).
ASM>pwd
+DMLOG/log
Used time: 0.322(ms).

 

启动数据库
节点1
[dmdba@dsc1 bin]$ cd /dmdbms/product/bin
./dmserver path=/dmdbms/config/slnngk1/dm.ini dcr_ini=/dmdbms/config/dmdcr.ini

节点2:
[dmdba@dsc2 bin]$ cd /dmdbms/product/bin
./dmserver path=/dmdbms/config/slnngk2/dm.ini dcr_ini=/dmdbms/config/dmdcr.ini

 

 

6.数据验证

[dmdba@dsc1 bin]$ disql hxl/dameng123

Server[LOCALHOST:5236]:mode is normal, state is open
login used time : 13.063(ms)
disql V8
SQL> select * from tb_hxl;

LINEID     ID NAME 
---------- -- -----
1          1  name1
2          2  name2
3          3  name3
4          4  name4
5          5  name5
6          6  name1
7          7  name2
8          8  name3
9          9  name4
10         10 name5
11         11 name1

 

posted @ 2024-04-11 13:49  slnngk  阅读(30)  评论(0编辑  收藏  举报