Thursday, June 26, 2014

Recreating Dataguard Broker Configuration After ORA-16816: Incorrect Database Role

Following a failed switchover using dataguard broker the database role information was in a inconsistent state.
DGMGRL> show configuration

Configuration - APDG

  Protection Mode: MaxPerformance
  Databases:
    XA04  - Primary database
      Error: ORA-16816: incorrect database role

    XA04S - Physical standby database
      Error: ORA-16810: multiple errors or warnings detected for the database

Fast-Start Failover: DISABLED

Configuration Status:
ERROR
Even though the dataguard broker still consider the XA04 as the primary database and XA04S as the standby database, the databases themselves have under gone the role change and new role is reflected on the v$database view. From the XA04S which dataguard broker still considers the standby
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PRIMARY
And from XA04 which dataguard broker considers the primary
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PHYSICAL STANDBY
It's clear that dataguard broker contains erroneous information.



Solution for this situation is to recreate the dataguard broker. This does not entail dropping the configuration. Dropping the dataguard broker would remove all data guard related configuration parameters from the spfile. To recreate the dataguard broker remove the dataguard broker configuration files using a OS utility (rm, delete) if the files are stored in the OS, or using ASMCMD rm if they are stored in the ASM (as in the case of RAC).
Once the configuration files are removed recreate the dataguard broker again by connecting to the new primary database instance.

Useful metalink notes
Step By Step How to Recreate Dataguard Broker Configuration [ID 808783.1]
Unable To Recreate Data Guard Fast Start Failover Configuration With DGMGRL [ID 454418.1]