Step by Step recover after a failed switchover

 Issue Description

We might find in a situation where your switchover fails and left environment with two physical standby databases.

 Solution

 

1.       Logon (as sysdba) to the instance that was your Primary database instance before the switchover.

2.       Confirm the database role.


SQL> select database_role from v$database;

 

DATABASE_ROLE

-------------------------------

PHYSICAL STANDBY


[ortnbtyi@shsebs121db01 ~]$ srvctl stop database -d tansid_p1


[ortnbtyi@shsebs121db01 ~]$ srvctl start database -d tansid_p1 -o mount

[ortnbtyi@shsebs121db01 ~]$ sqlplus "/as sysdba"


SQL*Plus: Release 19.0.0.0.0 - Production on Sat Feb 18 11:59:45 2023

Version 19.14.0.0.0


Copyright (c) 1982, 2021, Oracle.  All rights reserved.



Connected to:

Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production

Version 19.14.0.0.0



SQL>  alter database recover managed standby database cancel;
 alter database recover managed standby database cancel
*
ERROR at line 1:
ORA-16136: Managed Standby Recovery not active


SQL> alter database recover managed standby database finish;

Database altered.

SQL> alter database commit to switchover to primary with session shutdown;

Database altered.


[ortnbtyi@shsebs121db01 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 19.0.0.0.0 - Production on Sat Feb 18 12:03:00 2023
Version 19.14.0.0.0

Copyright (c) 1982, 2021, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       MOUNTED
         3 tnbtyi                         MOUNTED
SQL> alter database open;

Database altered.

SQL> show pdbs;

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 tnbtyi                         READ WRITE NO
SQL> select database_role from v$database;

DATABASE_ROLE
----------------
PRIMARY

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.14.0.0.0
[ortnbtyi@shsebs121db01 ~]$ dgmgrl sys/#Leapfr0og@tansid_p1
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sat Feb 18 12:12:39 2023
Version 19.14.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "TANSID_P1"
Connected as SYSDBA.
DGMGRL> show configuration;

Configuration - tansid_dgcnf

  Protection Mode: MaxPerformance
  Members:
  tansid_p1 - Primary database
    tansid_p2 - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 56 seconds ago)

Few more steps in case of issues:

When attempting to open the Primary Database you may suffer the following error:

SQL> alter database open

*

ERROR at line 1:

ORA-16649: possible failover to another database prevents this database being opened

 

In this case, before you can open the database, you must disable Data Guard Broker as follows:

 SQL> alter system set dg_broker_start=false scope=both;

 System altered.

 

SQL> alter database open;

 Database altered.

 

Need to re-install Data Guard Broker after that.


Comments

Popular posts from this blog

How to fix Oracle SQL Developer connection issue "Got minus one from a read call"

How to troubleshoot Long Running Concurrent Request in EBS 12.2

Few Important steps of Oracle Database Clone