Oracle Data Guard – Complete Guide for Oracle DBAs
Oracle Data Guard is one of the most important topics for an Oracle Database Administrator working in production environments. It is widely used in banking, financial services, telecom, healthcare and enterprise applications to provide High Availability (HA), Disaster Recovery (DR) and data protection.
This tutorial covers Oracle Data Guard from basic concepts to advanced production-level administration. It includes architecture, background processes, configuration, RMAN commands, SQL commands, DGMGRL commands, monitoring, troubleshooting and scenario-based interview questions.
The examples primarily use Oracle Database 19c syntax. Most concepts also apply to later releases, but always validate commands and features against your installed Oracle version.
Table of Contents
- What is Oracle Data Guard?
- Why do we need Data Guard?
- Data Guard architecture
- Primary and standby database
- Data Guard background processes
- Redo transport and redo apply
- Types of standby databases
- Data Guard protection modes
- Important initialization parameters
- Step-by-step physical standby configuration
- Standby Redo Logs configuration
- Starting and stopping Redo Apply
- Data Guard Broker configuration
- Switchover and failover
- Monitoring commands for Oracle DBAs
- Replication lag and archive gap troubleshooting
- Common production issues and solutions
- Data Guard versus RAC
- Data Guard interview questions and answers
- Advanced scenario-based interview questions
- Daily DBA health-check checklist
- Important commands cheat sheet
1. What Is Oracle Data Guard?
Oracle Data Guard is an Oracle Database high availability and disaster recovery solution.
It maintains one or more synchronized copies of a production database, called standby databases.
The production database is called the Primary Database, and its synchronized copy is called the Standby Database.
When transactions are executed on the primary database, Oracle generates redo information. This redo information is transported to the standby database and applied there.
If the primary database fails, the standby database can take over the production role through a failover operation.
Simple example
Consider a banking organization:
| Database | Location | Role |
| PRODDB | Mumbai Data Center | Primary |
| DRDB | Hyderabad Data Center | Physical Standby |
The production database processes all banking transactions.
The DR database receives redo information from PRODDB and applies it continuously.
If the Mumbai data center becomes unavailable, the DBA can activate DRDB as the new production database.
Important points
- Primary database handles production transactions.
- Standby database maintains a synchronized copy.
- Redo Transport sends redo information.
- Redo Apply applies redo information.
- Switchover performs a planned role transition.
- Failover performs an unplanned role transition.
2. Why Do We Need Oracle Data Guard?
The major objectives are:
High Availability: Reduce database downtime during failures.
Disaster Recovery: Maintain a database at a remote location.
Data Protection: Protect committed transactions against data loss according to the configured protection mode.
Business Continuity: Continue business operations after a database or site failure.
Reporting: Offload read-only workloads to an eligible standby database.
Planned Maintenance: Perform certain maintenance operations with reduced downtime using role transitions.
Real-world banking example
Suppose a banking application processes 10,000 transactions per minute.
If the primary database server crashes, business operations may stop.
With Data Guard, a standby database is available at the DR location. Depending on the protection mode and the redo successfully received, the DBA can perform a failover and restore database services.
3. Oracle Data Guard Architecture
Oracle Data Guard has two major components:
- Redo Transport Services.
- Redo Apply Services.
Architecture flow
Application transactions execute on the primary database.
The redo information is generated and transported to the standby database.
The standby database receives redo information through the RFS process and applies it using Redo Apply.
Simplified architecture:
APPLICATION
|
|
PRIMARY DB
|
Online Redo Logs
|
LGWR / LNS
|
REDO TRANSPORT
|
Network / Oracle Net
|
RFS
|
Standby Redo Logs
|
MRP
|
STANDBY DB
Understand the complete flow
Step 1: Application executes INSERT, UPDATE or DELETE statements on the primary database.
Step 2: Oracle generates redo records.
Step 3: LGWR writes redo from the redo log buffer into online redo logs.
Step 4: Redo transport processes send redo information to the standby database.
Step 5: RFS receives the redo information on the standby.
Step 6: RFS writes received redo into Standby Redo Logs when configured.
Step 7: MRP applies the redo information to the physical standby database.
Step 8: The standby database is synchronized according to the redo transport and apply status.
4. Important Data Guard Terminology
| Term | Meaning |
| Primary Database | Production database |
| Standby Database | Synchronized copy of primary |
| Redo Data | Information required to reproduce database changes |
| Redo Transport | Sending redo from primary to standby |
| Redo Apply | Applying redo on standby |
| Online Redo Logs | Redo logs used by primary |
| Standby Redo Logs | Logs used to receive redo on standby |
| Archive Logs | Archived copies of filled redo logs |
| Switchover | Planned role transition |
| Failover | Unplanned role transition |
| Data Guard Broker | Centralized Data Guard management |
| FAL | Fetch Archive Log mechanism |
| FSFO | Fast-Start Failover |
5. Oracle Data Guard Background Processes
This is an important interview topic.
5.1 LGWR – Log Writer
LGWR writes redo information from the redo log buffer into online redo log files.
It operates on the primary database.
5.2 LNS – Log Network Server
LNS participates in transporting redo information from the primary database to the standby database.
It is particularly relevant to LGWR-based redo transport.
5.3 RFS – Remote File Server
RFS runs on the standby database.
It receives redo information from the primary database and writes it into standby redo logs or other configured destinations.
5.4 MRP – Managed Recovery Process
MRP applies redo information received by the standby database.
It is associated with Redo Apply on a physical standby database.
5.5 ARCH – Archiver Process
ARCH archives online redo log files and participates in archive-based redo transport.
5.6 DMON – Data Guard Monitor
DMON is associated with Data Guard Broker. It manages broker-related configuration and monitoring activities.
Interview question: Explain LGWR, LNS, RFS and MRP.
Answer:
LGWR writes redo information into the online redo logs on the primary database. LNS transports redo information to the standby database. RFS receives the redo on the standby side and writes it into standby redo logs. MRP applies that redo information to the standby database.
Remember this simplified flow:
Primary: LGWR → LNS → Network
Standby: RFS → Standby Redo Logs → MRP
Actual transport processes depend on the configured transport mechanism and Oracle release.
6. Redo Transport Services
Redo Transport Services transfer redo information from the primary database to the standby database.
There are two commonly discussed transport modes.
6.1 SYNC
SYNC stands for synchronous redo transport.
The primary database waits for acknowledgement from the standby destination according to the configured acknowledgement mode before completing the protected commit.
It is used for strong data protection.
Common attributes:
- SYNC
- AFFIRM or NOAFFIRM
With AFFIRM, acknowledgement occurs after redo is written to the standby redo log.
6.2 ASYNC
ASYNC stands for asynchronous redo transport.
The primary database does not wait for the standby to acknowledge every commit.
This reduces commit latency but creates a possibility of data loss if the primary fails before the latest redo reaches the standby.
Comparison
| Feature | SYNC | ASYNC |
| Transport | Synchronous | Asynchronous |
| Primary waits for standby acknowledgement | Yes, according to acknowledgement configuration | No |
| Commit latency | Can increase | Usually lower |
| Network latency impact | Higher | Lower |
| Typical usage | Maximum Protection / Availability | Maximum Performance |
Example LOG_ARCHIVE_DEST_2 configuration
Synchronous:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 =
‘SERVICE=DRDB ASYNC=NO
LGWR SYNC AFFIRM
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=DRDB’
SCOPE=BOTH;
Asynchronous:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 =
‘SERVICE=DRDB ASYNC
LGWR ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=DRDB’
SCOPE=BOTH;
These are illustrative configurations. Validate transport attributes, service names and protection-mode requirements before applying them in production.
7. Types of Standby Databases
Oracle Data Guard supports three main standby database types.
7.1 Physical Standby
A physical standby database maintains a physical copy of the primary database.
It uses Redo Apply to keep the database synchronized.
Features:
- Block-for-block physical copy.
- Supports Redo Apply.
- Suitable for disaster recovery.
- Can be opened read-only in an eligible Active Data Guard configuration.
Check database role:
SELECT NAME, DB_UNIQUE_NAME, DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
7.2 Logical Standby
A logical standby database maintains logical data consistency rather than a physical block-for-block copy.
It uses SQL Apply.
Features:
- Supports logical transformations.
- Supports certain reporting workloads.
- Uses SQL Apply to process changes.
7.3 Snapshot Standby
A snapshot standby is a temporary read-write standby database.
It can be used for:
- Testing.
- Development.
- Patch validation.
- Application testing.
Changes made during snapshot standby operation are discarded when it is converted back to a physical standby, after which accumulated redo can be applied.
Example Broker commands:
DGMGRL> CONVERT DATABASE ‘DRDB’
TO SNAPSHOT STANDBY;
DGMGRL> CONVERT DATABASE ‘DRDB’
TO PHYSICAL STANDBY;
8. Oracle Data Guard Protection Modes
There are three main protection modes.
8.1 Maximum Protection
Provides the highest level of data protection.
It requires synchronous redo transport with the required standby acknowledgement.
If the required protection cannot be maintained, the primary database shuts down rather than continue without the configured protection.
Use case: Critical financial applications where zero data loss is mandatory.
8.2 Maximum Availability
Provides zero data loss under normal operating conditions while maintaining primary availability.
It uses synchronous redo transport.
If the standby destination becomes unavailable, the primary can continue processing transactions after the applicable timeout and protection behavior takes effect.
Use case: Banking and business-critical systems.
8.3 Maximum Performance
Prioritizes primary database performance.
It typically uses asynchronous redo transport.
Some redo may not have reached the standby when the primary fails.
Use case: Applications where performance is important and some data loss may be acceptable.
Protection mode comparison
| Feature | Maximum Protection | Maximum Availability | Maximum Performance |
| Transport | SYNC | SYNC | Usually ASYNC |
| Main objective | Highest protection | Protection + availability | Performance |
| Data loss | Zero | Zero in normal protected operation | Possible |
| Primary behavior on standby failure | Shuts down if required protection is lost | Can continue after timeout | Continues |
| Typical use | Critical financial systems | Business-critical systems | Performance-sensitive systems |
Command to check protection mode
SELECT
PROTECTION_MODE,
PROTECTION_LEVEL,
DATABASE_ROLE,
SWITCHOVER_STATUS
FROM V$DATABASE;
9. Important Initialization Parameters
These parameters are frequently asked in Oracle DBA interviews.
9.1 DB_NAME
The DB_NAME identifies the database.
For a primary and physical standby database, DB_NAME is normally the same.
9.2 DB_UNIQUE_NAME
Identifies each database uniquely within the Data Guard configuration.
Example:
Primary:
DB_NAME=PROD
DB_UNIQUE_NAME=PROD
Standby:
DB_NAME=PROD
DB_UNIQUE_NAME=DRPROD
9.3 LOG_ARCHIVE_CONFIG
Defines the Data Guard configuration members.
Example:
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG =
‘DG_CONFIG=(PROD,DRPROD)’
SCOPE=BOTH;
9.4 LOG_ARCHIVE_DEST_1
Configures a local archive destination.
9.5 LOG_ARCHIVE_DEST_2
Configures a remote redo transport destination.
Example:
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 =
‘SERVICE=DRPROD ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=DRPROD’
SCOPE=BOTH;
9.6 LOG_ARCHIVE_DEST_STATE_2
Enables or disables the configured destination.
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE
SCOPE=BOTH;
9.7 FAL_SERVER
Defines the Oracle Net service used by a standby database to request missing archived redo logs.
Example:
ALTER SYSTEM SET FAL_SERVER=’PROD’
SCOPE=BOTH;
9.8 DB_FILE_NAME_CONVERT
Used to convert primary data file paths into standby data file paths when required.
9.9 LOG_FILE_NAME_CONVERT
Used to convert primary online redo log paths into standby log paths when required.
9.10 STANDBY_FILE_MANAGEMENT
Controls automatic creation of standby data files when data files are added on the primary.
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO
SCOPE=BOTH;
Check parameters
SHOW PARAMETER DB_NAME;
SHOW PARAMETER DB_UNIQUE_NAME;
SHOW PARAMETER LOG_ARCHIVE_CONFIG;
SHOW PARAMETER LOG_ARCHIVE_DEST;
SHOW PARAMETER FAL_SERVER;
SHOW PARAMETER STANDBY_FILE_MANAGEMENT;
10. Step-by-Step Physical Standby Configuration
This is one of the most important practical interview topics.
Let’s configure a physical standby database.
Example environment
| Parameter | Primary | Standby |
| Hostname | prodhost | drhost |
| DB_NAME | PROD | PROD |
| DB_UNIQUE_NAME | PROD | DRPROD |
| Oracle SID | PROD | PROD |
| Role | Primary | Physical Standby |
| Oracle Version | 19c | 19c |
Both servers should have compatible Oracle software, network connectivity, storage and sufficient resources.
Step 1: Check the primary database
Connect to the primary database:
SELECT NAME, DBID, OPEN_MODE, DATABASE_ROLE
FROM V$DATABASE;
Check ARCHIVELOG mode:
ARCHIVE LOG LIST;
If the database is not in ARCHIVELOG mode, enable it during a planned maintenance window:
SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
Step 2: Enable FORCE LOGGING
On the primary database:
ALTER DATABASE FORCE LOGGING;
Verify:
SELECT FORCE_LOGGING
FROM V$DATABASE;
FORCE LOGGING helps ensure that database operations generate redo needed for standby consistency.
Step 3: Set Data Guard parameters on primary
ALTER SYSTEM SET LOG_ARCHIVE_CONFIG =
‘DG_CONFIG=(PROD,DRPROD)’
SCOPE=BOTH;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_2 =
‘SERVICE=DRPROD ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=DRPROD’
SCOPE=BOTH;
ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE
SCOPE=BOTH;
Set standby file management:
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO
SCOPE=BOTH;
Step 4: Configure Oracle Net connectivity
Configure listener and TNS entries on both servers.
Example TNS entry:
PROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = prodhost)
(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = PROD))
)
DRPROD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)
(HOST = drhost)
(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = DRPROD))
)
Test connectivity:
tnsping PROD
tnsping DRPROD
Test remote database authentication:
sqlplus sys@PROD as sysdba
sqlplus sys@DRPROD as sysdba
The remote SYSDBA authentication requires a compatible password file.
Step 5: Prepare the standby initialization parameters
Example standby parameter settings:
DB_NAME=PROD
DB_UNIQUE_NAME=DRPROD
LOG_ARCHIVE_CONFIG=’DG_CONFIG=(PROD,DRPROD)’
LOG_ARCHIVE_DEST_1=
‘LOCATION=/u01/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=DRPROD’
LOG_ARCHIVE_DEST_2=
‘SERVICE=PROD ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=PROD’
FAL_SERVER=PROD
STANDBY_FILE_MANAGEMENT=AUTO
Configure file conversion parameters if the primary and standby use different file paths.
Example:
DB_FILE_NAME_CONVERT=
(‘/u01/oradata/PROD/’,
‘/u02/oradata/PROD/’)
LOG_FILE_NAME_CONVERT=
(‘/u01/oradata/PROD/’,
‘/u02/oradata/PROD/’)
These paths are examples. Use the actual primary and standby storage layout.
Step 6: Create standby using RMAN active duplication
On the standby server, prepare the Oracle environment and start the auxiliary instance in NOMOUNT mode using the standby initialization parameters.
STARTUP NOMOUNT PFILE=’/u01/app/oracle/product/19c/dbhome_1/dbs/initPROD.ora’;
Connect RMAN from a host with connectivity to both databases:
rman target sys@PROD auxiliary sys@DRPROD
Execute:
DUPLICATE TARGET DATABASE
FOR STANDBY
FROM ACTIVE DATABASE
DORECOVER;
RMAN copies the primary database files and creates the standby database.
Important:
- Verify available network bandwidth.
- Check storage capacity.
- Verify password file compatibility.
- Ensure Oracle Net connectivity.
- Use appropriate file naming or OMF configuration.
- Follow the Oracle version-specific RMAN duplication procedure.
Step 7: Verify standby database
On the standby:
SELECT NAME, DB_UNIQUE_NAME, DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
Expected role:
DATABASE_ROLE = PHYSICAL STANDBY
Step 8: Configure Standby Redo Logs
Standby Redo Logs are required for real-time redo apply and are strongly recommended for production configurations.
First check the primary online redo log groups:
SELECT GROUP#, THREAD#, BYTES/1024/1024 SIZE_MB
FROM V$LOG
ORDER BY THREAD#, GROUP#;
Check standby redo logs:
SELECT GROUP#, THREAD#, BYTES/1024/1024 SIZE_MB, STATUS
FROM V$STANDBY_LOG
ORDER BY THREAD#, GROUP#;
General sizing rule:
- Standby Redo Log size should be at least the size of the largest online redo log.
- Configure at least one more standby redo log group than the number of online redo log groups for each redo thread.
Example:
ALTER DATABASE ADD STANDBY LOGFILE
GROUP 10 (‘/u02/oradata/PROD/srl10.log’) SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE
GROUP 11 (‘/u02/oradata/PROD/srl11.log’) SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE
GROUP 12 (‘/u02/oradata/PROD/srl12.log’) SIZE 500M;
ALTER DATABASE ADD STANDBY LOGFILE
GROUP 13 (‘/u02/oradata/PROD/srl13.log’) SIZE 500M;
The 500 MB size is illustrative. Use the actual online redo log size and correct number of groups for your environment.
Step 9: Start Redo Apply
On the physical standby:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
DISCONNECT FROM SESSION;
This starts Redo Apply in the background.
Step 10: Verify Data Guard synchronization
On standby:
SELECT PROCESS, STATUS, THREAD#, SEQUENCE#
FROM V$MANAGED_STANDBY;
For newer Oracle releases, prefer:
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
Check lag:
SELECT NAME, VALUE, UNIT, TIME_COMPUTED
FROM V$DATAGUARD_STATS;
Check database role:
SELECT DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
The physical standby configuration is now ready for validation.
11. Standby Redo Logs – Detailed Explanation
This is a frequently asked Oracle DBA interview topic.
What are Standby Redo Logs?
Standby Redo Logs are log files on the standby database that receive redo information directly from the primary database.
They enable real-time redo apply when configured appropriately.
Difference between Online Redo Logs and Standby Redo Logs
| Online Redo Logs | Standby Redo Logs |
| Used by primary database | Used by standby database |
| Store primary redo | Receive transported redo |
| Written by primary redo processes | Written by standby receiving processes |
| Used for instance recovery | Used for standby redo reception and apply |
Why should standby redo logs be larger in number?
They allow the standby to continue receiving redo while previously filled logs are archived and processed.
The usual recommendation is at least one additional standby redo log group per redo thread compared with the online redo log group count.
Interview question: Can Data Guard work without standby redo logs?
Yes, archived-log-based transport and apply can operate without standby redo logs. However, real-time apply requires standby redo logs, so they are strongly recommended for production configurations.
12. Starting and Stopping Redo Apply
Check whether recovery is running
SELECT PROCESS, STATUS, THREAD#, SEQUENCE#
FROM V$MANAGED_STANDBY;
Or:
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
Start Redo Apply
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
DISCONNECT FROM SESSION;
Stop Redo Apply
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
Check standby open mode
SELECT OPEN_MODE, DATABASE_ROLE
FROM V$DATABASE;
Important interview point
A physical standby can be mounted while Redo Apply is running.
An eligible Active Data Guard physical standby can be open read-only while Redo Apply continues, subject to licensing and configuration requirements.
13. Oracle Data Guard Broker
Oracle Data Guard Broker simplifies configuration, management and monitoring.
It can be managed using:
- DGMGRL command-line interface.
- Oracle Enterprise Manager Cloud Control.
Check Broker status
SHOW PARAMETER DG_BROKER_START;
Enable Broker on both databases:
ALTER SYSTEM SET DG_BROKER_START=TRUE
SCOPE=BOTH;
Connect:
dgmgrl sys@PROD
Create a Broker configuration
DGMGRL> CREATE CONFIGURATION ‘DG_CONFIG’
AS PRIMARY DATABASE IS ‘PROD’
CONNECT IDENTIFIER IS PROD;
Add standby:
DGMGRL> ADD DATABASE ‘DRPROD’
AS CONNECT IDENTIFIER IS DRPROD
MAINTAINED AS PHYSICAL;
Enable configuration:
DGMGRL> ENABLE CONFIGURATION;
Important Broker commands
Show configuration:
DGMGRL> SHOW CONFIGURATION;
Show database:
DGMGRL> SHOW DATABASE VERBOSE ‘PROD’;
Show standby:
DGMGRL> SHOW DATABASE VERBOSE ‘DRPROD’;
Check configuration status:
DGMGRL> SHOW CONFIGURATION VERBOSE;
Enable database:
DGMGRL> ENABLE DATABASE ‘DRPROD’;
Disable database:
DGMGRL> DISABLE DATABASE ‘DRPROD’;
Enable apply:
DGMGRL> EDIT DATABASE ‘DRPROD’ SET STATE=’APPLY-ON’;
Disable apply:
DGMGRL> EDIT DATABASE ‘DRPROD’ SET STATE=’APPLY-OFF’;
Enable transport:
DGMGRL> EDIT DATABASE ‘PROD’ SET STATE=’TRANSPORT-ON’;
Disable transport:
DGMGRL> EDIT DATABASE ‘PROD’ SET STATE=’TRANSPORT-OFF’;
What is the advantage of Broker?
Broker simplifies administration and provides centralized status reporting, role transitions and Fast-Start Failover management.
14. Switchover and Failover
This is one of the most important production DBA interview topics.
14.1 What is Switchover?
Switchover is a planned role transition between primary and standby databases.
The primary becomes standby, and the standby becomes primary.
It is generally performed during:
- Planned maintenance.
- Data center migration.
- Server upgrades.
- Infrastructure maintenance.
- DR testing.
Switchover using DGMGRL
Check configuration:
DGMGRL> SHOW CONFIGURATION;
Check target:
DGMGRL> VALIDATE DATABASE ‘DRPROD’;
Perform switchover:
DGMGRL> SWITCHOVER TO ‘DRPROD’;
Verify:
DGMGRL> SHOW CONFIGURATION;
Check database roles:
SELECT DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
14.2 What is Failover?
Failover is an unplanned role transition.
It is performed when the primary database becomes unavailable and the standby must take over.
Common reasons:
- Primary server failure.
- Data center outage.
- Storage failure.
- Severe database corruption.
- Network or infrastructure disaster.
Failover using DGMGRL
After confirming that the primary cannot be recovered or that disaster recovery procedures require a role transition:
DGMGRL> FAILOVER TO ‘DRPROD’;
Verify:
DGMGRL> SHOW CONFIGURATION;
On the new primary:
SELECT DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
Difference between Switchover and Failover
| Switchover | Failover |
| Planned activity | Unplanned activity |
| Original primary is available | Original primary is unavailable or unusable |
| Usually no data loss | Data loss may occur |
| Used for maintenance | Used during disasters |
| Can switch back through another switchover | Original primary requires reinstatement or rebuilding |
Important: Never execute a failover just because the standby has lag. First determine primary availability, the last received and applied redo, data-loss exposure, and the recovery plan. A failover can cause data loss and split-brain risk if the original primary is still processing transactions.
15. Monitoring Commands for Oracle DBAs
A senior Oracle DBA should know these commands.
15.1 Check database role
SELECT NAME, DB_UNIQUE_NAME, DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
15.2 Check protection mode
SELECT PROTECTION_MODE, PROTECTION_LEVEL
FROM V$DATABASE;
15.3 Check archive destinations
SELECT DEST_ID, STATUS, ERROR, DESTINATION
FROM V$ARCHIVE_DEST_STATUS;
15.4 Check Data Guard processes
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
For older environments, DBAs may also encounter:
SELECT PROCESS, STATUS, THREAD#, SEQUENCE#
FROM V$MANAGED_STANDBY;
Note: V$MANAGED_STANDBY is deprecated from Oracle Database 12.2 onward. Prefer V$DATAGUARD_PROCESS.
15.5 Check apply lag and transport lag
Run on standby:
SELECT NAME, VALUE, UNIT, TIME_COMPUTED
FROM V$DATAGUARD_STATS;
Important values:
- transport lag
- apply lag
- estimated startup time
15.6 Check archived logs
SELECT THREAD#, SEQUENCE#, APPLIED, FIRST_TIME, NEXT_TIME
FROM V$ARCHIVED_LOG
ORDER BY THREAD#, SEQUENCE#;
15.7 Check archive gap
SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE#
FROM V$ARCHIVE_GAP;
15.8 Check standby redo logs
SELECT GROUP#, THREAD#, SEQUENCE#, STATUS,
BYTES/1024/1024 SIZE_MB
FROM V$STANDBY_LOG;
15.9 Check online redo logs
SELECT GROUP#, THREAD#, SEQUENCE#, STATUS,
BYTES/1024/1024 SIZE_MB
FROM V$LOG;
15.10 Check Data Guard messages
SELECT MESSAGE, TIMESTAMP
FROM V$DATAGUARD_STATUS
ORDER BY TIMESTAMP DESC;
15.11 Check current archive sequence on primary
SELECT THREAD#, MAX(SEQUENCE#) LAST_ARCHIVED
FROM V$ARCHIVED_LOG
GROUP BY THREAD#;
15.12 Check alert log
Using ADRCI:
adrci
Then:
ADRCI> SHOW ALERT -TAIL 100
This is useful when investigating transport, apply and database errors.
16. Replication Lag and Archive Gap Troubleshooting
This is a very important senior DBA interview subject.
16.1 What is Transport Lag?
Transport lag indicates how far behind the standby is in receiving redo information from the primary.
Possible reasons:
- Network connectivity issues.
- Network latency.
- Primary redo generation is too high.
- Standby receiving process issues.
- Archive destination errors.
- Standby storage performance issues.
Check:
SELECT NAME, VALUE, UNIT
FROM V$DATAGUARD_STATS
WHERE NAME = ‘transport lag’;
16.2 What is Apply Lag?
Apply lag indicates how far behind the standby is in applying redo information that has been received.
Possible reasons:
- Slow standby storage.
- High CPU utilization.
- Insufficient recovery resources.
- Heavy redo generation.
- Long-running recovery operations.
- Apply process stopped.
Check:
SELECT NAME, VALUE, UNIT
FROM V$DATAGUARD_STATS
WHERE NAME = ‘apply lag’;
16.3 Difference between Transport Lag and Apply Lag
| Transport Lag | Apply Lag |
| Redo has not reached standby yet | Redo has reached standby but has not been applied |
| Network and transport issues | Apply and standby performance issues |
| Investigate LNS, RFS, network and archive destinations | Investigate MRP, CPU, I/O and recovery |
16.4 Scenario: Transport lag is increasing. What will you do?
Answer:
First, I will identify whether redo transport is failing or delayed.
On primary:
SELECT DEST_ID, STATUS, ERROR
FROM V$ARCHIVE_DEST_STATUS;
I will also verify the destination configuration:
SHOW PARAMETER LOG_ARCHIVE_DEST_2;
Then I will check network connectivity:
tnsping DRPROD
I will inspect the primary alert log and standby alert log.
On standby, I will check receiving processes:
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
I will check for archive gaps and verify whether standby storage has enough free space.
After identifying the root cause, I will correct connectivity, destination configuration, storage or process-related issues and verify whether the lag is reducing.
16.5 Scenario: Transport lag is zero, but apply lag is high.
Answer:
This means redo is reaching the standby, but the standby is not applying it quickly enough.
I will check whether MRP is running:
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
Then I will check CPU utilization, I/O latency, storage throughput and recovery-related waits.
I will also review the standby alert log and compare redo generation with redo apply rates.
16.6 Scenario: Archive gap detected
First identify the missing sequence:
SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE#
FROM V$ARCHIVE_GAP;
Check whether the missing archive is available on primary:
SELECT THREAD#, SEQUENCE#, NAME
FROM V$ARCHIVED_LOG
WHERE THREAD# = 1
ORDER BY SEQUENCE#;
If the missing archive is available, transfer it to the standby using the approved recovery procedure.
Register the file on standby if it was copied manually:
ALTER DATABASE REGISTER LOGFILE
‘/u02/arch/arch_100.arc’;
Then verify that recovery resumes.
If the missing log is unavailable, determine whether it can be restored from RMAN backup. If not, evaluate standby roll-forward or rebuild options.
16.7 Scenario: MRP process is not running
Check:
SELECT ROLE, ACTION, THREAD#, SEQUENCE#
FROM V$DATAGUARD_PROCESS;
Check database status:
SELECT DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
Review the alert log before restarting recovery.
Start Redo Apply if it is safe and the root cause has been addressed:
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE
DISCONNECT FROM SESSION;
16.8 Scenario: Standby database is not receiving redo
Check the following:
- Primary archive destination status.
- Listener availability.
- TNS connectivity.
- Password file compatibility.
- Standby RFS processes.
- Archive destination error.
- Network firewall and routing.
- Standby disk space.
Commands:
SELECT DEST_ID, STATUS, ERROR
FROM V$ARCHIVE_DEST_STATUS;
lsnrctl status
tnsping DRPROD
17. Common Production Issues and Solutions
| Problem | Possible reason | DBA action |
| ORA-12514 | Listener does not know requested service | Verify listener and service registration |
| ORA-12154 | TNS alias resolution issue | Check tnsnames.ora |
| ORA-16191 | Primary and standby redo transport authentication problem | Check password files and SYS authentication |
| ORA-16047 | DB_UNIQUE_NAME mismatch | Verify destination DB_UNIQUE_NAME |
| ORA-16766 | Redo Apply stopped | Check MRP and standby alert log |
| ORA-16853 | Apply lag exceeds configured threshold | Investigate apply performance |
| ORA-16857 | Transport connectivity or redo transport delay threshold exceeded | Check network and redo transport |
| ORA-10458 | Standby requires recovery before opening | Start or complete recovery |
These are examples of common errors. Always investigate the complete error stack and alert log before deciding on corrective action.
18. Oracle Data Guard vs Oracle RAC
This is a very common interview question.
Oracle RAC
Oracle Real Application Clusters allows multiple database instances to access the same database storage.
It primarily provides instance-level high availability and scalability.
Oracle Data Guard
Oracle Data Guard maintains a separate standby database and provides disaster recovery and data protection.
Comparison
| Feature | Oracle RAC | Oracle Data Guard |
| Main purpose | High availability and scalability | Disaster recovery and data protection |
| Database storage | Shared storage | Separate database storage |
| Instances | Multiple instances access same database | Separate primary and standby databases |
| Site failure protection | Depends on RAC deployment | Yes, through remote standby |
| Replication mechanism | Shared database architecture | Redo transport and apply |
| Role transition | Not its main purpose | Switchover and failover |
Can RAC and Data Guard work together?
Yes.
A common enterprise architecture is:
- Primary RAC database at production site.
- Physical standby RAC database at DR site.
This provides protection against both instance-level and site-level failures.
19. Oracle Data Guard Interview Questions and Answers
Basic questions
Q1. What is Oracle Data Guard?
Oracle Data Guard is an Oracle high availability and disaster recovery solution that maintains one or more standby databases by transporting and applying redo information.
Q2. What is the difference between primary and standby?
Primary handles application transactions. Standby receives and applies redo information from primary.
Q3. What is redo transport?
It transfers redo information from primary to standby.
Q4. What is redo apply?
It applies received redo information to the standby database.
Q5. What is the difference between physical and logical standby?
Physical standby maintains a physical copy of the primary and uses Redo Apply. Logical standby maintains logical consistency and uses SQL Apply.
Q6. What is Active Data Guard?
Active Data Guard is an Oracle licensed option that enables additional standby capabilities, including real-time query on a physical standby while Redo Apply continues.
Q7. What is Data Guard Broker?
It is a management framework that simplifies Data Guard configuration, monitoring and role transitions.
Q8. What is FAL_SERVER?
It specifies the Oracle Net service used by a standby database to request missing archived redo logs.
Q9. What is FORCE LOGGING?
It ensures that supported database operations generate redo even if an operation would otherwise bypass normal redo generation.
Q10. What is DB_UNIQUE_NAME?
It uniquely identifies each database in the Data Guard configuration.
Intermediate questions
Q11. What is the difference between SYNC and ASYNC?
SYNC uses synchronous redo transport and waits for the configured acknowledgement. ASYNC sends redo without waiting for acknowledgement for each commit.
Q12. What is the difference between switchover and failover?
Switchover is planned. Failover is unplanned and occurs when the primary cannot continue serving its role.
Q13. What is a standby redo log?
A standby redo log receives redo information transported from the primary.
Q14. Why do we configure one extra standby redo log group?
To provide an additional group for redo reception while another group is being archived or processed.
Q15. What is Maximum Availability?
It is a protection mode designed to provide zero data loss during normal protected operation while allowing the primary to continue if the standby destination becomes unavailable.
Q16. What is Maximum Performance?
It prioritizes primary performance and typically uses asynchronous redo transport.
Q17. What is Maximum Protection?
It provides the highest level of protection and shuts down the primary if the required synchronous protection cannot be maintained.
Q18. Can we open a physical standby database in read-only mode?
Yes, with an appropriate configuration. To keep Redo Apply running while the database is open read-only requires eligible Active Data Guard functionality.
Q19. What is real-time apply?
Real-time apply applies redo directly from standby redo logs before the entire redo log is archived.
Q20. How do you check Data Guard lag?
Use V$DATAGUARD_STATS on the standby database.
Advanced questions
Q21. What happens if the primary database crashes?
The DBA checks standby synchronization, determines data-loss exposure, verifies the primary recovery possibility and performs a failover if required.
Q22. What happens if the network between primary and standby goes down?
Redo transport is interrupted. The primary behavior depends on the protection mode and transport configuration. Once connectivity is restored, transport and recovery can catch up if the required redo is available.
Q23. What happens if MRP stops?
Redo may continue to arrive, but the standby will not apply it. Apply lag increases until recovery resumes.
Q24. How do you identify an archive gap?
Use V$ARCHIVE_GAP on the physical standby.
Q25. What is the difference between transport lag and apply lag?
Transport lag measures redo delivery delay. Apply lag measures redo application delay.
Q26. What is Fast-Start Failover?
It is a Broker-managed capability that can automatically fail over to a target standby when configured conditions are met and the observer determines that failover is necessary.
Q27. What is the Observer?
The Observer is an external process used by Fast-Start Failover to monitor the primary and target standby and initiate automatic failover when appropriate.
Q28. Can we have multiple standby databases?
Yes. Oracle Data Guard supports configurations with multiple standby destinations, subject to supported configuration limits and architecture.
Q29. Can we use Data Guard with RAC?
Yes. RAC primary and standby configurations are supported.
Q30. What happens after failover to the standby?
The standby assumes the primary role. The original primary must be reinstated using Flashback Database when possible or rebuilt as a standby.
20. Advanced Scenario-Based Interview Questions
These questions are particularly important for Senior Oracle DBA interviews.
Scenario 1: Primary database is down. What will you do?
Answer:
First, I will confirm whether the issue is database-level, server-level, storage-level or site-level.
I will check whether the primary can be recovered.
Then I will check the standby database role, transport lag, apply lag and latest received redo.
If the primary cannot be recovered within the required RTO, I will follow the disaster recovery procedure and perform a failover using Broker or the approved manual method.
After failover, I will validate the new primary and application connectivity.
Scenario 2: Standby database is 30 minutes behind primary. How will you troubleshoot?
Answer:
First, I will determine whether the 30-minute delay is transport lag or apply lag.
SELECT NAME, VALUE, UNIT
FROM V$DATAGUARD_STATS;
If transport lag is high, I will check network connectivity, primary archive destination errors, LNS and RFS processes.
If apply lag is high, I will check MRP, standby CPU, storage I/O and redo apply throughput.
Then I will identify the root cause and monitor whether the lag reduces after corrective action.
Scenario 3: Network connectivity between primary and standby is lost. What happens?
Answer:
Redo transport stops or is delayed.
The impact on primary commits depends on the protection mode and redo transport configuration.
In Maximum Protection, loss of the required protection can cause the primary to shut down.
In Maximum Availability, the primary can continue after the configured timeout and protection behavior takes effect.
In Maximum Performance, the primary can continue without waiting for standby acknowledgement, but potential data loss increases.
After connectivity returns, Oracle can transport and apply outstanding redo if the required logs are available.
Scenario 4: Primary database is generating redo faster than standby can apply it. What will you do?
Answer:
I will compare redo generation and apply rates.
I will check:
- CPU utilization on standby.
- Storage I/O latency.
- Recovery processes.
- Archive log generation.
- Network bandwidth.
- Standby redo log configuration.
If apply is the bottleneck, I will investigate storage and recovery performance and evaluate supported parallel apply options.
I will not assume that adding CPU alone will resolve the issue.
Scenario 5: Standby is receiving redo, but MRP is not applying it.
Answer:
I will check the MRP process, database state and standby alert log.
SELECT ROLE, ACTION, THREAD#, SEQUENCE#
FROM V$DATAGUARD_PROCESS;
I will investigate missing archive logs, recovery errors and storage issues.
After resolving the root cause, I will restart Redo Apply if required.
Scenario 6: The primary database is completely lost. Can we perform zero-data-loss failover?
Answer:
It depends on the protection mode and whether all required redo was successfully received by the standby.
A synchronous protection configuration can provide zero data loss under its protection guarantees.
If the latest redo was not received, zero-data-loss failover cannot be assumed.
Scenario 7: A standby database is not synchronized after a primary switchover.
Answer:
I will check the roles of both databases, Broker status, redo destinations, transport connectivity and apply state.
I will confirm that the old primary has been converted correctly into the new standby role and that the redo transport configuration is valid in the new roles.
Scenario 8: You need to perform patching on the production database with minimal downtime. What is your approach?
Answer:
If the maintenance procedure is supported by the environment, I will validate the standby, perform a planned switchover, patch the former primary while it operates as standby and follow the approved upgrade or patching procedure.
After validation, I can switch back if required.
For major database upgrades, I will evaluate supported Data Guard rolling upgrade methods rather than assuming that ordinary switchover alone is sufficient.
Scenario 9: Standby database is showing ORA-16766.
Answer:
This generally indicates that Redo Apply is stopped.
I will check the Broker status, MRP process, database alert log and any underlying recovery error before restarting apply.
Scenario 10: What will you check before a planned switchover?
Answer:
- Confirm both databases are healthy.
- Check transport and apply lag.
- Check Broker configuration.
- Verify standby is ready for switchover.
- Confirm application and service dependencies.
- Confirm backup and rollback plans.
- Obtain change approval.
- Perform switchover.
- Validate database roles and application connectivity.
- Confirm redo transport and apply in the reverse direction.
21. Daily Oracle Data Guard DBA Health-Check Checklist
A production DBA should regularly monitor the following.
| Check | Command or method |
| Primary database role | V$DATABASE |
| Standby database role | V$DATABASE |
| Protection mode | V$DATABASE |
| Transport lag | V$DATAGUARD_STATS |
| Apply lag | V$DATAGUARD_STATS |
| Redo transport status | V$ARCHIVE_DEST_STATUS |
| MRP status | V$DATAGUARD_PROCESS |
| RFS status | V$DATAGUARD_PROCESS |
| Archive gap | V$ARCHIVE_GAP |
| Standby redo logs | V$STANDBY_LOG |
| Broker status | SHOW CONFIGURATION |
| Alert log errors | ADRCI |
| Network connectivity | TNSPING |
Sample daily health-check SQL
— Database role and open mode
SELECT NAME, DB_UNIQUE_NAME, DATABASE_ROLE, OPEN_MODE
FROM V$DATABASE;
— Protection mode
SELECT PROTECTION_MODE, PROTECTION_LEVEL
FROM V$DATABASE;
— Transport and apply lag
SELECT NAME, VALUE, UNIT
FROM V$DATAGUARD_STATS;
— Data Guard processes
SELECT ROLE, THREAD#, SEQUENCE#, ACTION
FROM V$DATAGUARD_PROCESS;
— Archive destination errors
SELECT DEST_ID, STATUS, ERROR
FROM V$ARCHIVE_DEST_STATUS;
— Archive gap
SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE#
FROM V$ARCHIVE_GAP;
22. Important Oracle Data Guard Commands Cheat Sheet
| Purpose | Command |
| Check database role | SELECT DATABASE_ROLE FROM V$DATABASE; |
| Check open mode | SELECT OPEN_MODE FROM V$DATABASE; |
| Check protection mode | SELECT PROTECTION_MODE FROM V$DATABASE; |
| Check lag | SELECT * FROM V$DATAGUARD_STATS; |
| Check Data Guard processes | SELECT * FROM V$DATAGUARD_PROCESS; |
| Check archive gap | SELECT * FROM V$ARCHIVE_GAP; |
| Start redo apply | ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION; |
| Stop redo apply | ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; |
| Enable force logging | ALTER DATABASE FORCE LOGGING; |
| Check archive destination | SELECT * FROM V$ARCHIVE_DEST_STATUS; |
| Check Broker | SHOW CONFIGURATION; |
| Perform switchover | SWITCHOVER TO ‘DRPROD’; |
| Perform failover | FAILOVER TO ‘DRPROD’; |
| Enable Broker | ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH; |
| Check listener | lsnrctl status |
| Check TNS | tnsping DRPROD |
23. Final Interview Preparation: What Should You Be Able to Explain?
Before attending a Senior Oracle DBA interview, make sure you can explain these topics without looking at notes:
- Complete Data Guard architecture.
- Redo generation, transport and apply flow.
- LGWR, LNS, RFS, MRP and ARCH processes.
- Physical, logical and snapshot standby.
- SYNC versus ASYNC.
- Maximum Protection, Availability and Performance.
- All important Data Guard initialization parameters.
- Step-by-step physical standby configuration.
- RMAN DUPLICATE FOR STANDBY.
- Standby Redo Logs and their sizing.
- Data Guard Broker configuration.
- DGMGRL commands.
- Switchover versus failover.
- Transport lag versus apply lag.
- Archive gap troubleshooting.
- MRP stopped troubleshooting.
- Network failure troubleshooting.
- Primary database failure and DR activation.
- RAC versus Data Guard.
- Daily Data Guard health checks.
Conclusion
Oracle Data Guard is a critical technology for enterprise Oracle Database environments. Every Oracle DBA working in production should understand its architecture, configuration, monitoring and troubleshooting.
For a senior DBA, theoretical knowledge is not enough. You should be able to identify transport and apply problems, investigate archive gaps, understand protection modes, execute planned role transitions and follow disaster recovery procedures safely.
The commands and scenarios in this guide provide a practical foundation for Oracle Data Guard administration and interview preparation.
Recommended practice: Build a two-database Oracle 19c Data Guard lab, configure a physical standby using RMAN, monitor redo transport, stop and restart Redo Apply, test an archive gap recovery procedure, and perform a planned switchover.
Author: SmartTechWays.com – Oracle Database Administration Tutorials
Disclaimer: SQL and configuration examples are templates for learning. Validate database version, storage paths, service names, licensing, protection requirements and change approvals before running commands in production.