Graceful Switchover (Role Reversal)

Graceful Switchover (GS) is also referred to as role reversal or switchover. It is not the same as failover.
Graceful Switchover is used to switch back to the original primary database after a disaster in which the standby database has been activated. 
Graceful Switchover may also be used for planned outages to perform an upgrade on the primary site by switching over the database users to the standby site as hardware or software is upgraded on the primary site. It may also be used to test the Disaster Recovery scenario.
Graceful Switchover can be used on single and RAC databases. It can be used when the redo logs or the archive logs are in regular file system or Oracle ASM file system. 
During a switchover, the primary database transitions to a standby role, and the standby database transitions to the primary role. There is no loss of data during the transition and the standby database does not have to be rebuilt. 
After the planned outage is completed, Graceful Switchover can reverse back to the original state.

Note 1: Always ensure you have a valid backup before initiating Graceful Switchover.
Note 2: Graceful Switchover has been carefully designed so that if it fails for any reason, there will always be a rollback or roll forward path to ensure you are not left with two primary databases or two standby databases.
Note 3: Graceful Switchover supports different structures between the primary and standby database. The standby database files or redo logs may be in different directory structure (mount points) as the primary database and have different file names. The standby database must however have the same number of data files as the primary database. 
Note 4: Graceful Switchover can be initiated through the web interface (GUI) or through the command line (CLI). There is no difference in functionality, however because of the nature of web interfaces using an asynchronous connection, it is recommend to use the command line (CLI) interface when initiating Graceful Switchover in production environments. Through the web interface there is a small possibility of loosing the connection from the web browser to the webserver. In this case the graceful switchover process will continue to function in the background but the output will no longer be displayed in the browser windows. The output can always be seen in the Dbvisit Standby logs on both the primary and standby servers. 

Graceful Switchover overview:

  • Allows planned role reversal between the primary database and one of its standby databases. The primary database transitions to a standby role, and the standby database transitions to the primary role.
  • Is to handle scheduled outages on the primary system without the loss of service.
  • Has been tested on Oracle 8i, 9i, 10g and 11g.
  • Databases will be shutdown temporarily during the transition phase.
  • Temporary data files will be added to the new primary database.
  • Allows only a small interruption of service as users can continue operations on standby database during outage on primary database.
  • Can reverse back to the original state once scheduled maintenance is completed.
  • There is no data loss during the transition.
  • Primary Database online redo logs must be available.
  • It is recommended to test the Graceful Switchover on a test system with similar bandwidth and latency between the primary and standby server as the production systems.
  • The time taken for the switchover to complete depends on the size of the redo logs, the archive logs and the speed of the network between the primary and the standby server.
  • It can be used for normal file system database and ASM file system databases.

Dbvisit Standby Graceful Switchover limitations

In some cases, on Windows the registry setting ORA_DB _{}AUTOSTART needs to be set to FALSE. (where DB is the name of your database) The setting is in: HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE. (Only set this if graceful switchover is not successful initially).

If the database uses ASM, then the ASM instance must be at least Oracle version 11.1. This limitation is only for the ASM instance and not for the database itself.

How the Dbvisit Standby Graceful Switchover process works

  1. Dbvisit Standby checkpoints are used to ensure the process between the primary and standby database are synchronised.
  2. Users should be disconnected from the main primary database.
  3. Dbvisit Standby Graceful Switchover is initiated with a simple command on the primary server and the standby server.
  4. Main primary database is shutdown during transition.
  5. Standby database is shutdown during transition.
  6. Main primary database transitions to standby database on primary server in matter of minutes*.
  7. Standby database transitions to primary database on standby server in matter of minutes*.
  8. Users can re-connect to primary database on standby server and continue working, with no data loss.
  9. Maintenance can proceed on primary server.
  10. Optionally Dbvisit Standby can keep the standby database on the primary server up to date during the scheduled maintenance outage.
  11. At the end of the scheduled maintenance the databases are transitioned back to their original state in matter of minutes*.

*Depending on speed of network and distance between primary and standby server.


Please also see: 


When running Graceful Switchover in a RAC environment

Graceful Switchover (GS) is fully supported in an Oracle RAC environment.

Dbvisit Standby will be run from the primary nodes shipping logs to the standby server.  When the GS process is running, you will execute the GS command from one of the Primary RAC nodes and also on the standby server.

As with the Single Instance GS process, the same unique key must be used on both primary and standby.

It is recommended to always run a log gap report prior to running the GS process so that you can ensure that the Archive Log Gap between the primary and standby is 0 - BUT when using RAC the Archive Log gap can be 1 on one of the RAC threads (this is as you will not always be able to get a 0 archive log gap for all threads.

Perform Graceful Switchover using either GUI or CLI.  If using the GUI - from the Run Interactive Screen select the Database (DDC) and then the Graceful Switchover option in drop down, provide a Unique key and click on next.  If using the CLI - run the command: ./dbv_oraStartStop switchover DDC <unique_key>

Note: you still have to run the switchover step on both the primary node (only one of them) and the standby node using the same unique key.


At the end of the Graceful Switchover where the Oracle RAC environment become the primary again, there will be a message showing you that you can enable the RAC database (all nodes by doing following).

This final step needs to be executed by the Database Administrator as the reason for the GS might have been to add RAC nodes or remove nodes etc.  

1.  Update the cluster_database=true in spfile
2.  Update the cluster_database_instances=X in the spfile - where X is the number of instances you have configured for this RAC database.
3.  Shutdown the instance, then start the Cluster database using the "srvctl" command - srvctl start database -d DB_UNIQUE_NAME