top of page

Diagnosing Oracle Data Guard Transport and Apply Lag Across Clouds

OmerNarman
Jul 23
10 min read

Updated: Oct 24

A physical standby that falls behind can have two very different problems. Either the redo has not reached the standby, or it has arrived but has not been applied yet. In a multicloud deployment it is tempting to blame the network every time, but treating both cases as a network problem wastes time and can lead to configuration changes that nobody needed.


This post separates the two conditions step by step, using Oracle Database 19c views and a few operating-system checks. Every command collects evidence only. Nothing here changes the protection mode, restarts recovery, switches roles or touches network rules.



Scope

The example is a self-managed primary database on an OCI virtual machine with a physical standby on Azure virtual machines. It assumes a deployment that is already configured and supported, with private connectivity between the clouds, the right Oracle licences, and compatible database platforms on both sides.


The same diagnostic approach works for other self-managed placements, such as on premises to a cloud, or between two other clouds. It does not mean that any cross-cloud architecture is supported, and the host-level steps do not apply to managed services such as Autonomous Database, where you have no operating-system access.


The investigation has three stages:


  • Confirm the database roles and take fresh measurements before interpreting a lag alert.

  • Separate redo transport from redo apply, using destination and process evidence.

  • Check every redo thread and network endpoint before choosing a corrective action.


The output examples are illustrative. Your names, numbers and timings will differ.



Before You Begin

You need:


  • OS access to both database sites, including every RAC host that ships redo.

  • **SQL*Plus** and an initialised Oracle environment for the right database home: ORACLE_HOME, ORACLE_SID and PATH.

  • A SYSDBA connection, or an approved monitoring account that can read the dynamic performance views used below.

  • The real names: database unique names, instance names, the redo destination, the listener host name and port, and the incident window in UTC.

  • Python 3 on the primary host, for the TCP connection check in Step 7.


Environment used in this runbook


  • Primary: SALES_OCI, an OCI virtual machine, local instance SALES1, role PRIMARY

  • Standby: SALES_AZURE, an Azure virtual machine, local instance SALES1, role PHYSICAL STANDBY

  • Database version: Oracle Database 19c (19.22), container database

  • Connectivity: private interconnect between OCI and Azure

  • Redo transport: asynchronous (ASYNC NOAFFIRM), real-time apply on the standby


Tip: Run each SQL query against the database role named in the step. For a container database, connect to CDB$ROOT, not an application PDB, so that the results describe the Data Guard database. Keep passwords out of command lines and transcripts.


Step 1: Connect to the Correct Local Instance

On each database host, set the local instance SID and connect with local operating-system authentication. Run your organisation's normal environment script first, so that ORACLE_HOME, PATH and library settings point to the intended database home.


Shell

export ORACLE_SID=SALES1

sqlplus -L / as sysdba

Expected output

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jul 23 09:14:02 2026
Version 19.22.0.0.0

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.22.0.0.0

SQL>

What to expect: The SQL> prompt. ORACLE_SID selects a local instance, not a database unique name, so on RAC the value is different on every node. The -L option makes SQL*Plus try to log on only once, so a wrong environment fails immediately instead of prompting for a user name.



Step 2: Confirm the Database Roles

Lag numbers mean nothing until you know which database is which. Run this on both databases and capture the protection settings without changing them.


SQL

SET LINESIZE 220 PAGESIZE 100

COLUMN db_unique_name FORMAT A14

COLUMN database_role FORMAT A16

COLUMN open_mode FORMAT A10

COLUMN protection_mode FORMAT A20

COLUMN protection_level FORMAT A20

SELECT db_unique_name, database_role, open_mode,

protection_mode, protection_level

FROM v$database;

SELECT instance_name, host_name, version, status

FROM v$instance;

SELECT systimestamp AT TIME ZONE 'UTC' AS sample_time_utc

FROM dual;

Expected output

DB_UNIQUE_NAME DATABASE_ROLE    OPEN_MODE  PROTECTION_MODE      PROTECTION_LEVEL
-------------- ---------------- ---------- -------------------- --------------------
SALES_AZURE    PHYSICAL STANDBY MOUNTED    MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

INSTANCE_NAME    HOST_NAME            VERSION           STATUS
---------------- -------------------- ----------------- ------------
SALES1           sales-azure-db1      19.0.0.0.0        MOUNTED

