os: centos 7.6
db: oracle 12.2.0.2
本地虚拟机直接掉电,再启动 physical standby 时提示错误
SQL> startup
ORACLE instance started.
Total System Global Area 1644167168 bytes
Fixed Size 2925024 bytes
Variable Size 1073745440 bytes
Database Buffers 553648128 bytes
Redo Buffers 13848576 bytes
Database mounted.
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/orcl/system01.dbf'
SQL> set lines 500;
SQL> set pages 500;
SQL> select instance_name,status,database_status,instance_role from v$instance;
INSTANCE_NAME STATUS DATABASE_STATUS INSTANCE_ROLE
---------------- ------------ ----------------- ------------------
orcl MOUNTED ACTIVE PRIMARY_INSTANCE
SQL> 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
--------- -------------------- ---------------- -------- ------- --------------------
ORCL MOUNTED PHYSICAL STANDBY ENABLED NONE NOT ALLOWED
解决方法1 重做 physical standby
这个比较简单,粗暴,不适用数据库偏大的情况.
解决方法2 恢复 physical standby
这个比较通用,也比较简单
从库上操作,启动到mount状态,启动恢复
SQL> shutdown immediate;
SQL> startup mount;
SQL> recover managed standby database using current logfile disconnect from session;
主库上操作,产生几个归档
SQL> alter system archive log current;
SQL> alter system checkpoint;
SQL> alter system archive log current;
SQL> select * from v$archive_dest where destination is not null;
一定要求确保 v$archive_dest 的 status 列为 ‘VALID’
在主库上查询一下归档情况:
SQL> select name,sequence#,archived,applied from v$archived_log order by sequence#;
如果返回结果 ‘APPLIED’ 都是 ‘YES’ 或者只有最后一个是 'NO’的话,说明全部归档日志全部已经归档完了.
备库上操作
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
此时,如果数据库正常打开了,且如果是通过 sqlplus 手动配置的 dataguard,就执行如下命令
SQL> alter database recover managed standby database using current logfile disconnect from session;
如果是通过 dataguard broker 配置的,就直接进入 dgmgrl 操作.
DGMGRL> show configuration ;
Configuration - dgconf
Protection Mode: MaxPerformance
Members:
orclp - Primary database
orcls1 - Physical standby database
Error: ORA-16766: Redo Apply is stopped
Fast-Start Failover: DISABLED
Configuration Status:
ERROR (status updated 50 seconds ago)
DGMGRL>
DGMGRL> enable configuration;
原文链接:https://blog.csdn.net/ctypyb2002/article/details/86699877