Encountering an ORA-01555 error is not a database sizing deficiency; it is an architectural indicator that high-velocity transactional writes and long-running analytical queries are improperly co-located on the same physical infrastructure.

TL;DR

  • Problem: Running long-running analytical scans on an active OLTP primary forces Oracle’s circular Undo tablespace to overwrite historical row pre-images before readers finish (ORA-01555) while flooding the shared buffer cache with cold scan blocks.
  • Answer: Physically decouple reads and writes by routing analytical and reporting queries through CMAN-TDM or application-tier read/write pools to an Oracle Active Data Guard physical standby (READ ONLY WITH APPLY) with TEMP_UNDO_ENABLED = TRUE and STANDBY_MAX_DATA_DELAY.
  • Watch out: Standby offloading introduces apply-lag staleness (ORA-03172), primary DDL invalidation conflicts, and Active Data Guard licensing requirements.

Comparison between co-located OLTP and analytics on primary versus Active Data Guard read-write split

Situation

High-throughput Online Transaction Processing (OLTP) databases on Oracle must serve thousands of concurrent point inserts, updates, and deletes while guaranteeing statement-level and transaction-level read consistency without blocking readers. Oracle implements this guarantee through Multi-Version Concurrency Control (MVCC).

When a SELECT statement begins at a specific System Change Number (SCN_0), Oracle guarantees that every block read by that query reflects data committed as of SCN_0. If a concurrent OLTP transaction modifies a row in a block at SCN_1 > SCN_0, the kernel writes the pre-modification image into an Undo segment, records the transaction entry in the block’s Interested Transaction List (ITL), and updates the block in place. When the reader later visits that block, it compares the block header SCN against SCN_0, reads the ITL pointer, fetches the historical undo record, and constructs a Consistent Read (CR) clone in the buffer cache.

For millisecond-duration OLTP lookups, those undo records remain intact for the lifetime of the query. The architecture holds until reporting jobs, BI extracts, and ad-hoc analytical queries are pointed at the same primary database instance.

The Problem

Co-locating multi-minute or multi-hour analytical scans with continuous OLTP DML breaks two shared subsystems on the primary instance: the circular Undo tablespace and the System Global Area (SGA) buffer cache.

Four-step MVCC undo wrap-around and delayed block cleanout failure sequence leading to ORA-01555

Four physical constraints explain why Undo tuning alone cannot resolve the conflict:

  • Circular Undo Wrap-Around (ORA-01555): Oracle manages the Undo tablespace as a ring of extents. Once active transactions finish and UNDO_RETENTION expires—or earlier if free space is exhausted under autoextend limits—Oracle reuses those extents for new DML. A simple rate check illustrates the sizing bound: if peak OLTP generates 50 MB/s of undo and a batch report runs for 7,200 seconds (2 hours), the primary must retain at least 50 MB/s * 7,200 s = 360,000 MB (~351.6 GB) of historical undo on top of active uncommitted undo and concurrent DML headroom. If a single unindexed analytical job stretches to 4 hours during a traffic spike, required undo doubles to over 700 GB; once any needed extent is overwritten, the query aborts with ORA-01555: snapshot too old.
  • Delayed Block Cleanout: When a large OLTP batch modifies many data blocks and commits, Oracle updates the transaction table in the undo segment header without immediately revisiting every modified data block to clear ITL lock bytes. A later analytical scan that touches those blocks must consult the undo segment’s transaction table to verify the commit SCN. If subsequent OLTP commits have already wrapped around and overwritten that transaction table slot, the analytical query can fail with ORA-01555 almost immediately—even if zero DML runs while the query is executing.
  • Buffer Cache Eviction: Expanding UNDOTBS1 does nothing to protect the SGA buffer cache. Full-table and fast-full-index scans stream gigabytes of cold historical blocks through the buffer cache, evicting hot OLTP index branch blocks and active customer working sets. OLTP sessions that previously hit memory must suddenly issue physical disk reads, degrading transactional tail latency.
  • CPU and I/O Contention: Parallel analytical queries (PQ) compete directly with OLTP foreground sessions for CPU run-queue slots and storage IOPS, turning a reporting spike into a customer-facing checkout slowdown.

