Data Guard Basics: Primary and Standby Databases

Oracle DBA Certification 15 min min read Updated: Nov 16, 2026 Advanced
Data Guard Basics: Primary and Standby Databases
Advanced Topic 1 of 4

What is Data Guard?

Data Guard keeps one or more standby databases in sync with the primary by sending it the redo. If the primary fails, a standby takes over in minutes, with little or no data loss.

Simple example: The primary is the main office. The standby is an identical office in another city, receiving a copy of every change. If the main office burns down, staff move to the other office and work continues.

The Parts

PartRole
Primary databaseServes users and generates redo
Standby databaseA copy that continuously applies the redo
Redo transportSends redo from primary to standby (LGWR or ARCn)
Redo apply (MRP)Applies the redo on the standby
Broker (DGMGRL)Command-line tool that manages the configuration

Types of Standby

TypeDescription
Physical standbyExact block-for-block copy, kept by redo apply. The most common.
Active Data GuardPhysical standby that is open read-only while applying redo (extra-cost option)
Logical standbyApplies SQL instead of redo. Rarely used today.

Protection Modes

ModeData lossImpact on primary
Maximum PerformancePossible, tinyNo wait for the standby. Default.
Maximum AvailabilityZero when the standby is reachableCommits wait for the standby (SYNC)
Maximum ProtectionZero, alwaysPrimary shuts down if it cannot reach a standby

Switchover vs Failover

SwitchoverFailover
WhenPlanned (maintenance, patching)Primary is lost
Data lossNoneMaybe, depending on mode
RolesPrimary and standby swapStandby becomes the new primary
Old primaryBecomes a standbyMust be rebuilt or reinstated

Check the Role

sql SELECT name, database_role, open_mode, protection_mode, switchover_status FROM v$database;

Manage with the Broker

bash dgmgrl sys@primary_db DGMGRL> SHOW CONFIGURATION; DGMGRL> SHOW DATABASE standby_db; DGMGRL> VALIDATE DATABASE standby_db; DGMGRL> SWITCHOVER TO standby_db; -- planned DGMGRL> FAILOVER TO standby_db; -- emergency

Is the Standby in Sync?

sql -- on the standby SELECT name, value, time_computed FROM v$dataguard_stats WHERE name IN ('transport lag','apply lag');
Monitor: Alert when apply lag passes a few minutes. A standby that is hours behind is not a safe disaster plan.

Setup Steps (Overview)

  1. Primary runs in ARCHIVELOG with force logging: ALTER DATABASE FORCE LOGGING;
  2. Create standby redo logs on both sides.
  3. Duplicate the primary with RMAN DUPLICATE ... FOR STANDBY FROM ACTIVE DATABASE.
  4. Configure redo transport and start redo apply.
  5. Create the broker configuration.
Practice: Data Guard needs two servers or containers. Oracle Free is limited, so practice the broker commands in a lab or in Oracle Cloud, and read the Data Guard Concepts guide for the full setup.

Conclusion

Data Guard keeps a live copy of your database elsewhere. Know the three protection modes, the difference between switchover and failover and watch lag.

Quick Summary: Standby = copy fed by redo. Switchover = planned swap. Failover = emergency takeover.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators