注册
备份恢复 - SYSTEM.DBF文件丢失的恢复
专栏/培训园地/ 文章详情 /

备份恢复 - SYSTEM.DBF文件丢失的恢复

IT_Girl 2025/01/14 179 0 0
摘要

0 基本信息

环境:CentOS 7
数据库版本:V8.1.3.26

SQL> select id_code;
LINEID     ID_CODE                                   
---------- ------------------------------------------
1          --03134284058-20240821-240039-20046 Pack37

数据库信息:主备集群部署在同一台服务器
软件目录:/dm8
实例目录:
主:/dmdata/5236
备:/dmdata/5237

1 全库备份

这里全库备份执行脱机的全备或联机全备都可以。
此处执行的是脱机的全备

1.1 停止服务

停监视器

[dmdba@dba ~]$ DmMonitorServiceMONITOR stop
Stopping DmMonitorServiceMONITOR:                       [ OK ]

停备的守护:

[dmdba@dba ~]$ DmWatcherServiceDMSERVER02 stop
Stopping DmWatcherServiceDMSERVER02:                  [ OK ]

停主的守护:

[dmdba@dba ~]$ DmWatcherServiceDMSERVER01 stop
Stopping DmWatcherServiceDMSERVER01:                  [ OK ]

停主的数据库:

[dmdba@dba ~]$ DmServiceDMSERVER01 stop
Stopping DmServiceDMSERVER01:                        [ OK ]

停备的数据库:

[dmdba@dba ~]$ DmServiceDMSERVER02 stop
Stopping DmServiceDMSERVER02:                         [ OK ]

image.png

1.2 dmrman执行备份

[dmdba@dba ~]$ dmrman
dmrman V8
RMAN> backup database '/dmdata/5236/DMDB/dm.ini' backupset '/home/dmdba/full.bak';
backup database '/dmdata/5236/DMDB/dm.ini' backupset '/home/dmdba/full.bak';
file dm.key not found, use default license!
Database mode = 1, oguid = 26180
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[41419], file_lsn[41419]
Processing backupset /home/dmdba/full.bak
                                                                                                                                    [Percent:81.94%][Speed:628.71M/s][Cost:00:00:02][Remaining:00:00:0                                                                                                                                    [Percent:98.71%][Speed:426.23M/s][Cost:00:00:02][Remaining:00:00:0                                                                                                                                    [Percent:100.00%][Speed:285.71M/s][Cost:00:00:02][Remaining:00:00:                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]
backup successfully!
time used: 00:00:03.517

image.png

2 模拟故障

2.1 system.dbf文件改名

[dmdba@dba ~]$ cd /dmdata/5236/DMDB/
[dmdba@dba DMDB]$ ls
bak         dm.ini.dmbak              HMAIN
ctl_bak     dminit20241025092424.log  MAIN.DBF
dmarch.ini  dmmal.ini                 ROLL.DBF
dm.ctl      dmmonitor.ini             sqllog.ini
DMDB01.log  dmmonitor_noc.ini         SYSTEM.DBF
DMDB02.log  dm_service.prikey         TEMP.DBF
dm.ini      dmwatcher.ini             trace
[dmdba@dba DMDB]$ cp dm.ini dm.ini.bak
[dmdba@dba DMDB]$ mv SYSTEM.DBF SYSTEM.DBF.BAK

image.png

2.2 识别system.dbf文件丢失

启主库服务

[dmdba@dba DMDB]$ DmServiceDMSERVER01 start
Starting DmServiceDMSERVER01:                     [ FAILED ]

image.png
查看日志报错
image.png

3 解决故障

3.1 重新生成一个system.dbf文件

注:此处需要重新拷贝回来一个system.dbf文件,否则在restore时提示,SYSTEM.DBF文件不存在。
将备库的system.dbf文件拷贝回来

[dmdba@dba ~]$ cd /dmdata/5237/DMDB/
[dmdba@dba DMDB]$ ls
bak         dm.ini.dmbak              HMAIN
ctl_bak     dminit20241025093427.log  MAIN.DBF
dmarch.ini  dmmal.ini                 ROLL.DBF
dm.ctl      dmmonitor.ini             sqllog.ini
DMDB01.log  dmmonitor_noc.ini         SYSTEM.DBF
DMDB02.log  dm_service.prikey         TEMP.DBF
dm.ini      dmwatcher.ini             trace
[dmdba@dba DMDB]$ cp SYSTEM.DBF ../../5236/DMDB/

image.png

3.2 dmrman执行restore重储备份

[dmdba@dba DMDB]$ dmrman
dmrman V8
RMAN> restore database '/dmdata/5236/DMDB/dm.ini' from backupset '/home/dmdba/full.bak';
restore database '/dmdata/5236/DMDB/dm.ini' from backupset '/home/dmdba/full.bak';
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:1316.29M/s][Cost:00:00:02][Remaining:00:00                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00                                                                  [Percent:100.00%][Speed:0.00M/s][Cost:00:00:02][Remaining:00:00:00]
restore successfully.
time used: 00:00:02.790

image.png

3.3 dmrman执行recover恢复

RMAN> recover database '/dmdata/5236/DMDB/dm.ini' from backupset '/home/dmdba/full.bak';
recover database '/dmdata/5236/DMDB/dm.ini' from backupset '/home/dmdba/full.bak';
Database mode = 2, oguid = 26180
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[41419], file_lsn[41419]
recover successfully!
time used: 448.116(ms)

image.png

3.4 更新db_magic

RMAN> recover database '/dmdata/5236/DMDB/dm.ini' update db_magic;
recover database '/dmdata/5236/DMDB/dm.ini' update db_magic;
Database mode = 2, oguid = 26180
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
EP[0]'s cur_lsn[41419], file_lsn[41419]
recover successfully!
time used: 00:00:01.095

image.png

3.5 启服务

[dmdba@dba DMDB]$ DmServiceDMSERVER01 start
Starting DmServiceDMSERVER01:                   [ OK ]
[dmdba@dba DMDB]$ DmServiceDMSERVER02 start
Starting DmServiceDMSERVER02:                    [ OK ]
[dmdba@dba DMDB]$ DmWatcherServiceDMSERVER01 start
Starting DmWatcherServiceDMSERVER01:              [ OK ]
[dmdba@dba DMDB]$ DmWatcherServiceDMSERVER02 start
Starting DmWatcherServiceDMSERVER02:               [ OK ]

image.png
至此结束!

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服