Oracle 11g Data Guard switchover/failover quick step-by-step guide

Assumptions

In this sample, it is assumed that you already have your Oracle 11g primary database functioning, and have already set up a Oracle 11g physical standby database, and can access them using the Data Guard Command-Line Interface (dgmgrl) utility. The current primary database will be referred to as “orcl1” and the current physical standby database will be referred to as “orcl2”. The SID for both primary and standby is “orclsid”. The current primary host is “host1” and the standby host is “host2”.

Switchover/Failover Procedures

First, launch the Data Guard Command-Line Interface and connect to the database.

Then, issue switchover or failover command depending on your situation. Generally, a switchover is used to willingly pass the role of the primary database to the physical standby database (or, one of the physical standby databases), while a failover is typically done only when a major problem prevents you from normally using the primary database. Below is what you may see when you perform a switch over.

As an additional note, as the former physical standby database of orcl2 is now operating as your new primary database, you may wish to use Enterprise Manager to help you manage orcl2. If that is the case, you will need to perform the following to recreate the DBControl repository to enable Enterprise Manager on host2.

[oracle@host2 ~]$ emca -config dbcontrol db -repos recreate
STARTED EMCA at Sep 29, 2008 2:02:40 PM
EM Configuration Assistant, Version 11.1.0.5.0 Production
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Enter the following information:
Database SID: orclsid
Database Control is already configured for the database orclsid
You have chosen to configure Database Control for managing the database orclsid
This will remove the existing configuration and the default settings and perform a fresh configuration
Do you wish to continue? [yes(Y)/no(N)]:

At this point, you should have your former physical standby database orcl2 running fully as your primary database server.

After a failover, the physical standby database will not be present in your current setup. In the case that the failed database could be brought back, issue the following command in Data Guard Command-Line Interface to reinstate the failed database as a physical standby database.