About Me

Sunday 9 October 2011

Data guard broker overview and configuration

DATAGUARD BROKER


The Oracle Data Guard broker is a distributed management framework that automates and centralizes the creation, maintenance, and monitoring of Data Guard configurations.

          The following list describes some of the operations the broker automates and simplifies-

·         Creating Data Guard configurations that incorporate a primary database, a new or existing (physical, logical, or snapshot) standby database, redo transport services, and log apply service.
·         Adding additional new or existing (physical, snapshot, logical) standby databases to an existing Data Guard configuration, for a total of one primary database, and from 1 to 9 standby databases in the same configuration.
·         Managing an entire Data Guard configuration, including all databases, redo transport services, and log apply services, through a client connection to any database in the configuration.
·         Managing the protection mode for the broker configuration.
·         Invoking switchover or failover with a single command to initiate and control complex role changes across all databases in the configuration.
·         Configuring failover to occur automatically upon loss of the primary database, increasing availability without manual intervention.
·         Monitoring the status of the entire configuration, capturing diagnostic information, reporting statistics such as the redo apply rate and the redo generation rate, and detecting problems quickly with centralized monitoring, testing, and performance tools.

The broker supports one or more Data Guard configurations, each of which includes a profile for one primary database and for up to nine physical or logical, standby databases.
A supported broker configuration consists of following objects-

·         A configuration object, which is a named collection of database profiles. A database profile is a description of a database object including its current state, current status, and properties. The configuration object profiles one primary database and up to nine standby databases that can include a mix of both physical and logical standby databases. The databases of a given configuration are typically distributed across multiple host systems.
·         Database objects, corresponding to primary or standby databases. The broker uses a database object's profile to manage and control the state of a single database on a given system. The database object may be comprised of one or more instance objects if this is a RAC database.
·         Instance objects. The broker treats a database as a collection of one or more named instances. The broker automatically discovers the instances and associates them with their database.

       



         Configuration of broker
                                                                                                             
Production

Hostname=dba15
SID=newdb
Db_name=newdb
Db_unique_name=north



Standby
Hostname=dba21
SID=newdb
Db_name=newdb
Db_unique_name=south

Both production and standby databases are running with spfile
Listener at production is prod
Tnsnames at standby is to_prod
Listener at standby is standby
Tnsnames at production is to_stand


Pfile of production database

Undo_retention=3600
Undo_management=auto
Db_flashback_retention_target=4320
Db_recovery_file_dest_size=500m
Db_recovery_file_dest=/disk1/oradata/newdb/flash


Archive log mode and flashback is enabled on both the primary and standby

Create standby log files on both primary and standby databases

SYS> alter database add standby  logfile
        Group 3 ‘/disk1/oradata/newdb/std3.log’ size 4m,
        Group 4 ‘/disk1/oradata/newdb/std4.log’;


Create spfile from pfile;
( on both primary and standby databases)

SYS> Alter system set dg_broker_start=true;
 ( on both primary and standby databases)


Start the data guard broker commad line interface
At primary side
Dba15  ~]$ dgmgrl
DGMGRL> connect sys/sys
DGMGRL> create configuration wstdg as
               Primary database is north
               Connect identifier is to_prod;

Note : connect identifier is the tnsname through which the broker connects to the particular database.

DGMGRL> add database south as
Connect identifier is to_stand;

DGMGRL> SHOW CONFIGURATION;
DGMGRL> ENABLE CONFIGURATION;
DGMGRL> ENABLE DATABASE SOUTH;
DGMGRL> SHOW DATABASE SOUTH;
DGMGRL> SHOW CONFIGURATION;

Coverting a physical standby database to a snapshot standby database

DGMGRL > CONVERT DATABASE SOUTH TO SNAPSHOT STANDBY;

(Need to restart the standby database)

DGMGRL > CONVERT DATABASE SOUTH TO PHYSICAL STANDBY;


Enable the fast_start failover and start the observer

Set the FastStartFailoverTarget configuration property

DGMGRL> EDIT DATABASE  NORTH SET  PROPERTY
             FastStartFailoverTarget= SOUTH;

There is no need to set this property on the target standby as this is done automatically.


DATAGUARD OBSERVER :
Observer is a utility that is available with the dataguard. Its basic purpose is to keep the
database available to the clients all the time. It is started on a separate location other than
Primary and Standby locations. After starting the observer, it starts watching
continuously both the sites. Whenever the PRIMARY database fails due to any reason
and the connection between the PRIMARY site and the observer breaks, the observer
waits for a certain time which is set up during setting the broker configuration. When this
time passes, the observer automatically starts the failover process. As a result, the
Physical Standby database is converted to PRIMARY database. After this failover, the
users again connect to the database. This connection redirects them automatically to the
new PRIMARY database.

Take another server dba12 ( other than primary and standby) to start the observer
Configure tnsnames.ora file


Dba12 ~]$ dgmgrl
DGMGRL> connect sys/sys@to_prod
DGMGRL> START OBSERVER
Observer started

(we will not get the prompt after issuing the command)

The primary side
Dba15 ~]$ dgmgrl
DGMGRL> connect sys/sys
DGMGRL> ENABLE FAST_START FAILOVER;
DGMGRL> SHOW FAST_START FAILOVER;

Performing a switchover operation

Ensure that the state of the primary and standby databases are Transport-on and apply-on, respectively.

Check the primary database
DGMGRL> SHOW DATABASE VERBOSE NORTH;
Check the standby database
DGMGRL> SHOW DATABASE VERBOSE SOUTH;

Issue the switchover command to swap the roles of the primary and standby databases
DGMGRL> SWITCHOVER TO SOUTH;

(the broker automatically shuts down and restarts the old primary database as part of the switchover )
(switchover succeeded , new primary is SOUTH)
DGMGRL> SHOW CONFIGURATION;




No comments:

Post a Comment