Oracle Data Guard Standby Redo Log Query: Groups and Members

List All Standby Redo Logs in Oracle Data Guard

Purpose

A switchover attempted on a busy Friday afternoon reveals the gap: the standby has been synchronized for months, but no standby redo log group was sized to match the primary's 500 MB online redo logs. The configuration worked fine for the archived-log transport model, but enabling real-time apply requires SRL groups that were never created. The query below surfaces exactly this class of misconfiguration before it becomes a switchover incident.

V$STANDBY_LOG and V$LOGFILE together hold the complete picture of standby redo log (SRL) configuration. V$STANDBY_LOG reports each group's sequence number, size in bytes, thread assignment, and operational status. V$LOGFILE holds the physical member paths. Joining them on GROUP# gives a DBA the full inventory: how many groups exist, how large each is, and where the files live on disk. This is the foundational check before a switchover, before adding real-time apply, or when log shipping shows unexpected delays.

Standby redo logs are distinct from online redo logs. They are written by the Remote File Server (RFS) process on the standby, not by the Log Writer (LGWR). On the primary, redo transport processes (TTnn for ASYNC, NSSn for SYNC) ship redo to the standby's RFS, which writes it into SRL groups. The Managed Recovery Process (MRP) then reads from those groups and applies the changes. When real-time apply is active, MRP applies redo as it is received, without waiting for the current standby redo log to be archived.

Code

 1set lines 120 pages 999
 2col member format a70
 3select
 4    st.group#
 5    ,st.sequence#
 6    ,ceil(st.bytes / 1048576) mb
 7    ,lf.member
 8from
 9    v$standby_log st
10    ,v$logfile lf
11where
12    st.group# = lf.group#
13/

For a more complete diagnostic view that includes STATUS and THREAD# — essential in RAC configurations and when investigating log-shipping delays:

 1set lines 160 pages 999
 2col member  format a60
 3col status  format a12
 4
 5select
 6    st.group#
 7    ,st.thread#
 8    ,st.sequence#
 9    ,ceil(st.bytes / 1048576)  mb
10    ,st.status
11    ,lf.member
12from
13    v$standby_log st
14    ,v$logfile lf
15where
16    st.group# = lf.group#
17order by
18    st.thread#, st.group#
19/

Code Breakdown

SQL*Plus formatting

set lines 120 pages 999 sets a 120-character line, wide enough for three number columns (10 characters each by default) plus the 70-character member column, and prints column headings only once every 999 lines. col member format a70 allocates 70 characters to the file-path column, which covers most standard mount-point naming conventions. Extend it to a80 or longer if your SRL paths use deep directory trees.

Driving view: V$STANDBY_LOG

v$standby_log contains one row per standby redo log group, not per member file. Key columns in this query:

  • group# — the group identifier. SRL groups share one GROUP# number space with the online redo log groups, so each SRL group needs a number no online group uses: groups 4, 5, and 6 on a standby that has online groups 1, 2, and 3 is a normal configuration.
  • sequence# — the redo sequence number written to this group in its most recent use. Oracle's own example output shows never-used groups with a sequence of zero. The documented test for a never-used group is STATUS = 'UNASSIGNED' with ARCHIVED = 'YES'.
  • ceil(st.bytes / 1048576) — converts the raw byte count to megabytes, rounding up. CEIL rounds any partial megabyte up, so a log is never under-reported. That matters when comparing against the primary's v$log.bytes to verify the sizing rule is met.
  • thread# (extended query) — the redo thread the group serves. In a single-instance Data Guard pair, every group that has received redo shows thread 1; a group created without a THREAD clause that has never been used shows THREAD# 0. In a RAC primary with two active nodes, each thread needs its own dedicated SRL groups on the standby; thread 2 redo cannot land in a group assigned to thread 1.
  • status (extended query) — the state of the group: UNASSIGNED (available: either archived and free again, or never used) or ACTIVE (either currently being written to, or complete and waiting to be archived — check the ARCHIVED column to tell which). All groups showing UNASSIGNED while log shipping is expected to be active means redo is not landing in the standby redo logs: RFS is writing it straight to archived log files, for example because no SRL group of a usable size exists for that thread.

The join: V$LOGFILE

v$logfile holds one row per physical log member, not per group. Its TYPE column carries 'STANDBY' for SRL members and 'ONLINE' for online redo log members. The join on st.group# = lf.group# — combined with the fact that v$standby_log only contains standby group numbers — returns SRL members only. No explicit TYPE = 'STANDBY' filter is required, but adding one makes the intent unambiguous in production scripts shared with a team.

The member column shows the full operating-system path of each physical file. This is what a storage or capacity team needs to locate the files, verify the mount point, or move them to faster storage.

