Step by Step Guide to Oracle Data Guard Broker (DGMGRL)
Introduction
High availability and predictable disaster recovery are critical in any Oracle production environment. While managing Data Guard manually via SQL*Plus is possible, the number of manual steps during incidents can increase the risk of errors.
Oracle Data Guard Broker (DGMGRL) provides a centralized and automated framework for managing Data Guard configurations. With the Broker, operations like switchover and failover become simple, single-command actions, with built-in validation and status reporting.
This guide walks you through configuring the Broker for a primary and physical standby database pair and performing a switchover test.
Architecture Overview
At the core of the Broker is DMON (Data Guard Monitor), a background process running on every instance in the Data Guard configuration.
DMON Responsibilities: – Coordinates Broker actions – Synchronizes configuration metadata – Handles DGMGRL commands
Key Components: – Primary Database: PRD_SITE – Physical Standby Database: STB_SITE – Management Tool: DGMGRL command-line utility
Logical Flow:
DBA/Client –> DGMGRL –> DMON (PRD_SITE/STB_SITE) –> Configuration & Role Management
Step 1 – Enable the Broker Framework
Enable the Broker on both primary and standby databases:
Connect as SYSDBA
sqlplus / as sysdba
Enable Data Guard Broker
ALTER SYSTEM SET dg_broker_start=TRUE SCOPE=BOTH;
Verify
SHOW PARAMETER dg_broker_start;
EXIT;
Note: Repeat on both PRD_SITE and STB_SITE. Ensure dg_broker_start is TRUE.
Step 2 – Create the Broker Configuration
Initialize the Broker configuration from the primary:
dgmgrl sys/oracle_password@PRD_SITE
CREATE CONFIGURATION ‘DG_DR_CONFIG’ AS
PRIMARY DATABASE IS ‘PRD_SITE’ CONNECT IDENTIFIER IS ‘PRD_SITE’;
SHOW CONFIGURATION;
At this point, the Broker is aware only of the primary database. Next, add the standby.
Step 3 – Add the Standby Database
Register the physical standby:
ADD DATABASE ‘STB_SITE’ AS
CONNECT IDENTIFIER IS ‘STB_SITE’
MAINTAINED AS PHYSICAL;
SHOW CONFIGURATION;
Tip: Ensure that PRD_SITE and STB_SITE service names are resolvable via TNS or Easy Connect.
Step 4 – Enable the Configuration
Activate Broker management:
ENABLE CONFIGURATION;
SHOW CONFIGURATION;
From this point, most Data Guard operations can be managed via DGMGRL instead of manual SQL*Plus commands.
Step 5 – Validation and Health Check
Before any role transition, validate the standby database:
VALIDATE DATABASE ‘STB_SITE’;
-
Checks redo transport and apply status
-
Confirms connectivity and readiness for role change
Important: Resolve any warnings or errors before performing a switchover (network issues, archivelog destinations, apply status).
Step 6 – Switchover Test (Primary ↔ Standby)
Perform a controlled switchover:
SHOW CONFIGURATION;
SWITCHOVER TO ‘STB_SITE’;
SHOW CONFIGURATION;
Result: – Original primary (PRD_SITE) becomes standby – Original standby (STB_SITE) becomes primary – Applications should now point to STB_SITE
Tip: Switchover is a planned role reversal. No data loss occurs when both sides are synchronized.
Conclusion
Using DGMGRL moves you from manual management to a policy-driven, Broker-managed environment.
Key Benefits: – Reduces human error during critical events – Provides consistent validation before role changes – Offers a unified view of configuration health
References
-
Oracle Corporation. Introduction to Oracle Data Guard. Oracle Database Documentation.
-
Oracle Corporation. Oracle Data Guard Broker Concepts. Oracle Database 19c Administrator’s Guide.
-
Oracle Corporation. Scenarios Using the DGMGRL CLI. Oracle Data Guard Broker User’s Guide.
-
Oracle Corporation. Oracle Data Guard Command-Line Interface Reference. Oracle Data Guard Broker User’s Guide.