环境:
OS:Centos 7
DB:DMV8
1.dsc备份
在其中一个节点上备份数据和归档日志
disql SYSDBA/SYSDBA
backup database full backupset '/dmdbms/backup/fullbak_20240411';
backup archivelog all delete input to "archbak_20240411" backupset '/dmdbms/backup/archbak_20240411';
2.备份集拷贝到单节点的服务器
[root@localhost rmanbak]# scp -r ./fullbak_20240411 [email protected]:/dmdbms/rmanbak/
[root@localhost rmanbak]# scp -r ./archbak_20240411 [email protected]:/dmdbms/rmanbak/
3.异机恢复处理
若异机没有安装数据库的可以进行初始化安装,命令如下
su - dmdba
dminit path=/dmdbms/data charset=1 case_sensitive=0 length_in_char=0 db_name=slnngk instance_name=slnngk SYSDBA_PWD="dameng123" SYSAUDITOR_PWD="dameng123"
a.这里的参数尽量与原库保持一致(字符集、大小写敏感)
b.实例名与源库一致
若异机原来异机运行了数据库的,需要停掉
[root@localhost root]# systemctl stop DmServiceslnngk.service
异机初始化或是停掉服务后,需要删除data目录下的文件
[dmdba@localhost slnngk]$ cd /dmdbms/data/slnngk
[dmdba@localhost slnngk]$ rm *.log
[dmdba@localhost slnngk]$ rm -rf HMAIN
[dmdba@localhost slnngk]$ rm -rf trace
[dmdba@localhost slnngk]$ rm dm_service.prikey
[dmdba@localhost slnngk]$ rm TEMP.DBF
[dmdba@localhost slnngk]$ rm main.dbf
[dmdba@localhost slnngk]$ rm roll.dbf
[dmdba@localhost slnngk]$ rm tps_hxl01.dbf
最后只保留如下这些文件
[dmdba@localhost slnngk]$ ls -al
total 131164
drwxr-xr-x. 4 dmdba dinstall 78 Apr 11 09:30 .
drwxr-xr-x. 4 dmdba dinstall 31 Apr 10 18:07 ..
drwxr-xr-x. 2 dmdba dinstall 6 Apr 10 18:02 bak
drwxr-xr-x. 2 dmdba dinstall 258 Apr 11 08:53 ctl_bak
-rw-r--r--. 1 dmdba dinstall 6144 Apr 11 08:53 dm.ctl
-rw-r--r--. 1 dmdba dinstall 75709 Apr 10 18:02 dm.ini
-rw-r--r--. 1 dmdba dinstall 134217728 Apr 11 09:07 system.dbf
4.恢复:
su - dmdba
[dmdba@localhost ~]$ dmrman
A.从备份集恢复归档到具体目录
RMAN>restore archive log from backupset '/dmdbms/rmanbak/archbak_20240411' TO ARCHIVEDIR'/dmdbms/arch' overwrite 2;
1表示认为归档文件完好,不再还原该归档文件,添加一条日志记录;
2表示存在同名归档立即报错返回,终止还原;
3表示强制删除归档,重新还原同名归档.
这个时候会把dsc两个节点的归档都恢复到/dmdbms/arch目录的
[dmdba@localhost arch]$ ls -al
total 216
drwxr-xr-x. 2 dmdba dinstall 250 Apr 11 09:36 .
drwxr-xr-x. 8 dmdba dinstall 85 Apr 11 09:36 ..
-rw-r--r-- 1 dmdba dinstall 61440 Apr 11 09:36 ARCHIVE_LOCAL1_0x33C696E0_EP0_2024-04-10_16-59-32.log
-rw-r--r-- 1 dmdba dinstall 90112 Apr 11 09:36 ARCHIVE_LOCAL1_0x33C696E0_EP0_2024-04-11_09-05-00.log
-rw-r--r-- 1 dmdba dinstall 40960 Apr 11 09:36 ARCHIVE_LOCAL1_0x33C696E0_EP1_2024-04-10_16-56-58.log
-rw-r--r-- 1 dmdba dinstall 28672 Apr 11 09:36 ARCHIVE_LOCAL1_0x33C696E0_EP1_2024-04-11_09-05-03.log
B.恢复
[dmdba@localhost ~]$ dmrman
RMAN>restore database '/dmdbms/data/slnngk/dm.ini' from backupset '/dmdbms/rmanbak/fullbak_20240411'; ##还原备份集
RMAN>recover database '/dmdbms/data/slnngk/dm.ini' with archivedir '/dmdbms/arch'; ##通过归档日志完全恢复
RMAN>recover database '/dmdbms/data/slnngk/dm.ini' update db_magic;
5.启动数据库
systemctl start DmServiceslnngk.service
6.数据验证
[dmdba@localhost ~]$ disql hxl/dameng123
Server[LOCALHOST:5236]:mode is normal, state is open
login used time : 3.990(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
LINEID ID NAME
---------- -- -----
12 12 name2
13 13 name3
14 14 name4
15 15 name5
15 rows got
used time: 1.530(ms). Execute id is 601.
标签:11,dmdba,dinstall,单机,备份,dmdbms,dsc,slnngk,localhost From: https://www.cnblogs.com/hxlasky/p/18128106