Oracle 19c Data Guard Switchover Procedure – Step-by-Step Guide

Purpose

This guide describes a step-by-step approach to perform a switchover in an Oracle Data Guard configuration.

Prerequisites

  • Primary and Standby are healthy and synchronized.
  • Both databases are under clusterware control.
  • SYSDBA connectivity is available.
  • Application services are stopped before switchover.

Environment Details

Primary Database:

 PRD_CDB

Standby Database:

 STBY_CDB

Primary Server:

 PRD_NODE1

Standby Server:

 STBY_NODE1

Switchover Procedure (With Actual Output)

STEP 1. Remove DelayMins (if configured)

DGMGRL> connect sys/<password>

DGMGRL> show database PRD_CDB delaymins;

DGMGRL> edit database PRD_CDB set property 'DelayMins'='0';

DGMGRL> show database PRD_CDB delaymins;

Sample Output:

DelayMins = '180'

Property "DelayMins" updated 

DelayMins = '0'

Step 2. Shut Down Application Services

Ensure all application connections to PRD_CDB are stopped.

Step 3. Validate Archive Destinations

SELECT DEST_NAME, STATUS, DESTINATION FROM V$ARCHIVE_DEST WHERE DESTINATION IS NOT NULL;

Step 4. Check Primary Database Status

DGMGRL> SHOW DATABASE 'PRD_CDB';

Sample Output:

Database - PRD_CDB

  Role:               PRIMARY

  Intended State:     TRANSPORT-ON

  Instance(s):

    prd1

    prd2

Database Status:

SUCCESS

Step 5. Check Standby Database Status

DGMGRL> SHOW DATABASE VERBOSE 'STBY_CDB';

Sample Output:

Database - STBY_CDB

  Role:               PHYSICAL STANDBY

  Intended State:     APPLY-ON

  Apply Lag:          0 seconds

  Transport Lag:      (unknown)

  Instance(s):

    stby1 (apply instance)

    stby2

Database Status:

SUCCESS

Step 6. Validate Databases for Switchover

DGMGRL> validate database PRD_CDB;

DGMGRL> validate database STBY_CDB;

Sample Output:

Ready for Switchover:  Yes

Flashback Database:    Off

Managed by Clusterware: YES

Step 7. Perform Switchover

DGMGRL> SWITCHOVER TO STBY_CDB;

Sample Output:

Performing switchover NOW, please wait...

Connected to "STBY_CDB" as SYSDBA.

New primary database "STBY_CDB" is opening...

Oracle Clusterware is restarting database "PRD_CDB" ...

Switchover succeeded, new primary is "STBY_CDB"

Step 8. Post-Switchover Verification

DGMGRL> SHOW CONFIGURATION;

Sample Output:

Configuration Status: SUCCESS

Primary:   STBY_CDB

Standby:   PRD_CDB

Frequently Asked Questions:

1. What is a switchover in Oracle Data Guard?

A switchover is a planned role reversal where the primary database

becomes standby and the standby database becomes primary without

data loss.

2.What conditions must be met before performing a switchover?

  • Standbydatabase must be in sync with primary.
  • RedoApply must be running.
  • No archivegap.
  • DG Broker configuration must be valid.
  • Databases should be ready for switchover (DGMGRL VALIDATE).

3. What does the “VALIDATE DATABASE” command check?

It checks:

  • Database sync status
  • Apply lag and transport lag
  • Archive gaps
  • Flashback availability
  • Clusterware management
  • Whether databases are ready for role transition

4. What is “Apply Lag” and “Transport Lag”?

  • Apply Lag – delay between redo applied on standby vs primary.
  • Transport Lag – delay in redo shipping.

Zero lag is ideal before switchover

5. What do you do if switchover fails halfway?

 

6. How do you check if a DB is ready for switchover?

DGMGRL> VALIDATE DATABASE <db_name>;

7. How do you check Data Guard configuration after switchover?

DGMGRL> SHOW CONFIGURATION;

DGMGRL> SHOW DATABASE <db_name>;

8. What should DBAs check post-switchover?

New primary open read/write

Old primary running as standby

Apply running

Archive log shipping

Services running correctly


Related Posts:


Comments

Popular posts from this blog

How to troubleshoot long running concurrent request in R12.2

JSP Compilation in R12.2

How to run Gather Schema Statistics in R12.2