Introduction
While performing a switchover using Oracle Data Guard Broker, you may encounter the following error:
ORA-16516: current state is invalid for the attempted operationUnable to switchover, primary database is still "PRIMARY"
This error is confusing because everything may appear perfectly configured — zero lag, apply running, and broker showing SUCCESS.
In this blog, we’ll explain the real root cause and exact fix.
The Problem Scenario
You attempt:
DGMGRL> SWITCHOVER TO STANDBY;2026-03-22T08:16:44.263+00:00Performing switchover NOW, please wait...Error: ORA-16516: current state is invalid for the attempted operationFailed.2026-03-22T08:16:44.281+00:00Unable to switchover, primary database is still "PRIMARY"Why This Happens (Real Root Cause)Even if your configuration looks correct:✅ Transport Lag = 0✅ Apply Lag = 0✅ Standby Enabled✅ Primary in READ WRITE👉 The issue is usually:⚠️ Standby is in READ ONLY WITH APPLY mode (Active Data Guard)You can confirm this from:DGMGRL> show database standby;Database - standby Role: PHYSICAL STANDBY Intended State: APPLY-ON Transport Lag: 0 seconds (computed 41 seconds ago) Apply Lag: 0 seconds (computed 41 seconds ago) Average Apply Rate: 5.00 KByte/s Real Time Query: ON Instance(s): ORCLDatabase Status:SUCCESS
Solution (Step-by-Step Fix)
🟢 Step 1: Stop Redo Apply (DGMGRL)
EDIT DATABASE standby SET STATE='APPLY-OFF';
🟢 Step 2: Stop Managed Recovery (SQL)
Login to standby:
sqlplus / as sysdbaALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
🟢 Step 3: Restart Standby in MOUNT Mode
shutdown immediate;startup mount;
🟢 Step 4: Perform Switchover
Back in DGMGRL:
SWITCHOVER TO standby;
But it again fail then we connected to the primary database:
Check the Switch over status on Primary:
SQL> SELECT SWITCHOVER_STATUS FROM V$DATABASE;SWITCHOVER_STATUS--------------------NOT ALLOWED
After checking we verify that our MRP process is running on Standby Server
SQL> SELECT PROCESS, STATUS FROM V$MANAGED_STANDBY;PROCESS STATUS--------- --------------------DGRD ALLOCATEDDGRD ALLOCATEDARCH CONNECTEDARCH CONNECTEDARCH CONNECTEDARCH CONNECTEDMRP0 APPLYING_LOG
MRP0 is running, Then we check the transportaion service on the Primary server and check the paramter value log_archive
Show paramter log_archive_destlog_archive_dest_state_17 string enablelog_archive_dest_state_18 string enablelog_archive_dest_state_19 string enablelog_archive_dest_state_2 string RESETlog_archive_dest_state_20 string enable
Our parameter is in RESET state, we we enable this parameter
SQL> ALTER SYSTEM SET log_archive_dest_state_2=ENABLE;System altered.
Then we check the switchover status from SQLPLUs
SWITCHOVER_STATUS
--------------------
RESOLVABLE GAP
-- After wait for few minutes it change to to standby
SWITCHOVER_STATUS
--------------------
TO STANDBY