SAMPLE_TIME_UTC
---------------------------------------------------------------------------
23-JUL-26 09.14.20.418233 AM UTC

What to expect: The source must report PRIMARY and the destination PHYSICAL STANDBY. A MOUNTED physical standby can apply redo. READ ONLY WITH APPLY means an open standby that is applying redo, which requires the Active Data Guard licence. A plain READ ONLY state does not prove that apply is running.


PROTECTION_MODE is the configured mode and PROTECTION_LEVEL is the level currently achieved. If they differ, write it down. Also make sure both hosts synchronise their clocks with the approved time service: if the clocks drift, any comparison of timestamps between the two sites is unreliable.



Step 3: Measure the Lag and Check That the Numbers Are Fresh

V$DATAGUARD_STATS on the standby reports the two lags separately. Run the query, wait 30 to 60 seconds, and run it again.


SQL

COLUMN name FORMAT A18

COLUMN value FORMAT A17

COLUMN time_computed FORMAT A20

COLUMN datum_time FORMAT A20

SELECT name, value, time_computed, datum_time

FROM v$dataguard_stats

WHERE name IN ('transport lag', 'apply lag', 'apply finish time')

ORDER BY name;

Expected output

NAME               VALUE             TIME_COMPUTED        DATUM_TIME
------------------ ----------------- -------------------- --------------------
apply finish time  +00 00:01:30.000  07/23/2026 09:15:02
apply lag          +00 00:02:15      07/23/2026 09:15:02  07/23/2026 09:15:01
transport lag      +00 00:00:10      07/23/2026 09:15:02  07/23/2026 09:15:01

How to read it:


  • Transport lag is how far behind the primary the standby is in receiving redo.

  • Apply lag is how far behind the primary the standby's data is, because redo has not been applied yet. It includes the effect of redo that has not even arrived.

  • Apply finish time estimates how long it will take to apply the redo already at the standby. It is an estimate, not a guaranteed failover time.


A value such as +00 00:02:15 means zero days, zero hours, two minutes and fifteen seconds. Check the UNIT column in your own output rather than assuming every row uses the same format.


TIME_COMPUTED is when the metric was calculated. DATUM_TIME is when the standby last received the information it was calculated from. If DATUM_TIME does not move between your two samples, the lag is based on stale data: a zero lag with a frozen DATUM_TIME does not prove that transport is healthy. An empty (null) lag means unknown, not zero.


Use the two samples to decide where to look first:


Observation across fresh samples

Investigate first

Transport lag rises and apply lag rises

Redo transport and reception

Transport lag stays low, apply lag rises

Standby recovery, CPU, storage and backlog

DATUM_TIME stops advancing

Communication from the primary, metric freshness

Both lags are low

The original alert window, intermittent events, alert thresholds


Do not turn the difference between the two lags into an exact recovery time. Redo generation and apply rates both vary.



Step 4: Inspect Every Transport Destination on the Primary

Do not assume the standby is destination 2. List the configured standby destinations on the primary, for every instance.


SQL

COLUMN destination FORMAT A14

COLUMN db_unique_name FORMAT A14

COLUMN error FORMAT A30

SELECT inst_id, dest_id, status, db_unique_name,

destination, transmit_mode, affirm, error

FROM gv$archive_dest

WHERE destination IS NOT NULL

AND target = 'STANDBY'

ORDER BY inst_id, dest_id;

Expected output

   INST_ID    DEST_ID STATUS    DB_UNIQUE_NAME DESTINATION    TRANSMIT_MOD AFF ERROR
---------- ---------- --------- -------------- -------------- ------------ --- ------------------------------
         1          2 VALID     SALES_AZURE    SALES_AZURE    ASYNCHRONOUS NO

What to expect: One row per instance and standby destination. Match DB_UNIQUE_NAME and the service in DESTINATION to the intended standby. On RAC, check every primary instance: one thread can hit a route, listener or authentication failure while the other instances keep shipping redo.


Now look at the runtime status of the same destinations:


SQL

COLUMN database_mode FORMAT A15

COLUMN recovery_mode FORMAT A23

COLUMN gap_status FORMAT A10

SELECT inst_id, dest_id, status, database_mode,