Key Points

  • SRL sizing rule: each SRL group must be at least as large as the largest online redo log group on the primary. Run SELECT group#, CEIL(bytes/1048576) mb FROM v$log ORDER BY group# on the primary and compare against this query's output to verify compliance.
  • Group count formula: Oracle's rule is at least (online redo log groups per thread) + 1 SRL groups per thread on the standby. A primary with three online redo log groups needs at least four SRL groups on each standby. Too few groups and RFS finds no free SRL, so it writes the incoming redo straight to an archived log file instead: real-time apply stops for that log and a zero data loss failover may not be possible.
  • Single-member SRL groups are common but not optimal. This query shows exactly one member row per group when each group was created with one file — one physical file, one point of failure. Adding a second member to each group mirrors the protection that multiplexed online redo logs give the primary.
  • Maximum protection and maximum availability modes depend on SRLs. These modes use synchronous redo transport. Without enough SRL groups, the standby may become unsynchronized after a primary log switch, which could prevent a zero data loss failover or cause a primary in maximum protection mode to shut down.
  • SRL groups are reused, not consumed. When the primary switches logs, RFS moves on to the next SRL group and an ARCn process archives the one just filled; the group then returns to UNASSIGNED. The group itself is kept and reused for later redo.
  • A STATUS of ACTIVE when no shipping is in progress needs a second look. With ARCHIVED = NO it means the log is complete and waiting for an ARCn process to archive it; if it stays that way, check the standby's archive destination (space, state in V$ARCHIVE_DEST_STATUS) and the alert log for archiver errors.

Insights and Best Practices

Confirm sizing against the primary before enabling real-time apply

Before starting Redo Apply with ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT (real-time apply is the default from 12.1; USING CURRENT LOGFILE is deprecated), compare the MB column from this query on the standby against the primary's v$log sizes. Every SRL group on the standby must be >= the largest value from the primary. An undersized SRL group is not used at all: RFS writes that redo straight to an archived log file, so real-time apply silently stops working for it. Oracle's MAA guide recommends making SRLs the same size as the online logs, to the byte.

Size for peak load, not average load

The primary's redo generation rate spikes during batch loads, partition moves, and bulk inserts. The sizing rule refers to the log file size, not the average redo rate. If the primary's online redo logs are 200 MB but frequent log switches occur during batch windows, consider increasing both the primary's online redo log size and the standby SRL size to 500 MB or 1 GB. Fewer log switches reduce transport overhead and the frequency of SRL group transitions on the standby.

RAC: verify one set of SRL groups per active thread

In a RAC primary with two active threads, the standby needs two independent sets of SRL groups — one set for thread 1 and one for thread 2. The extended query's THREAD# column confirms this at a glance. A standby with all three groups assigned to thread 1 has no SRL for thread 2: RFS writes thread 2 redo straight to archived log files, so that thread gets no real-time apply and the zero data loss protection of SRLs is lost for it.

Multiplex SRL members on separate storage

The member column reveals the multiplexing factor for each group. A group that returns only one row in this output has a single member — a single point of failure on the standby's storage. Add a second member to each SRL group on a separate volume with ALTER DATABASE ADD STANDBY LOGFILE MEMBER '/u02/oradata/standby/srl_0n_b.log' TO GROUP n. The per-group row count in this query increases to two when multiplexing is in place.

Run this check before every switchover and every real-time apply enablement

Add this query to every pre-switchover checklist. A healthy pre-switchover result shows all groups UNASSIGNED except at most one ACTIVE per thread: the group currently receiving that thread's redo. Any group stuck ACTIVE when shipping is not in progress, or a total UNASSIGNED count below (online log groups per thread), is a configuration issue to resolve before the role transition.

When to Use This Check

  • Pre-switchover and pre-failover validation to confirm SRL count, sizing, and member paths are correct.
  • After adding or removing standby databases in a multi-standby environment — each new standby needs its own SRL groups.
  • When log shipping latency increases unexpectedly — check whether RFS is finding a free SRL group or writing redo straight to archived log files.
  • Before enabling real-time apply on a standby that has been running in archived-log-only mode.
  • After any primary redo log resize — the standby SRL groups must be resized to match.
  • When the standby alert log shows RFS errors or warnings that mention standby redo logs.

Troubleshooting Common Issues

When this query returns zero rows, the standby has no SRL groups configured. Archived-log transport and apply will continue to work, but real-time apply and maximum protection or maximum availability modes are unavailable. Create SRL groups with ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 GROUP n ('/path/to/srl.log') SIZE <bytes>, where <bytes> matches or exceeds the primary's largest online redo log size.

When a group shows STATUS = 'ACTIVE' but the primary is not shipping redo — for example, during a period when the standby was disconnected — check the ARCHIVED column first. With ARCHIVED = 'NO' the log is complete and waiting for an ARCn process to archive it; if it stays that way, check the standby's archive destination (space, state in V$ARCHIVE_DEST_STATUS) and the alert log for archiver errors. Oracle's ALTER DATABASE reference describes CLEAR LOGFILE as a way to reinitialize an online redo log and says not to use it on a log needed for media recovery; it does not describe its effect on a standby redo log's status. Treat it as a last resort, and clear only an SRL group you are certain is not holding redo that has not yet been applied.

If the query returns more rows than expected groups — for example, six rows for three groups — each group has two member files and is correctly multiplexed. Divide the total row count by the distinct GROUP# count to confirm the multiplexing factor.

If STATUS shows ACTIVE for multiple groups, check ARCHIVED: YES means the group is being written now (one per thread, so one per RAC thread is normal); NO means it is complete and waiting to be archived. In a single-instance primary, only one group per thread should be ACTIVE with ARCHIVED = 'YES'. Other ACTIVE groups with ARCHIVED = 'NO' are complete logs still waiting to be archived; check the standby's archiving.

References

Posts in this series