Perform a failover after losing the primary (DGMGRL)
OracleData GuardCommand
# Connect to the standby (the primary is unreachable):
dgmgrl sys@<standby_db_unique_name>
# 1) Assess the data that will be lost (Transport Lag / Apply Lag):
SHOW DATABASE '<standby_db_unique_name>';
# 2) Complete failover: all received redo is applied, then the role changes (recommended)
FAILOVER TO '<standby_db_unique_name>';
# 3) Emergency: immediately, without applying redo (more data loss)
# FAILOVER TO '<standby_db_unique_name>' IMMEDIATE;
SHOW CONFIGURATION;What it does
Promotes the standby to the primary role when the primary is unavailable; a complete failover first applies all received redo, IMMEDIATE skips apply.
When to use it
When the primary site, storage or database is lost beyond recovery and the RTO does not allow waiting for a switchover.
Caution
This role change is irreversible. First make sure the primary is REALLY down; if the old primary stays open and the application keeps writing to it, you get split-brain and divergent data (shut down/isolate the old primary). In MaxPerformance mode you lose as much data as the transport lag. Afterwards review all standbys and the backup strategy for the new primary.
Related
- Show the Data Guard broker configuration and database status (DGMGRL)
- Check primary/standby role and switchover readiness with SQL
- Measure transport/apply lag, apply rate and Data Guard processes on the standby
- Validate the standby with the broker before switchover/failover (VALIDATE DATABASE)
- Perform a planned switchover (DGMGRL, role change without data loss)
- Recover the old primary as a standby after a failover (REINSTATE)