Oracle Manual Switchover (Primary ➝ Standby) – DGMGRL

ADVERTISEMENT

A switchover is a planned role reversal between a primary and its standby database in a Data Guard configuration. It allows the standby database to assume the primary role without data loss, typically for maintenance or disaster recovery testing. This operation is performed while both databases are available and synchronized.

1. Prerequisites

Ensure the following before initiating the switchover:

  • Data Guard Broker is configured and working
    dgmgrl> show configuration should display SUCCESS for all members.
  • Databases are synchronized
    No transport/apply lag or errors — check with show database <db_name>.
  • SYSDBA access is available
    You must connect to DGMGRL as a SYSDBA user.
  • Correct ORACLE_SID is set in the environment
    Use echo $ORACLE_SID and set with export ORACLE_SID=<PRIMARY_SID> if needed.

2. Prepare & Validate Environment

# Set ORACLE_SID to primary DB instance
export ORACLE_SID=<PRIMARY_SID>

# Connect to DGMGRL using SYSDBA
dgmgrl sys/<password>@<PRIMARY_TNS>

# Validate the primary database
validate database <PRIMARY_DB>;

Ensure the output shows:

  • Role: Primary
  • Ready for Switchover: YES
  • Managed by Clusterware: YES

3. Perform the Switchover

-- Initiate switchover to the standby database
switchover to <STANDBY_DB>;

DGMGRL will connect to the standby, switch roles, open the new primary, and restart the former primary as standby.

Sample 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>"

This confirms:

  • DGMGRL connected to both databases
  • Role reversal was completed
  • New primary opened, and old primary restarted as standby

4. Post-Switchover Checks

-- View current configuration and database roles
show configuration;
show database <NEW_PRIMARY_DB>;
show database <NEW_STANDBY_DB>;

Confirm both databases show SUCCESS and correct roles (Primary / Physical Standby).

5. Update OND Hostnames (If Applicable)

If your system uses OND hostnames, update them to reflect the new primary and standby roles.

6. Additional Notes

-- Check Fast-Start Failover (FSFO) status
show fast_start failover;

-- Re-enable FSFO if required
enable fast_start failover;
  • Always review alert.log and drc.log for any warnings or errors.
  • Ensure applications or monitoring tools are aware of the role change.

ADVERTISEMENT