how to Activate Standby Database as Primary after Failover

Activate Standby Database as Primary after Failover

When it comes to database management, the ability to failover to a standby database is an essential feature for high availability and disaster recovery. In the event of a failure in the primary database, the standby database can take over as the new primary database. (Activate Standby Database as Primary after Failover)

However, once the issue with the primary database has been resolved, it's important to know how to activate the standby database as the new primary database. In this post, we'll go over the steps involved in activating a standby database as the new primary after a failover.

Activate Standby Database as a Primary after Failover

Using the below steps you can easily activate the standby database as a primary database after failover.

Step 1: Verify the Status of the Failed Primary Database

Before promoting the standby database to the new primary database, it's important to verify that the issue with the original primary database has been resolved. Ensure that the failed primary database is offline and unavailable before proceeding.

Step 2: Determine the Status of the Standby Database

Confirm that the standby database is in a synchronized state and ready to be promoted to the new primary database. Check the database logs and verify that the standby database has received all the necessary transactions from the failed primary database.

Step 3: Perform a Role Transition on the Standby Database

Using the below commands the standby database will take place of the Primary Database.

Check the MRP Process

Once the primary database failed, the RFS process will stop on standby as you can see in the below output:

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

 SEQUENCE# PROCESS   STATUS
---------- --------- ------------
         0 ARCH      CONNECTED
         6 ARCH      CLOSING
         0 DGRD      ALLOCATED
         0 DGRD      ALLOCATED
         9 ARCH      CLOSING
         7 ARCH      CLOSING
         8 ARCH      CLOSING
        10 MRP0      APPLYING_LOG

Activate the Standby as Primary

The below commands will help us to convert our Physical standby database into a Primary database.

Read here to know switchover the role

SQL> alter database recover managed standby database cancel;

Database altered.

SQL>
SQL> alter database recover managed standby database finish;

Database altered.

SQL> alter database activate standby database;

Database altered.


SQL> shu immediate

Once successfully performed the above commands, now shutdown the database and startup normally.

SQL> startup
ORACLE instance started.

Total System Global Area 2466250360 bytes
Fixed Size                  9137784 bytes
Variable Size             536870912 bytes
Database Buffers         1912602624 bytes
Redo Buffers                7639040 bytes
Database mounted.
Database opened.

Step 4: Verify the Status of the New Primary Database

Once the standby database has been promoted to the new primary database, verify that it is up and running. Check the database logs and confirm that all necessary transactions have been applied to the new primary database. Ensure that all applications and systems are properly configured to connect to the new primary database.

SQL>  select name,open_mode,database_role from v$database;

NAME      OPEN_MODE            DATABASE_ROLE
--------- -------------------- ----------------
DIGITAL   READ WRITE           PRIMARY

Step 5: Configure the Old Primary Database as a Standby Database

Now we have two options to use our old primary database listed below:

  1. Reinstate the old Primary as a standby
  2. Rebuild the Standby database on the old Primary Machine

Now that the old primary database has been replaced by the standby database, it can be reconfigured as a standby database. This will allow it to receive all necessary transactions from the new primary database and stay synchronized. Configure the old primary database as a standby database by following the necessary steps for your database management system.

Note

In conclusion, activating a standby database as the new primary database after a failover is an important task for maintaining high availability and ensuring business continuity. By following the steps outlined above, you can effectively promote your standby database to the new primary database and ensure that your systems remain up and running in the event of a failure.

Leave a Reply

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

Scroll to Top