Amit's Oracle DBA Blog
Never stop learning ...!!! Greetings! Welcome to my Oracle DBA blog.
Monday, 5 October 2026
Data Guard Standby Resynchronization Using RMAN RECOVER FROM SERVICE (300+ Archive Lag)
Sunday, 4 October 2026
End-to-End Data Guard Recovery: Standby Controlfile Restore, Catalog, Switch Database to Copy, and MRP Restart
- Run on Standby (SQL*Plus):sql
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
- Run on Standby (SQL*Plus):sql
SHUTDOWN IMMEDIATE; STARTUP NOMOUNT;
- Run on Standby (RMAN):program
rman target / RMAN> RESTORE STANDBY CONTROLFILE FROM SERVICE 'ORCL';What is a Controlfile?
The controlfile contains the database metadata:
- Datafile names and locations
- Redo log file names
- Standby redo log information
- PDB information
- Checkpoint SCNs
- Archive log history
- RMAN repository information
Therefore we restore the latest standby controlfile from Primary.
After restore:
- Run on Standby (RMAN or SQL*Plus):sql
ALTER DATABASE MOUNT;
+DATAC1), you must tell RMAN where the actual physical files live on the standby storage (e.g., +DATAC2).- Run on Standby (RMAN):program
RMAN> CATALOG START WITH '+DATAC2/D2/' NOPROMPT;
(Note: Ensure the trailing slash is included in the path so RMAN scans the directory correctly).
- Run on Standby (RMAN):program
RMAN> SWITCH DATABASE TO COPY;
- Run on Standby (RMAN):program
RMAN> RECOVER STANDBY DATABASE FROM SERVICE 'ORCL';
Exit RMAN once completed successfully.
- Run on Standby (SQL*Plus):
Review your log groups viaSELECT GROUP# FROM V$LOGFILE;and clear them:sqlALTER DATABASE CLEAR LOGFILE GROUP 1; ALTER DATABASE CLEAR LOGFILE GROUP 2; -- Repeat for all standby redo log groups
- Run on Standby (SQL*Plus):sql
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; -- Or if using Real-Time Apply: ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
- Check Data Guard Role and Open Mode:sql
SELECT database_role, open_mode, protection_mode FROM v$database;
SELECT process, status, sequence# FROM v$managed_standby WHERE process LIKE 'MRP%';Oracle Data Guard Switchover and Failover in OCI
Oracle Data Guard Switchover and Failover in OCI
Oracle Data Guard is a high availability and disaster recovery solution that maintains one or more synchronized standby databases for a production (primary) database. In Oracle Cloud Infrastructure (OCI), Data Guard operations such as Switchover, Failover, and Reinstate can be performed using the dbaascli utility, making database role transitions simple and automated.
Environment Details
| Role | DB Unique Name |
|---|---|
| Primary Database | ORCL |
| Standby Database | ORCLDG |
Understanding Oracle Data Guard
Oracle Data Guard protects databases against:
- Hardware failures
- Storage failures
- Site outages
- Planned maintenance activities
- Human errors
A Data Guard configuration consists of:
Primary Database
The production database that receives all read-write transactions.
Physical Standby Database
An exact block-by-block copy of the primary database that continuously receives and applies redo from the primary.
Redo Transport Services
Transfers redo generated on the primary to the standby.
Redo Apply Services
Applies redo on the standby database to keep it synchronized.
Switchover
What is a Switchover?
A Switchover is a planned role reversal between the primary and standby databases with zero or minimal downtime and no data loss.
Common Use Cases
- Operating system patching
- Database upgrades
- Exadata maintenance
- Data center migration
- Planned DR testing
Role Transition
Before Switchover:
Validate:
- Primary Database = ORCL
- Standby Database = ORCLDG
- Protection Mode
- Transport Status
- Apply Status
- Overall Health = SUCCESS
The command performs:
- Synchronizes remaining redo.
- Stops Primary services on ORCL.
- Converts ORCLDG to Primary.
- Converts ORCL to Physical Standby.
- Starts Data Guard services automatically.
Step 5: Monitor Progress
Check operation status:
Objective
Perform a Failover when the Primary database becomes unavailable and then Reinstate the failed Primary database to restore the Data Guard configuration.
Initial Configuration
Before Failover
Step 1: Perform Failover
When to Use Failover
Failover is performed when:
- Primary database is unavailable.
- Server crash.
- Storage failure.
- Site failure.
- Database cannot be recovered within acceptable business timelines.
Unlike Switchover, Failover is an emergency operation.
Execute Failover
Run the following command on the standby environment:
Result of Failover
Before:
Validation After Failover
Connect to ORCLDG and verify:
Step 2: Reinstate the Failed Primary
What is Reinstate?
After a Failover, the original Primary database cannot automatically rejoin the configuration.
Reinstate converts the failed Primary database into a Physical Standby and restores Data Guard protection.
Reinstate Works Only If
✅ Flashback Database is enabled
Without Flashback Database, a full standby rebuild may be required.
Method B: Reinstate Using dbaascli
Connect to the ORCL server.
Set Oracle environment:
--primaryDBUniqueName should point to ORCLDG.Data Guard Standby Resynchronization Using RMAN RECOVER FROM SERVICE (300+ Archive Lag)
Since your standby was lagging by 300+ archive logs, the purpose of this activity was to resynchronize the standby database quickly using in...
-
Installation on Oracle Linux Part-1 OS 1. PREPARING OPERATING SYSTEMS ON BOTH SERVERS It is assumed that you have two servers running on ...
-
How to check Clock synchronization between cluster nodes in RAC RHEL - 7 : Applicable We can use below to check the clock/time synchroniz...
-
GPnP ( Grid Plug and Play ) profile in Oracle RAC The GPnP profile is a XML file located at location <GRID_HOME/gpnp/<hostname>/p...