【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復

不一樣的天空w發表於2016-10-17

ARCHIVELOG 模式下丟失了系統關鍵資料檔案

1.檢視資料庫為歸檔模式

SQL> archive log list;

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     11

Next log sequence to archive   13

Current log sequence           13

SQL>

2.透過RMAN備份system表空間

[oracle@wang FRA]$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 2 10:36:00 2016

 

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

 

connected to target database: ORA11GR2 (DBID=237843809)

 

RMAN> backup tablespace system;

 

Starting backup at 02-OCT-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=46 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/ORA11GR2/system01.dbf

channel ORA_DISK_1: starting piece 1 at 02-OCT-16

channel ORA_DISK_1: finished piece 1 at 02-OCT-16

piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp tag=TAG20161002T103616 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15

channel ORA_DISK_1: starting full datafile backup set

channel ORA_DISK_1: specifying datafile(s) in backup set

including current control file in backup set

including current SPFILE in backup set

channel ORA_DISK_1: starting piece 1 at 02-OCT-16

channel ORA_DISK_1: finished piece 1 at 02-OCT-16

piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_ncsnf_TAG20161002T103616_cz0wojgw_.bkp tag=TAG20161002T103616 comment=NONE

channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at 02-OCT-16

 

3.刪除system表空間

——檢視錶空間對應的路徑及檔名:

SYS@ORA11GR2>select file_name from dba_data_files where tablespace_name='SYSTEM';

 

FILE_NAME

----------------------------------------------------------------------------

/u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/system01.dbf

/u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>

SYS@ORA11GR2>!rm  /u01/app/oracle/oradata/ORA11GR2/system01.dbf

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/system01.dbf

ls: /u01/app/oracle/oradata/ORA11GR2/system01.dbf: No such file or directory

 

4.此時重啟資料庫後,會因為system資料檔案丟失而提示錯誤

SYS@ORA11GR2>shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@ORA11GR2>

SYS@ORA11GR2>startup

ORACLE instance started.

 

Total System Global Area  830930944 bytes

Fixed Size                  2257800 bytes

Variable Size             503319672 bytes

Database Buffers          322961408 bytes

Redo Buffers                2392064 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'

 

 

5.透過RMAN恢復system表空間

[oracle@wang FRA]$ rman target /

 

Recovery Manager: Release 11.2.0.4.0 - Production on Sun Oct 2 10:45:04 2016

 

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

 

connected to target database: ORA11GR2 (DBID=237843809, not open)

 

RMAN> restore tablespace system;(重儲)

Starting restore at 02-OCT-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=21 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/ORA11GR2/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp

channel ORA_DISK_1: piece handle=/u01/app/FRA/ORA11GR2/backupset/2016_10_02/o1_mf_nnndf_TAG20161002T103616_cz0wo0c0_.bkp tag=TAG20161002T103616

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:00:25

Finished restore at 02-OCT-16

 

RMAN> recover tablespace system;(恢復)

 

Starting recover at 02-OCT-16

using channel ORA_DISK_1

 

starting media recovery

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

 

Finished recover at 02-OCT-16

 

RMAN> alter database open;(開庫)

 

database opened
恢復成功!!!!!!!!!!!1


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2126535/,如需轉載,請註明出處,否則將追究法律責任。

相關文章