Perform Oracle Data Guard Role Transition Using Switchover

on October 1, 2013


What is a role transition? A database can operate in one of two modes in an Oracle Data Guard configuration: primary or standby. When we change the role of either a primary or standby, we call this a role transition. We can use two methods to change the roles: switchover and failover. Which one you use is a very important decision. Choosing the wrong one can result in extra work on the part of the DBA to get the configuration back in sync, although a lot of that work has been eliminated with the advent of Flashback Database.

A switchover allows a primary and standby to reverse roles without any data loss and without any need to re-create the previous primary. In contrast, a failover implies potential data loss and can result in the need for the old primary to be re-created. Switchovers are normally performed for planned maintenance. For example, if the primary host needed to replace a faulty CPU that required downtime, we could perform a switchover and have users automatically redirected to the new primary. The impact to the user base could be greatly reduced, thus increasing our availability.

A switchover can be performed using either a physical or logical standby. However, you should be aware of some issues. If you have a configuration with a primary database, a physical standby, and a logical standby, and you perform a switchover to the logical standby, your physical standby will no longer be a part of the configuration and must be re-created. In the same scenario, if you perform a switchover to the physical standby, the logical standby remains in the configuration and does not need to be re-created. For this reason, a physical standby is a better option for a switchover candidate than a logical standby when multiple standby types exist in the configuration.

The secret to performing a switchover successfully is proper planning and testing. The following is a list of items that you should consider prior to performing a switchover:

  • First and most important, verify that initialization parameters for both the primary and the standby support both roles. Pay special attention to the VALID_FOR attributes to the LOG_ARCHIVE_DEST_n parameter, as this will play greatly into the switchover.
  • Verify that the primary and standby host each have TNS aliases that point to one another and that those aliases function correctly. Also verify that those functioning aliases are used in the LOG_ARCHIVE_DEST_n parameters.
  • For a fast and efficient switchover, disconnect all user connections. If that is not feasible, restrict the user activity as much as possible. It is possible to failover user connection if they have connected via an OCI application and the proper transparent application failover setup has been performed.
  • Verify that both the primary and standby temporary tablespaces are populated with tempfiles.
  • Have the standby, either physical or logical, applying changes from the primary. Verify that the application of redo is current with the primary. Using the Real-Time Apply method will speed up the switchover.

Related Posts

Leave a Reply