Skip to content
DBAExperts
Oracle High availability

How to configure Data Guard for high availability in Oracle

Data Guard keeps a standby copy synchronized with the primary. If the primary fails, you promote the standby and keep operating.

  1. 1

    Prepare the primary database

    Enable force logging and archiving so that every change is sent to the standby.

    ALTER DATABASE FORCE LOGGING;
    ALTER DATABASE ARCHIVELOG;
  2. 2

    Configure the standby redo logs

    The standby needs its own redo logs, one more than the primary's groups and the same size.

    ALTER DATABASE ADD STANDBY LOGFILE ('/u01/oradata/srl01.log') SIZE 200M;
  3. 3

    Create the standby with RMAN

    Duplicate the primary to the standby directly over the network, with no intermediate backup.

    RMAN> DUPLICATE TARGET DATABASE FOR STANDBY FROM ACTIVE DATABASE;
  4. 4

    Enable redo apply

    Start managed recovery so the standby applies the redo as it arrives.

    ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
  5. 5

    Check the lag and test switchover

    Confirm the standby is up to date and rehearse the role change in a controlled window.

    SELECT sequence#, applied FROM v$archived_log ORDER BY sequence# DESC;
    -- With Data Guard Broker:
    DGMGRL> SWITCHOVER TO standby_db;

// common mistake

Configuring Maximum Protection mode without a redundant network can hang the primary if it loses contact with the standby. Choose the mode based on your real tolerance.

// when it's worth an expert

Data Guard requires planning the network, protection modes, and real failover tests. At dba.mx we implement and test high availability at a fixed price.

Book an assessment — from USD $550

This guide is for reference and uses example commands. In production, adapt to your version and test in a safe environment first.