How to reinstate the old Primary as a Standby after Failover in Oracle

reinstate the old Primary

In this practice, we reinstate the old primary as a standby after failover in oracle. Currently, my primary database name "digital" is still active.

Note

Before performing the activity, you should enable the FLASHBACK and then complete the training.

My Environment:

For this practice below are my environment details:

Primary Database:

The primary database name is DIGITAL.

Standby Database:

The Standby database name is DIGIDR.

Check the MRP process on Standby

Before doing anything let's check the MRP process on the STANDBY machine.

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

As per the above screenshot, MRP and RFS processes are running.

Failover

To start this activity, I'm going to perform a failover on the primary database.

Step 1: Shutdown the PRIMARY Database

SQL> alter system switch logfile;
SQL> archive log list
SQL> shu immediate
alter system switch logfile

Step 2: Check the MRP process again

After the shutdown of the PRIMARY database, check the MRP processes again on STANDBY.

SQL> select sequence#,process,status from v$managed_standby;
MRP process

As you can see, this time RFS is not running on the STANDBY server.

Step 3: Connect with DG Broker on Standby

Let's connect with DG Broker on the Standby machine using the following command and check the database configuration.

$dgmgrl sys/Rider#123
DGMGRL> show configuration
dgmgrl sys/Rider#123

In the above screenshot, you can see there is an error "ORA-1034: ORACLE not available" with the PRIMARY database.

Step 4: START FAILOVER

Perform failover using DG broker, use the below query:

DGMGRL> failover to digidr;
failover to digidr

After failover, now "digidr" is the primary database.

DGMGRL> show configuration
show configuration

After failover, you can see the log sequence number is reset and started from 1, as you can check in the below screenshot.

archive log list

Reinstate the old Primary

Let's reinstate the old primary database using the below steps.

Step 5: Start the old Primary till mount

To perform reinstate start the old primary till mount stage.

$sqlplus / as sysdba
SQL> startup mount
start database till mount

After mounting check the database role.

reinstate the old Primary

As per the above screenshot, the DIGITAL database role is PRIMARY. But in the Data Guard environment, we can maintain only one Primary, and right now the DIGIDR is our Primary database.

Step 6: Reinstate Database

Now, this is the time to reinstate the database using the following command.

DGMGRL> reinstate database digital;
reinstate database digital

Let's check the database configuration now.

DGMGRL> show configuration
reinstate the old Primary

Now you can see the error is removed and the DIGITAL database becomes a physical standby database.

SQL> select sequence#,process,status from v$managed_standby;
reinstate the old Primary

I hope now you have successfully, completed the activity, and now you can switchover back. For more details watch the below video.

One thought on “How to reinstate the old Primary as a Standby after Failover in Oracle

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top