控制檔案全部丟失的恢復

jane_pop發表於2014-08-18
報錯資訊:
SQL> startup
ORACLE instance started.
Total System Global Area  849530880 bytes
Fixed Size                  1339824 bytes
Variable Size             515903056 bytes
Database Buffers          327155712 bytes
Redo Buffers                5132288 bytes
ORA-00205: error in identifying control file, check alert log for more info

檢視警報日誌檔案獲取詳細資訊:
ALTER DATABASE   MOUNT
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
ORA-205 signalled during: ALTER DATABASE   MOUNT...

報錯資訊顯示丟失了control01.ctl和control02.ctl。檢視引數control_files值:
SQL> show parameter control_files


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
control_files                        string      /u01/app/oracle/oradata/orcl/c
                                                 ontrol01.ctl, /u01/app/oracle/
                                                 flash_recovery_area/orcl/contr
                                                 ol02.ctl

可看出資料庫中有兩個控制檔案,現在兩個控制檔案都丟失了,嘗試使用rman進行恢復:
[oracle@localhost trace]$ rman target / nocatalog
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Aug 17 22:25:07 2014

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

connected to target database: ORCL (not mounted)
using target database control file instead of recovery catalog

RMAN> restore controlfile from autobackup;

Starting restore at 17-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=22 device type=DISK

recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2014_08_17/o1_mf_s_855871765_9z32n64r_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2014_08_17/o1_mf_s_855871765_9z32n64r_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/orcl/control02.ctl
Finished restore at 17-AUG-14

嘗試重新開啟資料庫:
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'

造成這種錯誤的原因是控制檔案中的scn和資料檔案中的不一致。
下面透過rman來恢復資料庫:
RMAN> recover database
2> ;
Starting recover at 17-AUG-14
Starting implicit crosscheck backup at 17-AUG-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
Crosschecked 17 objects
Finished implicit crosscheck backup at 17-AUG-14

Starting implicit crosscheck copy at 17-AUG-14
using channel ORA_DISK_1
Finished implicit crosscheck copy at 17-AUG-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/ORCL/autobackup/2014_08_17/o1_mf_s_855871765_9z32n64r_.bkp

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 9 is already on disk as file /u01/app/oracle/oradata/orcl/redo03.log
archived log for thread 1 with sequence 10 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log
archived log file name=/u01/app/oracle/oradata/orcl/redo03.log thread=1 sequence=9
archived log file name=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=10
media recovery complete, elapsed time: 00:00:01
Finished recover at 17-AUG-14

使用resetlogs開啟資料庫:
SQL> alter database open resetlogs;

Database altered.






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

相關文章