Perform a planned switchover (DGMGRL, role change without data loss)
OracleData GuardCommand
# Connect with a password (with OS authentication "/" the broker cannot restart the remote instance):
dgmgrl sys@<primary_db_unique_name>
# 1) Precheck:
SHOW CONFIGURATION;
VALIDATE DATABASE '<standby_db_unique_name>';
# 2) Role change:
SWITCHOVER TO '<standby_db_unique_name>';
# 3) Verify: new primary and new standby
SHOW CONFIGURATION;
SHOW DATABASE '<primary_db_unique_name>';What it does
Swaps the roles of the primary and the standby in a controlled way: all primary redo is shipped and applied on the standby, the old primary restarts as a standby and redo apply starts automatically.
When to use it
For planned maintenance at the primary site (OS, hardware, rolling upgrade), DR drills or data center moves.
Caution
The primary has a short outage; application connections must be routed to the new primary through services defined with -role PRIMARY and FAN/TAF/AC. Long-running transactions and high apply lag lengthen the switchover; bring the lag close to zero first. In RAC the broker manages the instances itself; do not intervene with srvctl.
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 failover after losing the primary (DGMGRL)
- Recover the old primary as a standby after a failover (REINSTATE)