Oracle Manual DB Switchover: Primary to Standby with DGMGRL

A switchover in Oracle Data Guard is a planned role reversal between the primary and standby databases, ensuring minimal downtime. This guide provides a step-by-step process to manually switch from the primary database to a physical standby database using DGMGRL in Oracle.

Prerequisites

Before performing the switchover, ensure the following:

  • Data Guard is properly configured between the primary and standby databases.
  • Both databases are in sync.
  • You have SYSDBA privileges.

Step 1: Set the ORACLE_SID

Before using DGMGRL, set the ORACLE_SID to match your database instance:

Step 2: Connect to DGMGRL

Run the following command to connect to DGMGRL as SYSDBA:

dgmgrl sys/<PASSWORD>@<PRIMARY_DB>

Step 3: Validate the Database Readiness

Run the following command to connect to DGMGRL as SYSDBA:

DGMGRL> validate database <PRIMARY_DB>;

Expected output should confirm:

Database Role: Primary database
Ready for Switchover: YES
Managed by Clusterware: YES

Step 4: Perform the Switchover

Execute the following command in DGMGRL:

DGMGRL> switchover to <STANDBY_DB>;

Expected Output:

Performing switchover NOW, please wait...
Operation requires a connection to database "<STANDBY_DB>"
Connecting ...
Connected to "<STANDBY_DB>"
Connected as SYSDBA.
New primary database "<STANDBY_DB>" is opening...
Oracle Clusterware is restarting database "<PRIMARY_DB>" ...
Connected to "<PRIMARY_DB>"
Switchover succeeded, new primary is "<STANDBY_DB>"

What Happens During This Step?

  • The command switches roles between primary and standby.
  • Oracle connects to the target standby database.
  • The new primary database is opened.
  • The former primary is converted into a standby database.

Step 5: Verify the Switchover

Ensure that:

  • The former standby is now the primary.
  • The former primary is now the standby.

Step 6: Update OND Hostnames

If your environment uses OND hostnames, update them accordingly to reflect the new primary and standby servers.

Additional Considerations

  • If you encounter issues, check the alert logs and Data Guard broker logs.
  • If using Fast-Start Failover (FSFO), ensure it is properly reconfigured.

Conclusion

Performing a manual switchover in Oracle Data Guard ensures seamless role transitions between databases. This method is useful for maintenance activities, disaster recovery testing, and planned database role changes.

Leave a Reply

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