Skip to main content

Failover vs Switchover in Oracle 19c Data Guard: A Practical How-To

High availability and disaster recovery are critical components of any enterprise database environment. Oracle Data Guard provides robust features to ensure data protection and business continuity. In this post, we'll walk through the practical steps to perform a switchover and failover in an Oracle 19c Data Guard setup, highlighting the differences between the two and when to use each.

Switchover 

A switchover is a planned role reversal between the primary and standby databases. It is done without data loss and is typically used during maintenance or upgrades.

Failover 

A failover is an unplanned transition of the standby database into the primary role due to a failure or disaster affecting the original primary database and it can lead to some data loss.  

After failover, the old primary can’t be used unless reinstated or recreated.

How-To Switchover
Precheck:
The most critical indicator for switchover is that the configuration reports "Ready for Switchover: Yes".  

[oracle@server-graz dbs]$ dgmgrl sys/*****
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sun Jun 15 19:12:37 2025
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "graz"
Connected as SYSDBA.
DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  graz     - Primary database
    salzburg - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 45 seconds ago)

DGMGRL> validate network configuration for all;
Connecting to instance "graz" on database "graz" ...
Connected to "graz"
Checking connectivity from instance "graz" on database "graz to instance "salzburg" on database "salzburg"...
Succeeded.
Connecting to instance "salzburg" on database "salzburg" ...
Connected to "salzburg"
Checking connectivity from instance "salzburg" on database "salzburg to instance "graz" on database "graz"...
Succeeded.

Oracle Clusterware is not configured on database "graz".
Connecting to database "graz" using static connect identifier "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server-graz)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=graz_DGMGRL)(INSTANCE_NAME=graz)(SERVER=DEDICATED)(STATIC_SERVICE=TRUE)))" ...
Succeeded.
The static connect identifier allows for a connection to database "graz".

Oracle Clusterware is not configured on database "salzburg".
Connecting to database "salzburg" using static connect identifier "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.20)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=salzburg_DGMGRL)(INSTANCE_NAME=salzburg)(SERVER=DEDICATED)(STATIC_SERVICE=TRUE)))" ...
Succeeded.
The static connect identifier allows for a connection to database "salzburg".

DGMGRL> validate database verbose salzburg;

  Database Role:     Physical standby database
  Primary Database:  graz

  Ready for Switchover:  Yes       <<<<<IMPORTANT!!!!!!
  Ready for Failover:    Yes (Primary Running)

  Flashback Database Status:
    graz    :  On
    salzburg:  On

  Capacity Information:
    Database  Instances        Threads
    graz      1                1
    salzburg  1                1

  Managed by Clusterware:
    graz    :  YES
    salzburg:  YES

  Temporary Tablespace File Information:
    graz TEMP Files:      1
    salzburg TEMP Files:  1

  Data file Online Move in Progress:
    graz:      No
    salzburg:  No

  Standby Apply-Related Information:
    Apply State:      Running
    Apply Lag:        0 seconds (computed 1 second ago)
    Apply Delay:      0 minutes

  Transport-Related Information:
    Transport On:  Yes
    Gap Status:    No Gap
    Transport Lag:  0 seconds (computed 1 second ago)
    Transport Status:  Success

  Log Files Cleared:
    graz Standby Redo Log Files:      Cleared
    salzburg Online Redo Log Files:   Cleared
    salzburg Standby Redo Log Files:  Available

  Current Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (graz)                  (salzburg)
    1         3                       4                       Sufficient SRLs

  Future Log File Groups Configuration:
    Thread #  Online Redo Log Groups  Standby Redo Log Groups Status
              (salzburg)              (graz)
    1         3                       4                       Sufficient SRLs

  Current Configuration Log File Sizes:
    Thread #   Smallest Online Redo      Smallest Standby Redo
               Log File Size             Log File Size
               (graz)                    (salzburg)
    1          200 MBytes                200 MBytes

  Future Configuration Log File Sizes:
    Thread #   Smallest Online Redo      Smallest Standby Redo
               Log File Size             Log File Size
               (salzburg)                (graz)
    1          200 MBytes                200 MBytes

  Apply-Related Property Settings:
    Property                        graz Value               salzburg Value
    DelayMins                       0                        0
    ApplyParallel                   AUTO                     AUTO
    ApplyInstances                  0                        0

  Transport-Related Property Settings:
    Property                        graz Value               salzburg Value
    LogShipping                     ON                       ON
    LogXptMode                      ASYNC                    ASYNC
    Dependency                                        
    DelayMins                       0                        0
    Binding                         optional                 optional
    MaxFailure                      0                        0
    ReopenSecs                      300                      300
    NetTimeout                      30                       30
    RedoCompression                 DISABLE                  DISABLE

DGMGRL>

How-To Switchover


DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  graz     - Primary database
    salzburg - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 35 seconds ago)

DGMGRL> switchover to salzburg;
Performing switchover NOW, please wait...
Operation requires a connection to database "salzburg"
Connecting ...
Connected to "salzburg"
Connected as SYSDBA.
New primary database "salzburg" is opening...
Oracle Clusterware is restarting database "graz" ...
Connected to "graz"
Connected to "graz"
Switchover succeeded, new primary is "salzburg"
DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  salzburg - Primary database
    graz     - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 52 seconds ago)

How-To Failover

Failover operations are initiated on the standby database. So, log in to the standby host and execute the failover from there.

[oracle@server-salzburg dbs]$ dgmgrl sys/******
DGMGRL for Linux: Release 19.0.0.0.0 - Production on Sun Jun 15 20:53:05 2025
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

Welcome to DGMGRL, type "help" for information.
Connected to "salzburg"
Connected as SYSDBA.
DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  graz     - Primary database
    salzburg - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 49 seconds ago)

DGMGRL> failover to salzburg;
Performing failover NOW, please wait...
Failover succeeded, new primary is "salzburg"
DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  salzburg - Primary database
    graz     - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 53 seconds ago)

Reinstating or Duplicating a Standby after Failover 

Since a failover was performed, the DGMGRL output clearly indicates that the original primary database needs to be reinstated. This is only possible if Flashback Database was enabled prior to the failover. If flashback was not enabled, the only option is to recreate the standby by duplicating the database. After that, a switchover must be performed to restore the original configuration—Graz as the primary and Salzburg as the standby.

Execute the commands on the new primary (salzburg) 

 
DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  salzburg - Primary database
    graz     - Physical standby database (disabled)
      ORA-16661: the standby database needs to be reinstated

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 1 second ago)

DGMGRL> reinstate database graz;
Reinstating database "graz", please wait...
Oracle Clusterware is restarting database "graz" ...
Connected to "graz"
Connected to "graz"
Continuing to reinstate database "graz" ...
Reinstatement of database "graz" succeeded

Final check

We now have a high availability environment once again, with the only difference being that salzburg is the primary and graz is the standby. If desired, we can perform a switchover to restore the original configuration.

DGMGRL> show configuration;

Configuration - stbyconf

  Protection Mode: MaxPerformance
  Members:
  salzburg - Primary database
    graz     - Physical standby database

Fast-Start Failover:  Disabled

Configuration Status:
SUCCESS   (status updated 45 seconds ago)

Comments

Popular posts from this blog

In-Place Upgrade from Oracle Linux 7 to 8 Using LEAPP

Upgrading from Oracle Linux 7 to Oracle Linux 8 is important to keep your system secure, stable, and supported. Oracle Linux 7 is now out of support, which means it no longer receives updates, security patches, or fixes. Moving to Oracle Linux 8 ensures you continue getting updates, new features, and better performance. The LEAPP tool makes this upgrade easier by allowing an in-place upgrade, so you don’t need to reinstall the system from scratch. It checks if your system is ready, identifies potential issues, and helps guide you through the upgrade process. This guide will walk you through the basic steps and requirements to successfully upgrade Oracle Linux 7 to Oracle Linux 8 using LEAPP. Oracle Lifetime Support Policy Regarding upgrading Oracle Linux 7 to Oracle Linux 8, here are a few key points to consider: Review the official documentation thoroughly before starting the upgrade process Ensure you have a complete backup in place, as this is an in-place upgrade and you may n...

Step-by-Step Guide to Renewing OLVM Certificates in Version 4.3

Managing certificates is a critical administrative task in Oracle Linux Virtualization Manager (OLVM) environments, as expired certificates can result in host disconnections, authentication failures, and service disruptions. In this article, we will cover the process of renewing certificates in OLVM version 4.3 before they expire, ensuring secure communication between the engine and managed KVM hosts. For this procedure, we will use the OlvmKvmCerts utility provided by Oracle to renew the required certificates. In OLVM 4.3, although some engine-related certificates can be renewed using the engine-setup command, not all certificates are automatically refreshed. Certain components require manual renewal because the certificate renewal process in this version is not fully automated. It is important to note that this limitation has been addressed in  OLVM 4.4.10.7-1.0.24 and later.  Additionally, OLVM 4.3 has been unsupported since October 2022, and OLVM 4.4 reached end of su...

Oracle 19c: Data Guard Physical Standby Setup Guide

In this blog post, we’ll walk through the process of creating a Data Guard Physical Standby database in Oracle Database 19c, where ASM (Automatic Storage Management) and OMF (Oracle Managed Files) are used for storage management.  Setting up a standby database with Data Guard enhances the high availability, disaster recovery, and data protection capabilities of your Oracle environment.  By leveraging ASM and OMF, we simplify file management and ensure optimal performance and flexibility. This guide provides a step-by-step approach, from preparing the primary database to configuring the standby environment, ensuring a smooth and reliable setup. Environment Overview In this setup, we have two database servers configured for a Data Guard Physical Standby environment: Primary Server : server-graz – This server hosts the primary database named graz . Standby Server : server-salzburg – This server will act as the physical standby. Both servers are configured to use ASM (Au...