ITPub博客

首页 > 数据库 > Oracle > 【备份恢复】归档模式下丢失系统关键数据文件 利用RMAN备份恢复

【备份恢复】归档模式下丢失系统关键数据文件 利用RMAN备份恢复

原创 Oracle 作者:kiran1990 时间:2016-12-19 14:08:32 0 删除 编辑
1.开启归档模式
SYS@PROD1>archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/app/backup
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence           1

2.RMAN备份system表空间
[oracle@host01 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Dec 19 12:11:33 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD1 (DBID=2148633869)

RMAN> backup tablespace system;

Starting backup at 19-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=33 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/PROD1/system01.dbf
channel ORA_DISK_1: starting piece 1 at 19-DEC-16
channel ORA_DISK_1: finished piece 1 at 19-DEC-16
piece handle=/u01/app/oracle/fast_recovery_area/PROD1/backupset/2016_12_19/o1_mf_nnndf_TAG20161219T121247_d5gqkz83_.bkp tag=TAG20161219T121247 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
Finished backup at 19-DEC-16

Starting Control File and SPFILE Autobackup at 19-DEC-16
piece handle=/u01/app/oracle/fast_recovery_area/PROD1/autobackup/2016_12_19/o1_mf_s_931003982_d5gqlgdm_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 19-DEC-16

3.模拟故障,删除数据文件
SYS@PROD1>col file_name for a50;
SYS@PROD1>select file_name from dba_data_files where tablespace_name='SYSTEM';

FILE_NAME
--------------------------------------------------
/u01/app/oracle/oradata/PROD1/system01.dbf

SYS@PROD1>! ls /u01/app/oracle/oradata/PROD1/system01.dbf
ls: /u01/app/oracle/oradata/PROD1/system01.dbf: No such file or directory

4.重启数据库,提示找不到数据文件
SYS@PROD1>shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

SYS@PROD1>startup;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             520096848 bytes
Database Buffers          310378496 bytes
Redo Buffers                2371584 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/PROD1/system01.dbf'

5.通过RMAN进行恢复

[oracle@host01 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Mon Dec 19 12:18:50 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD1 (DBID=2148633869, not open)

RMAN> restore tablespace system;

Starting restore at 19-DEC-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/PROD1/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/PROD1/backupset/2016_12_19/o1_mf_nnndf_TAG20161219T121247_d5gqkz83_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/PROD1/backupset/2016_12_19/o1_mf_nnndf_TAG20161219T121247_d5gqkz83_.bkp tag=TAG20161219T121247
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 19-DEC-16

RMAN> recover tablespace system;

Starting recover at 19-DEC-16
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 19-DEC-16

SYS@PROD1>alter database open;

Database altered.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31400681/viewspace-2130936/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-10-08

  • 博文量
    61
  • 访问量
    21169