How do platform architects eliminate ORA-01555 errors permanently while insulating primary OLTP buffer caches and CPU capacity from heavy analytical scans?

Options Considered

When ORA-01555 alerts appear in the alert log alongside rising OLTP db file sequential read waits, teams typically evaluate four options.

Comparison of four options for resolving ORA-01555 and analytical contention on an OLTP primary

OptionMechanismWhat It SolvesWhere It BreaksDecision
Expand Undo + UNDO_RETENTIONAdd terabytes of storage to UNDOTBS and raise UNDO_RETENTIONExtends the time window before expired undo extents are overwrittenDoes not stop SGA buffer cache eviction, CPU contention, or delayed block cleanout wrap-aroundRejected as standalone fix
RETENTION GUARANTEEForce Oracle never to steal unexpired undo extents (ALTER TABLESPACE ... RETENTION GUARANTEE)Prevents ORA-01555 from premature extent stealingWhen undo fills, OLTP INSERT/UPDATE/DELETE statements fail with ORA-30036Rejected; unacceptable OLTP blast radius
Batch ETL / Data Pump OffloadExport snapshots periodically to a separate data warehouseIsolates long-running BI from primary SGA and undoIntroduces hours of data staleness; export jobs themselves still read the primaryDeferred for near-real-time operational reporting
Active Data Guard Read-Write SplitOffload read-only queries to a physical standby in READ ONLY WITH APPLY modeIsolates SGA, CPU, IOPS, and Temporary Undo while keeping low replication lagRequires Active Data Guard licensing and explicit lag/DDL governanceChosen for operational analytics and reporting

Enabling RETENTION GUARANTEE on the primary Undo tablespace is particularly dangerous: it inverses the failure mode so that a runaway reporting query causes production OLTP writes to fail with ORA-30036: unable to extend segment by ... in undo tablespace. Batch ETL remains appropriate for multi-year warehouse aggregations, but operational reporting and real-time dashboards need fresher data without touching the primary SGA. Active Data Guard solves both problems simultaneously by replaying redo onto independent compute and memory.

The Active Data Guard Read-Write Decoupling Architecture

The recommended architecture enforces physical compute, memory, and undo isolation between transactional writes and analytical reads. The primary database handles only OLTP DML and latency-sensitive point lookups. Redo streams continuously via Data Guard transport (NSS/RFS processes) to one or more Active Data Guard physical standbys running in READ ONLY WITH APPLY mode, where the Managed Recovery Process (MRP) applies changes in real time.

Recommended architecture showing client pools, CMAN-TDM, role-pinned services, and Active Data Guard standby

Three architectural mechanisms make the split transparent and safe for applications:

  1. Role-Pinned Database Services: Using srvctl, administrators define svc_oltp_primary with -role PRIMARY and svc_analytics_ro with -role PHYSICAL_STANDBY. Clusterware starts each service only on the database currently holding that role, so a Data Guard switchover or failover automatically moves services to the right hosts.
  2. Standby Temporary Undo (TEMP_UNDO_ENABLED = TRUE): Analytical queries frequently materialize global temporary tables or spill hash joins and sorts. Setting TEMP_UNDO_ENABLED = TRUE on the standby redirects temporary-table undo into the standby’s local temporary tablespace rather than generating undo or redo dependencies against the primary.
  3. Freshness Bounds and Proxy Routing: Applications route traffic either through Oracle Connection Manager in Traffic Director Mode (CMAN-TDM) or through an application-tier routing DataSource (for example, Spring’s AbstractRoutingDataSource inspecting @Transactional(readOnly = true)). Sessions on the standby enforce STANDBY_MAX_DATA_DELAY so queries abort cleanly with ORA-03172 rather than serving stale data beyond SLA. When geographical separation between the primary and reporting regions adds network round-trip latency, an Oracle Far Sync instance placed near the primary receives synchronous redo locally and ships asynchronously to the remote Active Data Guard standby, keeping primary commit latency isolated from WAN distance.

