控制文件全部丢失的恢复

报错信息:
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.






请使用浏览器的分享功能分享到微信等