recovery_mode, gap_status, error

FROM gv$archive_dest_status

WHERE status <> 'INACTIVE'

AND type <> 'LOCAL'

ORDER BY inst_id, dest_id;

Expected output

   INST_ID    DEST_ID STATUS    DATABASE_MODE   RECOVERY_MODE           GAP_STATUS ERROR
---------- ---------- --------- --------------- ----------------------- ---------- ------------------------------
         1          2 VALID     MOUNTED-STANDBY MANAGED REAL TIME APPLY NO GAP

What this does: It shows how the primary sees the standby right now. STATUS VALID, NO GAP and MANAGED REAL TIME APPLY are the healthy picture. A persistent ERROR needs investigation even if another destination is fine. Keep the complete Oracle error text and the instance it came from: ORA-12541 points to listener reachability, and ORA-16191 points to redo transport authentication (the password file). Neither is a reason to open a firewall wide or replace a password file blindly.


TRANSMIT_MODE and AFFIRM matter for interpretation. With synchronous transport, the network round trip can add to commit time on the primary. With asynchronous transport, commits do not wait for the standby, so a backlog can build up quietly. Changing the transport mode is an availability and data-protection decision, not a diagnostic step.



Step 5: Separate Redo Reception from Recovery

On the standby, V$DATAGUARD_PROCESS shows which processes receive redo and which apply it. Take two samples a minute apart.


SQL

COLUMN name FORMAT A6

COLUMN role FORMAT A24

COLUMN action FORMAT A13

SELECT inst_id, name, role, action,

thread#, sequence#, block#

FROM gv$dataguard_process

ORDER BY inst_id, name, thread#, sequence#;

Expected output

   INST_ID NAME   ROLE                     ACTION           THREAD#  SEQUENCE#     BLOCK#
---------- ------ ------------------------ ------------- ---------- ---------- ----------
         1 MRP0   managed recovery         IDLE                   0          0          0
         1 PR00   recovery logmerger       APPLYING_LOG           1      48213      91844
         1 PR01   recovery apply slave     IDLE                   0          0          0
         1 rfs    RFS async                RECEIVING              1      48213      91907
         1 rfs    RFS ping                 IDLE                   1      48213          0

How to read it: RFS (remote file server) processes receive redo. MRP0 coordinates managed recovery and the PR processes apply the redo. Here the RFS async process is receiving thread 1 sequence 48213 at block 91907, and the log merger is applying the same sequence a little behind, at block 91844: real-time apply is keeping up.


Compare the second sample with the first. If the RFS block number advances but the PR00 block number does not, while the fresh apply lag grows, the problem is on the standby: look at its alert log, recovery messages, CPU, storage latency and free space. If neither advances while the primary is generating redo, the problem is transport. A single idle row proves nothing; an idle receiver is normal when the primary generates little redo.


On a RAC standby, check all instances. Recovery may run on another node, and with multi-instance Redo Apply the work is spread out. Not finding MRP0 on the node you connected to does not mean apply has stopped.



Step 6: Check Archive Gaps and Progress per Redo Thread

First, ask the standby whether a missing archived log is blocking recovery right now.


SQL

SELECT thread#, low_sequence#, high_sequence#

FROM v$archive_gap

ORDER BY thread#, low_sequence#;

Expected output

no rows selected

What to expect: No rows means there is no gap blocking recovery at this moment. It does not prove the standby is current: transport may be disconnected before a gap becomes visible, or apply may be slow for another reason. When a gap is resolved, a further gap can become visible behind it.


Then compare the last received and last applied archived log for each thread, for the current incarnation only:


SQL

SELECT thread#,

