Monday, February 23, 2026

Oracle Data Guard Broker Failover

 

Perform smooth  failover with Data Guard Broker.

Data Guard Broker Failover


A failover is when you have lost primary database. It’s very simple to perform failover using data guard broker.

Crash Primary Database (Simulate)

Let us simulate failure. We will kill the PMON process at OS level on primary


On primary:

===========

ps -ef|grep pmon

 

oracle   16914     1  0 14:03 ?        00:00:00 ora_pmon_test

oracle   17722 15893  0 15:08 pts/0    00:00:00 grep pmon

 

kill -9 16914 



Failover to Standby


Connect to standby database test_s (as primary crashed or not available) and failover to standby test_s


On standby:

===========

dgmgrl sys/sys@test_s

 

DGMGRL> show configuration;

DGMGRL> FAILOVER TO test_s;

Performing failover NOW, please wait...

Failover succeeded, new primary is "test_s"

 

DGMGRL> show configuration;



Rebuild Primary After Failover


Post failover, there are two methods of rebuilding your failed primary

  • Method 1: Rebuild from scratch –> RMAN duplicate
  • Method 2: Flashback database –> only if Flashback was enabled

Reinstate failed primary: When you use data guard broker, with just one command, the primary can be rebuilt. Start the failed primary server, in this case start test server


on Crush Server

===========

Su - oracle

lsnrctl start listener

sqlplus / as sysdba

startup mount;



On current primary (test_s):

===============================

dgmgrl sys/sys@test_s

 

DGMGRL> show configuration;


DGMGRL> reinstate database test;   ------>>>>After a failover, the old primary database (TEST) is marked as failed.

The reinstate command automatically:

  • Flashbacks the old primary
  • Converts it into a standby
  • Rejoins it to the Data Guard configuration

👉 In simple words:
It brings the old primary back as a standby after failover.




Continuing to reinstate database "test" ...

Reinstatement of database "test" succeeded


Verify test post reinstate: The best part is broker will automatically recover earlier failed primary test, mount the database and start MRP too


On failed primary (test):

===========================


select name,open_mode from v$database;

select process, status, sequence# from v$managed_standby;


Switchover to get original configuration: At this stage, you can perform switchover to again get back original configuration


On current primary (test_s):

===============================

dgmgrl sys/sys@test_s

DGMGRL> switchover to test;

 



No comments:

Post a Comment

Please do not enter any spam link in the comments

Logical Standby in Oracle Data Guard Overview

  In Oracle Data Guard , a Logical Standby Database is a standby database that: Receives redo data from the Primary database Convert...