Search the Site

Sponsors

bottom corner

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

This sample provides a very quick step-by-step guide on how to use the Oracle Data Guard Command-Line Interface (dgmgrl) to perform a switchover or a failover between two Oracle 11g databases set up as primary and standby servers.

This page is filed under keyword(s): oracle.

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.

[oracle@host1 ~]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@orcl1
Password:
Connected.

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.

DGMGRL> switchover to orcl2
Performing switchover NOW. Please wait...
Operation requires shutdown of instance "orclsid" on database "orcl1".
Shutting down instance "orclsid"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires shutdown of instance "orclsid" on database "orcl2".
Shutting down instance "orclsid"...
database not mounted
ORACLE instance shut down.
Operation requires startup of instance "orclsid" on database "orcl1".
Starting instance "orclsid"...
ORACLE instance started.
Database mounted.
Operation requires startup of instance "orclsid" on database "orcl2".
Starting instance "orclsid"...
ORACLE instance started.
Database mounted.
Switchover succeeded. New primary is "orcl2"

And in the case of a failover...

DGMGRL> failover to orcl2
Performing failover NOW, please wait...
Failover succeeded, new primary is "orcl2"

To confirm Data Guard switchover or failover has completed successfully, log in to Data Guard Command-Line Interface and issue the "show configuration" command.

[oracle@host2 ~]$ dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys@orcl2
Password:
Connected.
DGMGRL> show configuration

Configuration
  Name:                DRSolution
  Enabled:             YES
  Protection Mode:     MaxAvailability
  Databases:
    orcl2 - Primary database
    orcl1 - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DRSolution":
SUCCESS

The above sample shows what the display would look like after a switchover. In the case of a failover, the physical standby database will show as "disabled" as below.

DGMGRL> show configuration

Configuration
  Name:                DRSolution
  Enabled:             YES
  Protection Mode:     MaxAvailability
  Databases:
    orcl2 - Primary database
    orcl1 - Physical standby database (disabled)

Fast-Start Failover: DISABLED

Current status for "DRSolution":
Warning: ORA-16608: one or more databases have warnings

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.

DGMGRL> reinstate database orcl1
Reinstating database "orcl1", please wait...
Operation requires shutdown of instance "orclsid" on database "orcl1"
Shutting down instance "orclsid"...
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "orclsid" on database "orcl1"
Starting instance "orclsid"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "orcl1" ...
Operation requires shutdown of instance "orclsid" on database "orcl1"
Shutting down instance "orclsid"...
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
Operation requires startup of instance "orclsid" on database "orcl1"
Starting instance "orclsid"...
ORACLE instance started.
Database mounted.
Continuing to reinstate database "orcl1" ...
Reinstatement of database "orcl1" succeeded

Did you find this page useful? Please consider browsing other articles or subscribing to the RSS feed to keep up with latest.

This page is filed under keyword(s): oracle.
Author: C. Peter Chen
Last updated: 29 Sep 2008

bottom corner