MAX(sequence#) AS last_received,

MAX(CASE WHEN applied = 'YES' THEN sequence# END) AS last_applied

FROM v$archived_log

WHERE registrar = 'RFS'

AND resetlogs_change# = (SELECT resetlogs_change# FROM v$database)

GROUP BY thread#

ORDER BY thread#;

Expected output

   THREAD# LAST_RECEIVED LAST_APPLIED
---------- ------------- ------------
         1         48212        48211

What to expect: One row per enabled primary redo thread. Sequence numbers are independent per thread, so never compare thread 1's sequence with thread 2's. A maximum does not prove that every sequence in between exists, either.


This query only sees archived logs. Redo still being written to or applied from a standby redo log is not included, so with real-time apply the standby can be ahead of this summary, as it is here (sequence 48213 is being applied from the standby redo log in Step 5). APPLIED = 'IN-MEMORY' is not the same as YES and should not be counted as applied to the data files. Treat sequence differences as supporting evidence, not as a lag in seconds.



Step 7: Test the Network Path Used by Redo Transport

Run these checks on the primary host, against the listener endpoint that the transport service actually uses. If only one RAC instance reports errors, repeat them on that node.


Shell

STANDBY_HOST='standby-listener.example.internal'

STANDBY_PORT='1521'

getent ahosts "$STANDBY_HOST"

python3 - "$STANDBY_HOST" "$STANDBY_PORT" <<'PY'

import socket

import sys

import time

host, port = sys.argv[1], int(sys.argv[2])

started = time.monotonic()

with socket.create_connection((host, port), timeout=5) as connection:

print("TCP endpoint:", connection.getpeername())

print("Connect seconds:", round(time.monotonic() - started, 3))

PY

Expected output

192.0.2.10      STREAM standby-listener.example.internal
192.0.2.10      DGRAM
192.0.2.10      RAW

TCP endpoint: ('192.0.2.10', 1521)
Connect seconds: 0.024

What this does: getent shows how the name resolves on this host, and the Python snippet opens and closes one TCP connection to the listener and times it. That proves name resolution and basic reachability from this host, nothing more. It does not test service registration, transport authentication, encryption, sustained bandwidth, or any return path your configuration needs. If the name resolves to several addresses (SCAN, for example), check whether failures affect only one of them.


Then let Oracle Net resolve and probe the transport service alias itself:


Shell

tnsping SALES_AZURE 3

Expected output

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 23-JUL-2026 09:18:44

Used parameter files:
/u01/app/oracle/product/19.0.0/dbhome_1/network/admin/sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standby-listener.example.internal)(PORT = 1521)) (CONNECT_DATA = (SERVICE_NAME = SALES_AZURE)))
OK (24 msec)
OK (22 msec)
OK (23 msec)

What to expect: Three OK replies with similar times. A successful tnsping only proves the listener answers; it does not log on to the database or prove that redo can be shipped. If the TCP checks fail, correlate the timestamps with OCI and Azure routing, private DNS, security lists and network security groups, and the interconnect or VPN monitoring. An ICMP ping is not a useful test here: success proves too little, and failure may only mean ICMP is blocked. Do not open broad network access while you diagnose one endpoint.



Step 8: Preserve the Evidence and Choose the Next Action

Before anyone changes anything, save what you found:


  • At least two timestamped samples from Step 3, with TIME_COMPUTED and DATUM_TIME.

  • The database roles and protection settings from Step 2.

  • Destination status and errors from Step 4, per instance.

  • Process progress from Step 5, both samples.

  • Per-thread archive evidence from Step 6.

  • The network test results from Step 7, with the host they were run on.


Keep these transcripts somewhere access-controlled, because host names and topology details are sensitive.


Then route the problem to its owner:


  • Transport failure: follow the exact destination error. It belongs to Oracle Net, transport authentication, storage for received redo on the standby, or the cross-cloud network path.

  • Apply bottleneck: correlate the recovery messages in the standby alert log with the standby's CPU, storage and memory metrics before considering any tuning.

  • Persistent archive gap: find out whether the missing logs still exist on the primary or in backups, and use an approved procedure to register or restore them.


Tip: Do not restart managed recovery, change the protection mode, delete archived logs or fail over just to make an alert go away. Each of those actions can destroy the evidence you need, and some of them reduce data protection.


Summary

When a standby falls behind, first confirm the roles and take two fresh samples of V$DATAGUARD_STATS, checking that DATUM_TIME advances. Rising transport lag points to transport; low transport lag with rising apply lag points to the standby's recovery. Confirm with the destination status and errors on every primary instance, the RFS and recovery process progress on every standby instance, and archive evidence per redo thread. Test the actual listener endpoint from the primary host, preserve the evidence, and only then choose a corrective action. The goal of the diagnosis is a supported explanation of where redo progress stopped, backed by fresh measurements.

Recent Posts

See All

Comments


bottom of page