Data Guard Broker is a
command-line interface that makes managing primary and standby databases easy.
DBA can use a single command to switch from primary and standby and vice versa.
Several pre-defined commands can
be used to manage Data Guard. Data guard configuration is one of the steps in
the primary and standby database setup.
The steps below will describe the
configuration and other uses
Step 1: Add the configuration
file to both the databases (primary/standby)
Configuration files save the
status of the primary and standby database
SQL> show parameter
DG_BROKER_START
NAME TYPE VALUE
-----------------------------------
----------- --------------------
dg_broker_start boolean TRUE
SQL> ALTER SYSTEM SET
DG_BROKER_START=FALSE;
System altered.
SQL> alter system set
dg_broker_config_file1='/u01/oracle/prim_db/dguard/dg1_prim_db.cfg' scope=both;
System altered.
SQL> alter system set
dg_broker_config_file2='/u01/oracle/prim_db/dguard/dg2_prim_db.cfg' scope=both;
System altered.
Perform similar steps on the
Standby side as well
Step 2: Set up of
DG_BROKER_START parameter on the primary and standby databases
SQL> ALTER SYSTEM SET
DG_BROKER_START=TRUE SCOPE=BOTH;
System altered.
SQL> show parameter
DG_BROKER_START
NAME TYPE VALUE
----------------------------------
----------- --------------------
dg_broker_start boolean TRUE
Step 3: Set up local listener
parameters on the primary and the standby.
Primary-> alter
system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST
=prim_server.pfizer.com)(PORT = 1522))' scope=both;
Standby-> alter
system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST
=standby_server.pfizer.com)(PORT = 1522))' scope=both;
Step 4: DGMGRL configuration
Connect to primary db through
dgmgrl
prim_server.pfizer.com-prim_db $
dgmgrl /
DGMGRL for Linux: Release
19.20.0.0.0 - Production on Wed Apr 09 04:52:13 2025
Copyright (c) 1982, 2023, Oracle
and/or its affiliates. All rights reserved.
Welcome to DGMGRL, type
"help" for information.
Connected to "prim_db"
Connected as SYSDG.
DGMGRL> create configuration
prim_db_conf as Primary Database is 'prim_db' connect identifier is
prim_db.pfizer.com;
Configuration
"prim_db_conf" created with primary database "prim_db"
DGMGRL>
DGMGRL> ADD DATABASE
'standby_db' AS CONNECT IDENTIFIER IS standby_db.pfizer.com MAINTAINED AS
PHYSICAL;
Database "standby_db"
added
DGMGRL>
DGMGRL> enable configuration;
Enabled.
DGMGRL> show configuration;
Configuration - prim_db_conf
Protection Mode:
MaxPerformance
Members:
prim_db - Primary
database
standby_db - Physical
standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS (status
updated 4 seconds ago)
Output should be SUCCESS; if not,
we need to rectify the issues.
Step 5: Monitor and
manage and Data Guard Broker configuration
Check configuration status:
DGMGRL> show configuration;
Check configuration details of
each database
DGMGRL> show database 'prim_db';
DGMGRL> show database
'standby_db';
Enable or Disable configuration
for individual database
DGMGRL> enable database
'prim_db';
DGMGRL> disable database
'standby_db';
Useful Commands in DGMGRL
CREATE CONFIGURATION
ADD DATABASE
EDIT DATABASE
SHOW DATABASE
ENABLE CONFIGURATION
SWITCHOVER TO
FAILOVER TO