1. Role-Pinned Services and Standby Configuration

Define the role-aware services in Clusterware and configure standby read consistency controls:

# Primary OLTP service (runs only when database is in PRIMARY role)
srvctl add service -db PRODDB \
  -service svc_oltp_primary \
  -role PRIMARY \
  -notification TRUE \
  -failovertype TRANSACTION \
  -commit_outcome TRUE

# Analytical read-only service (runs only when database is PHYSICAL_STANDBY)
srvctl add service -db PRODDB \
  -service svc_analytics_ro \
  -role PHYSICAL_STANDBY \
  -notification TRUE \
  -clbgoal LONG \
  -rlbgoal THROUGHPUT

srvctl start service -db PRODDB -service svc_oltp_primary

On the Active Data Guard standby, ensure Standby Redo Logs (SRLs) are configured at the same size as the primary online redo logs with at least one more group per primary thread (online_groups + 1) so real-time apply never stalls waiting for log archival. Then enable local temporary undo and open the database in READ ONLY WITH APPLY:

-- Isolate temporary table undo on the standby's local TEMP tablespace
ALTER SYSTEM SET TEMP_UNDO_ENABLED = TRUE SCOPE=BOTH;

-- Open standby read-only and start Real-Time Apply
ALTER DATABASE OPEN READ ONLY;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

-- Enforce session-level lag SLA (e.g., via logon trigger for svc_analytics_ro)
-- Raises ORA-03172 if apply lag exceeds 15 seconds
ALTER SESSION SET STANDBY_MAX_DATA_DELAY = 15;

2. Oracle Connection Manager (cman.ora) Traffic Director Mode

Configure CMAN-TDM (TDM = YES) to proxy and filter client connections by target service name and enforce session timeouts:

cman_router =
  (CONFIGURATION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = cman-proxy.corp.internal)(PORT = 1521))
    (PARAMETER_LIST =
      (TDM = YES)
      (MAX_GATEWAY_PROCESSES = 16)
      (MIN_GATEWAY_PROCESSES = 4)
    )
    (RULE_LIST =
      (RULE =
        (SRC = 10.0.0.0/8)
        (DST = *)
        (SRV = svc_analytics_ro)
        (ACT = accept)
        (ACTION_LIST = (SESSION_TIMEOUT = 14400))
      )
      (RULE =
        (SRC = 10.0.0.0/8)
        (DST = *)
        (SRV = svc_oltp_primary)
        (ACT = accept)
        (ACTION_LIST = (SESSION_TIMEOUT = 3600))
      )
    )
  )

3. Application-Tier Read-Write Splitting (Spring / HikariCP)

For microservices using Spring transaction boundaries, route @Transactional(readOnly = true) methods to the standby pool while defaulting all write and read-your-writes paths to the primary pool:

public class TransactionRoutingDataSource extends AbstractRoutingDataSource {
    @Override
    protected Object determineCurrentLookupKey() {
        boolean isReadOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly();
        return isReadOnly ? DataSourceType.READ_ONLY_STANDBY : DataSourceType.READ_WRITE_PRIMARY;
    }
}

Ensure that TransactionRoutingDataSource wraps a LazyConnectionDataSourceProxy in Spring so the transaction’s readOnly flag is evaluated before a physical JDBC connection is borrowed from HikariCP.

How It Rolls Out

Roll out read-write decoupling in four gated phases so licensing, redo transport, and switchover behavior are verified before production BI traffic moves.

