一、ORA-10458: standby database requires recovery&ORA-01196&ORA-01110
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: '/u01/app/oracle/oradata/proe/system01.dbf'
2.实际环境:
前一天DG搭建成功并测试。虚拟机环境,正常先关闭主库后关闭备库。然后虚拟机关机。今天再次启动备库时报上述错误。
3.解决:
排查过程:
SYS@stddb>set lines 500;
SYS@stddb>set pages 500;
SYS@stddb>select instance_name,status,database_status,instance_role from v$instance;
INSTANCE_NAME STATUS DATABASE_STATUS INSTANCE_ROLE
---------------- ------------ ----------------- ------------------
stddb MOUNTED ACTIVE PRIMARY_INSTANCE
SYS@stddb>select name,open_mode,database_role,dataguard_broker,guard_status,switchover_status from v$database;
NAME OPEN_MODE DATABASE_ROLE DATAGUAR GUARD_S SWITCHOVER_STATUS
--------- -------------------- ---------------- -------- ------- --------------------
PROE MOUNTED PHYSICAL STANDBY DISABLED NONE NOT ALLOWED
恢复过程:
#借助已经存在的DG进行介质恢复,备库数据库此时mount状态,主库正常打开
SYS@stddb>recover managed standby database using current logfile disconnect from session;
Media recovery complete.
#主库进行日志切换,多切几次。等待日志同步。
SYS@proe>alter system switch logfile;
System altered.
SYS@proe>/
System altered.
# 主库在进行日志切换操作的时候,会将未应用的日志或未成功应用的日志传输数到备库从而实现备库的日志恢复。稍等一会后,取消同步拉起数据库。
SYS@stddb>recover managed standby database cancel;
Media recovery complete.
SYS@stddb>alter database open read only;
Database altered.
查看效果:
SYS@stddb>select name,open_mode,database_role,dataguard_broker,guard_status,switchover_status from v$database;
NAME OPEN_MODE DATABASE_ROLE DATAGUAR GUARD_S SWITCHOVER_STATUS
--------- -------------------- ---------------- -------- ------- --------------------
PROE READ ONLY PHYSICAL STANDBY DISABLED NONE NOT ALLOWED
4.总结:
备库未成功应用归档日志,因为只是自己的测试环境数据量比较小使用DG本身去恢复比较方便,但是如果数据量比较大通过DG本身去追会很吃力,使用基于SCN的RMAN增量备份去恢复更好一些。
当然重新搭建一个物理备库也是可以的。