由于误操作,删除了备库的控制文件。
我采用如下方法恢复,但遇到错误:在主库上为备库生成控制文件后,备库无法open:
具体操作如下:
1. 在主库上生成备库的控制文件命令: ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/control01.ctl';
2. 将生成的控制文件拷贝到备库。
3. 使用新生成的控制文件将备库启动到mount。
4. 在备库开启日志实时应用模式,使备库完全应用主库的日志。
5. alter database recover managed standby database using current logfile disconnect from session;
6. 使用如下语句查询是否完全应用:
select sequence#,name,applied from v$archived_log;--从结果可以看出日志已经完全应用。
7. 停止恢复管理模式:
alter database recover managed standby database cancel;
8. 将备库启动到Open状态,此时备库报错如下:
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/oracledata/demo/data/system.1593.821133825'
备库的alert日志如下:
Tue Nov 12 00:01:41 2013
alter database open
Beginning standby crash recovery.
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Warning: Datafile 1 (/oracledata/demo/data/system.1593.821133825) is infinitely media recovery fuzzy
Standby database will not open with this datafile online!
Standby crash recovery aborted due to error 10554.
Errors in file /opt/oracle/11gR2/diag/rdbms/dg2_demo/dg2_demo/trace/dg2_demo_ora_16140.trc:
ORA-10554: Media recovery failed to bring datafile 1 to a consistent point
ORA-01110: data file 1: '/oracledata/demo/data/system.1593.821133825'
Completed standby crash recovery.
Errors in file /opt/oracle/11gR2/diag/rdbms/dg2_demo/dg2_demo/trace/dg2_demo_ora_16140.trc:
ORA-10458: standby database requires recovery
ORA-01196: file 1 is inconsistent due to a failed media recovery session
ORA-01110: data file 1: '/oracledata/demo/data/system.1593.821133825'
ORA-10458 signalled during: alter database open...
9. 查控制文件的SCN和数据文件头的SCN,发现二者一直。
SQL> select a.checkpoint_change# CTL_SCN,a.last_change# LAST_SCN,b.checkpoint_change# DBF_SCN
from v$datafile a,v$datafile_header b where a.name=b.name; 2
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
277905109 277905109
277905109 277905109
277905109 277905109
217236380 217236380
217236412 217236412
217236437 217236437
217236485 217236485
217236538 217236538
217236563 217236563
212118764 212118764
277905109 277905109
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
217236310 217236310
277905109 277905109
217236349 217236349
217236349 217236349
217236349 217236349
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
217236349 217236349
217236349 217236349
217236349 217236349
217236349 217236349
217236349 217236349
217236349 217236349
277905109 277905109
277905109 277905109
277905109 277905109
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
277905109 277905109
CTL_SCN LAST_SCN DBF_SCN
---------- ---------- ----------
277905109 277905109
54 rows selected.
现不知道为什么备库起不来,虽然日志里给出一些信息,但仍然没有头绪,望大侠指教,小弟不胜感激。 |
|