Four-phase rollout from standby preparation and role services to routing SLA validation and report cutover

  1. Phase 1 — Standby Preparation and Licensing Verification: Confirm Active Data Guard licensing entitlement, verify Standby Redo Logs (SRLs) match or exceed primary online redo log groups, set TEMP_UNDO_ENABLED = TRUE, and open the standby in READ ONLY WITH APPLY.
    • Validation gate: Query V$DATABASE (OPEN_MODE = 'READ ONLY WITH APPLY') and V$DATAGUARD_STATS (apply lag within target SLA).
    • Rollback: Cancel MRP, reopen in MOUNT state, and restart MRP without real-time query if licensing or stability issues appear.
  2. Phase 2 — Role-Pinned Service Creation: Create svc_oltp_primary (-role PRIMARY) and svc_analytics_ro (-role PHYSICAL_STANDBY) via srvctl and test a planned Data Guard switchover in staging.
    • Validation gate: Confirm services start automatically on the correct post-switchover hosts without manual intervention.
    • Rollback: Stop and remove the new services via srvctl; existing connections continue using legacy services.
  3. Phase 3 — Proxy Routing and Lag SLA Enforcement: Deploy CMAN-TDM behind a load balancer and enable STANDBY_MAX_DATA_DELAY in reporting sessions (or a logon trigger scoped to svc_analytics_ro). Test application fallback behavior when ORA-03172 is raised.
    • Validation gate: Simulate standby apply lag in staging and confirm ORA-03172 triggers either controlled retry or primary fallback for critical reads.
    • Rollback: Point client TNS aliases directly to the primary SCAN listener and bypass CMAN-TDM.
  4. Phase 4 — Analytical Workload Cutover: Migrate BI dashboards, scheduled reports, and long-running ad-hoc SQL clients from the primary service to svc_analytics_ro, starting with the longest-running queries first.
    • Validation gate: Confirm ORA-01555 errors cease on the primary alert log and primary buffer cache hit ratios stabilize without full-table-scan spikes.
    • Rollback: Revert the BI tool’s service name back to the primary service while keeping TEMP_UNDO_ENABLED intact.

In Practice

Based on how Oracle Data Guard, MVCC, and CMAN-TDM operate in production:

  • Why standbys avoid primary undo wrap-around: On an Active Data Guard standby, MRP applies redo sequentially from the primary, and read-only sessions reconstruct consistent views using the standby’s own SCN progression without competing against local OLTP INSERT/UPDATE/DELETE undo allocation. Enabling TEMP_UNDO_ENABLED = TRUE ensures that sorting, hash-join spills, and global temporary table writes on the standby stay inside local temporary segments.
  • Bounding stale reads with STANDBY_MAX_DATA_DELAY: When a session sets ALTER SESSION SET STANDBY_MAX_DATA_DELAY = 15, Oracle checks apply lag before executing each query. If lag exceeds 15 seconds, the query fails immediately with ORA-03172: STANDBY_MAX_DATA_DELAY of 15 seconds exceeded rather than silently returning stale balances. Applications that require strict read-your-writes immediately after a mutation must still pin post-write reads to svc_oltp_primary rather than relying on an asynchronous standby.
  • Handling stray writes on a read-only standby: Any INSERT, UPDATE, or DELETE accidentally routed to svc_analytics_ro fails with ORA-16000: database or pluggable database open for read-only access. Starting in Oracle 19c, setting ADG_REDIRECT_DML = TRUE transparently tunnels occasional DML statements back to the primary over an internal link and waits for redo apply before returning—useful for legacy reporting tools that write small audit rows, though unsuitable for heavy OLTP writes (and unsupported inside XA transactions).
  • Monitoring redo transport and lag: Query V$DATAGUARD_STATS on the standby for transport lag and apply lag, and query V$REDO_DEST_RESP_HISTOGRAM on the primary alongside transport wait events (LNS wait on SENDREQ in older releases, NSS sync / TTnn async transport waits in 12c+) to catch network bottlenecks early.

Where It Breaks

Decoupling reads onto a physical standby shifts failure modes from local undo exhaustion to replication lag, DDL coordination, and proxy availability.

Three failure paths of standby read-write splitting: apply lag staleness, primary DDL conflicts, and stray DML

