某天下午打开DG备库时发现无法open只能到mount状态。
Alter database 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: ‘/oracle/app/oracle/oradata/PROD1_ST/datafile/o1_mf_system_0qrb37o0_.dbf‘
提示需要recovery,于是立马查看gap以及日志应用情况。
select name,sequence#,archived,applied from v$archived_log;
结果sequence#从905到973之前大片的归档日志applied状态为NO,看了下备库的归档目录确实少了很多归档日志。
悲剧,于是决定采用备份主库日志的解决办法来恢复。
1.停止备库的Redo Apply
SQL> alter database recover managed standby database cancel;
2.查询备库的当前SCN 值
SQL> SELECT CURRENT_SCN FROM V$DATABASE;
3.在主库使用RMAN 基于SCN 的增量备份
RMAN> backup incremental from scn 1579945 database format ‘/u01/backup/forstandby_arch‘ tag ‘forstandby‘;
4.将备份copy 到备库,还原备库控制文件并执行恢复操作
RMAN> STARTUP FORCE NOMOUNT; RMAN> RESTORE STANDBY CONTROLFILE FROM ‘/home/oracle/backup/forstandby_arch‘; RMAN> ALTER DATABASE MOUNT; RMAN> CATALOG START WITH ‘/home/oracle/backup/‘; --注册下新的备份集 RMAN> RECOVER DATABASE NOREDO; --应用新的增量备份集 RMAN> ALTER DATABASE OPEN;
5.最后开启MRP进程
SQL> alter database recover managed standby database using current logfile disconnect from session; --打开real time apply
时间: 2024-11-02 13:25:34