oracle 12.2.0.1 dataguard 的 physical standby 启动时报错 ORA

oracle 12.2.0.1 dataguard 的 physical standby 启动时报错 ORA-10458: standby database requires recovery

数据库人生 2019-01-30 10:36:20 4883 收藏 2

分类专栏: # oracle ha data guard 文章标签: ORA-10458 ORA-01196 ORA-01110

版权

postgresql ha patroni

patroni

数据库人生

¥9.90

os: centos 7.4
db: oracle 12.1.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'
  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

    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

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

  • 11

  • 12

  • 13

  • 14

  • 15

  • 16

解决方法1 重做 physical standby

这个比较简单,粗暴,不适用数据库偏大的情况.

解决方法2 恢复 physical standby

这个比较通用,也比较简单

从库上操作,启动到mount状态,启动恢复

SQL> shutdown immediate;
SQL> startup mount;
SQL> recover managed standby database using current logfile disconnect from session;
  • 1
  • 2
  • 3
  • 4

主库上操作,产生几个归档

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;
  • 1
  • 2
  • 3
  • 4
  • 5

一定要求确保 v$archive_dest 的 status 列为 ‘VALID’

在主库上查询一下归档情况:

SQL> select name,sequence#,archived,applied from v$archived_log order by sequence#;
  • 1
  • 2

如果返回结果 ‘APPLIED’ 都是 ‘YES’ 或者只有最后一个是 'NO’的话,说明全部归档日志全部已经归档完了.
备库上操作

SQL> alter database recover managed standby database cancel;
SQL> alter database open;
  • 1
  • 2
  • 3

此时,如果数据库正常打开了,且如果是通过 sqlplus 手动配置的 dataguard,就执行如下命令

SQL> alter database recover managed standby database using current logfile disconnect from session;
  • 1
  • 2

如果是通过 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;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

参考:

评论

暂无评论