ConditionBreaks howDetectMitigate
Standby apply lag spikeBurst primary DML or slow standby I/O delays MRP; reads return stale data or abort with ORA-03172.Query V$DATAGUARD_STATS (apply lag) and alert on ORA-03172 spikes.Set STANDBY_MAX_DATA_DELAY per SLA; route read-your-writes sessions to svc_oltp_primary.
Primary partition DROP or TRUNCATEDestructive partition DDL invalidates segments currently scanned by a standby query, raising ORA-01555 or ORA-08103.Alert on ORA-01555 / ORA-08103 on the standby during maintenance windows.Schedule partition drops outside peak BI windows; use ALTER SESSION SET DDL_LOCK_TIMEOUT on primary.
Unlicensed Active Data Guard usageOpening a physical standby READ ONLY while MRP is active triggers ADG license feature tracking.Audit DBA_FEATURE_USAGE_STATISTICS for Active Data Guard.Verify ADG license entitlements before opening any standby in READ ONLY WITH APPLY.
Standby SGA or TEMP exhaustionConcurrent multi-pass hash joins or huge table scans thrash standby SGA and fill TEMP (ORA-01652).Monitor ORA-01652 and standby V$TEMPSEG_USAGE / AWR wait events.Enforce Database Resource Manager (DBRM) consumer groups and size standby TEMP for peak concurrency.
Single CMAN-TDM proxy outageA single proxy VM failure drops all routed primary and standby client connections simultaneously.Health-check failures on port 1521 at the proxy tier.Deploy CMAN-TDM in an active-active pair behind a network load balancer with health probes.
Stray DML routed to standbyMisconfigured application pool sends INSERT/UPDATE to svc_analytics_ro and hits ORA-16000.Application error logs showing ORA-16000 on read-only pools.Fix @Transactional(readOnly = true) boundaries; enable ADG_REDIRECT_DML = TRUE only for occasional audit writes.
Redo transport congestionNetwork packet loss or small DEFAULT_SDU_SIZE stalls SYNC commits (log file sync) or widens ASYNC lag.Monitor V$REDO_DEST_RESP_HISTOGRAM and NSS/LNS wait on SENDREQ events.Separate redo transport onto dedicated NICs, tune DEFAULT_SDU_SIZE=32767, and place SRLs on fast storage.

Key Takeaways

  • Undo sizing cannot fix cache pollution: Expanding UNDOTBS and raising UNDO_RETENTION only delays ORA-01555 wrap-around; it never stops analytical full-table scans from evicting hot OLTP blocks from the primary SGA.
  • Never use RETENTION GUARANTEE on an OLTP primary: Guaranteeing undo retention for long-running queries converts reporting failures into ORA-30036 write outages for customer-facing OLTP transactions.
  • Role-pinned services keep Data Guard switchovers automatic: Binding svc_oltp_primary to PRIMARY and svc_analytics_ro to PHYSICAL_STANDBY via srvctl ensures traffic follows the active role without manual TNS edits.
  • Enforce freshness explicitly with STANDBY_MAX_DATA_DELAY: Rather than letting dashboards silently read lagging data, bound staleness at the session level (ORA-03172) and pin read-your-writes sessions to the primary.
  • Verify licensing and DDL windows before cutover: Active Data Guard requires explicit licensing for READ ONLY WITH APPLY, and primary DROP/TRUNCATE PARTITION operations must still be coordinated around active standby scans.

What to Do Next

  • Problem: Co-locating long-running analytical queries with high-velocity OLTP writes on a single Oracle primary exhausts circular undo (ORA-01555) and evicts hot OLTP buffers from the SGA.
  • Solution: Offload analytical and reporting workloads to an Active Data Guard physical standby using role-pinned srvctl services, TEMP_UNDO_ENABLED = TRUE, STANDBY_MAX_DATA_DELAY, and CMAN-TDM or application-tier read/write routing.
  • Proof: Primary ORA-01555 alerts drop to zero, primary buffer cache hit ratios stabilize without full-scan eviction, and V$DATAGUARD_STATS confirms apply lag stays within your STANDBY_MAX_DATA_DELAY threshold.
  • Action: Audit your primary AWR “SQL ordered by Elapsed Time” report this week, verify Active Data Guard licensing on your existing physical standby, and migrate your top long-running reporting queries onto a PHYSICAL_STANDBY service.