ONECLICKDBA

Rebuild a 19c Data Guard standby with RMAN and verify redo end to end

Rebuild a physical standby with RMAN, verify Broker connectivity, and use a lab to distinguish received redo from applied redo.

A successful RMAN duplicate leaves you with a mounted standby. My acceptance test is to generate a new redo sequence on the primary and see that exact sequence arrive and apply on the standby. I also rehearse the intermediate state with apply paused, so I know the checks can distinguish a healthy transport path from a healthy apply path.

This runbook combines two sets of notes from a 12c rebuild and its failure log, dated 9 and 10 June 2018. The original environment used RAC and ASM. The walkthrough uses an Oracle Database 19c CDB on two single-instance hosts, Oracle Managed Files (OMF) on separate filesystems, and an existing Data Guard Broker configuration. For this lab the primary is healthy, redo transport is asynchronous, and the standby remains mounted. Hostnames, paths, and example output are illustrative.

Choose a rebuild and record the recovery inputs

If the current standby has usable datafiles, first check whether a missing archive can be supplied or whether RECOVER STANDBY DATABASE FROM SERVICE can roll it forward. A fresh duplicate is appropriate when you need to replace the standby copy and have a viable primary backup and redo chain.

From the primary root, record its identity and redo incarnation. Run the same identity query against the old standby if it still mounts.

SQL
SELECT dbid, name AS db_name, db_unique_name, database_role, open_mode,
       log_mode, force_logging, resetlogs_change#
FROM v$database;

SHOW PARAMETER compatible
SHOW PARAMETER log_archive_config

The example primary is DGPRIM, the standby is DGSTBY, and the shared DB_NAME is LABDB. The two sides of a physical standby pair share the primary’s DBID. A mismatch in DB_NAME can prevent the restored standby control file from mounting. A mismatch in DB_UNIQUE_NAME can prevent transport even after the mount succeeds.

Save the Broker configuration and standby parameter file, and capture the primary’s destination state and the Oracle Restart or Clusterware resource where applicable. If the old standby is still available, put it in APPLY-OFF through Broker before shutting it down. Disable any service or resource capable of starting the old instance during the rebuild, and keep the old files isolated from the auxiliary’s storage. Establish how the temporary loss of this standby affects protection and automatic failover before taking a live member out of service.

In RMAN on the primary, list the candidate datafile backups and archived redo for the recovery window. Confirm that the selected backup pieces and required redo are available, readable, and from the expected database and incarnation. Dates in the filenames alone cannot establish recoverability. For this target-connected example, copy the required disk pieces to the standby host at the paths recorded in the source RMAN repository. Compare a transfer manifest or checksums before starting. Include standby-control-file backup availability in the preflight, and make any TDE keystore and required keys available under the standby’s Oracle configuration.

Oracle 19c standby creation with RMAN · Backup-based duplication prerequisites · Roll forward an existing standby

Start the auxiliary and duplicate from backup

Prepare a standby parameter file from a reviewed baseline. This excerpt shows the settings that establish identity and OMF placement for the example. Also configure the memory, diagnostic and audit settings for the host, create the destination directories with appropriate ownership and permissions, and make sure Oracle can write there. Match the primary’s actual COMPATIBLE value. Use the same supported 19c patch level for the lab.

Configuration
*.db_name='LABDB'
*.db_unique_name='DGSTBY'
*.enable_pluggable_database=TRUE
*.compatible='19.0.0'
*.db_create_file_dest='/oradata/dgstby'
*.db_recovery_file_dest='/fra/dgstby'
*.db_recovery_file_dest_size=200G
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.dg_broker_start=FALSE

Copy the primary password file into the site’s standby password-file location. Verify the Oracle environment on the standby before the local auxiliary connection. Create the SPFILE in the normal location for this single-instance lab so an RMAN restart can find it. Review any existing default SPFILE or pointer first so the instance starts with the intended file. For ASM or Clusterware-managed deployments, confirm that both SQL startup and the resource point to the same SPFILE and password file.

SQL
-- SQL*Plus on the standby host, connected locally as SYSDBA
-- Confirm ORACLE_SID points to the intended idle auxiliary first.
CREATE SPFILE FROM PFILE='/u01/app/oracle/admin/DGSTBY/initDGSTBY.ora';
STARTUP NOMOUNT;

SHOW PARAMETER spfile
SHOW PARAMETER db_unique_name
SHOW PARAMETER db_create_file_dest
SHOW PARAMETER db_recovery_file_dest

From RMAN on the standby host, connect to the primary through the DGPRIM Oracle Net alias and to the local auxiliary using OS authentication. The standby reuses the SPFILE you just checked.

Text
CONNECT TARGET sys@DGPRIM;
CONNECT AUXILIARY /;

DUPLICATE TARGET DATABASE
  FOR STANDBY
  DORECOVER;

DORECOVER applies redo available to RMAN during duplication. It leaves the database mounted. Check the destination role, database identity and all restored paths before enabling continuous apply. Paths in the control file are especially important when the rebuilt standby uses a different ASM disk group or filesystem namespace.

SQL
SELECT dbid, name, db_unique_name, database_role, open_mode, controlfile_type
FROM v$database;

SELECT name FROM v$controlfile;
SELECT file#, name FROM v$datafile ORDER BY file#;
SELECT group#, type, member FROM v$logfile ORDER BY group#, member;

Expect the standby unique name, PHYSICAL STANDBY, and MOUNTED. For each source redo thread, compare the primary’s online redo log group count and size with the standby redo logs. Provision at least one more standby group per thread than the corresponding online group count, with members sized to match the primary configuration. In RAC, run this comparison for every thread rather than comparing just the totals across the database.

SQL
-- Primary
SELECT thread#, COUNT(*) AS online_groups, MIN(bytes), MAX(bytes)
FROM v$log
GROUP BY thread#;

-- Standby
SELECT thread#, COUNT(*) AS standby_groups, MIN(bytes), MAX(bytes)
FROM v$standby_log
GROUP BY thread#;

Oracle 19c redo transport and standby redo logs

For example, if thread 1 has three 512 MiB online groups, the rebuilt standby needs at least four 512 MiB standby groups. The following adds one missing group using OMF. Choose the size and number of groups from the observed inventory. Check the same coverage on the current primary if it is expected to take the standby role later.

SQL
ALTER DATABASE ADD STANDBY LOGFILE THREAD 1 SIZE 512M;

Verify transport before resuming apply

Enable Broker after checking the restored file layout and standby redo logs. If the previous standby’s Broker configuration files lived on storage you are replacing, reconcile the member from the existing primary-side configuration. Check the standby’s Broker configuration file locations before starting DMON.

SQL
-- Rebuilt standby
ALTER SYSTEM SET dg_broker_start = TRUE SCOPE=BOTH;

Connect DGMGRL to the primary. Verify that the standby connect identifiers resolve to the intended host and that the primary is in TRANSPORT-ON. Leave the standby in APPLY-OFF for the first half of this disposable lab test.

Text
SHOW CONFIGURATION;
SHOW DATABASE VERBOSE 'DGSTBY';
VALIDATE NETWORK CONFIGURATION FOR 'DGSTBY';
VALIDATE STATIC CONNECT IDENTIFIER FOR 'DGSTBY';
EDIT DATABASE 'DGSTBY' SET STATE='APPLY-OFF';

Generate a small committed change on the lab primary, then archive the current redo. In a quiet lab, record the current thread and sequence immediately before and after the change. If a switch occurred during the change, begin again with a fresh marker in a stable sequence. Run the archive command from the root and record the exact archived row for that thread, sequence, and resetlogs SCN.

SQL
-- Primary, record before and after the committed change
SELECT thread#, sequence# FROM v$log WHERE status = 'CURRENT';
ALTER SYSTEM ARCHIVE LOG CURRENT;

SELECT thread#, sequence#, resetlogs_change#, first_change#, next_change#
FROM v$archived_log
WHERE thread# = &test_thread
  AND sequence# = &test_sequence
  AND resetlogs_change# = (SELECT resetlogs_change# FROM v$database)
  AND standby_dest = 'NO'
  AND archived = 'YES';

Keep the three identifiers from that row. Query the standby for the same redo. The SQL*Plus substitution values below come from the primary.

SQL
-- Standby, run before and after enabling apply
SELECT thread#, sequence#, resetlogs_change#, registrar, applied, completion_time
FROM v$archived_log
WHERE thread# = &test_thread
  AND sequence# = &test_sequence
  AND resetlogs_change# = &test_resetlogs_scn
  AND registrar = 'RFS'
ORDER BY completion_time;

The first expected result is an RFS row with APPLIED = 'NO'. If there is no row after the log has archived and transport has had time to catch up, investigate transport before touching apply. Identify the relevant destination on the primary by DB_UNIQUE_NAME, then examine its status and error text. A listener ping alone does not establish authentication or transport.

SQL
-- Primary
SELECT dest_id, db_unique_name, status, error, destination
FROM v$archive_dest
WHERE db_unique_name = 'DGSTBY';

Show that the same redo applied

Text
EDIT DATABASE 'DGSTBY' SET STATE='APPLY-ON';
VALIDATE DATABASE VERBOSE 'DGSTBY';
SHOW DATABASE 'DGSTBY';

Poll the same standby query for APPLIED = 'YES'. During convergence, IN-MEMORY indicates that redo has been applied in memory and the datafiles have yet to be updated. Watch the process and lag views alongside the per-log check.

SQL
SELECT role, action, thread#, sequence#
FROM v$dataguard_process
ORDER BY role, thread#;

SELECT name, value, datum_time, time_computed
FROM v$dataguard_stats
WHERE name IN ('transport lag', 'apply lag');

SELECT thread#, low_sequence#, high_sequence#
FROM v$archive_gap;

During ongoing primary activity, compare DATUM_TIME across samples. A zero lag with a stale datum timestamp does not prove that the standby is receiving new data. V$ARCHIVE_GAP exposes the gap currently blocking recovery. Check again after resolving a gap, and use the fresh sequence test even when the view returns no rows. In RAC, repeat the sequence check for each active source thread.

The evidence should look like this. The values illustrate the same log at two checkpoints.

Checkpoint Thread Sequence Resetlogs SCN Registrar Applied
Apply paused, transport active 1 284 919004 RFS NO
Apply resumed and caught up 1 284 919004 RFS YES

Archived redo status · Standby lag metrics · Broker CLI reference

Diagnose the failure where it first appears

The 12c notes are useful here because the outer RMAN failure often looked the same. In each case I read down the stack to the first specific Oracle error and match it to the operation that failed.

Error from the original notes Check before retrying
ORA-01103 while mounting the standby control file Check the auxiliary’s live DB_NAME, the PFILE or SPFILE actually used at startup, and the source of the restored control file. Keep the standby’s distinct identity in DB_UNIQUE_NAME.
RMAN-05537 during duplicate startup Check all three conditions together. The run has no TARGET connection, the auxiliary is already using an SPFILE, and the command requests SPFILE. Choose one parameter-file strategy, verify it in the RMAN session, and then retry.
RMAN-04014 with ORA-09925 Read the OS error below the Oracle error. Check that the configured audit destination exists and is writable by the Oracle software owner, with room and inodes available. Re-test auxiliary startup before asking RMAN to copy files again.
ORA-17503 with ORA-00312 and ORA-15012 Identify the failing redo member in V$LOGFILE. The source case referred to an ASM file that did not exist on the standby. Compare the control-file entries with the intended OMF or explicit redo placement and verify disk-group access.
ORA-16053 while configuring transport Compare the member names in LOG_ARCHIVE_CONFIG with the destination’s DB_UNIQUE_NAME and Broker membership. Correct the intended member configuration through the tool that manages it.
ORA-16055 during a gap request Check the requesting standby identity and the serving database’s alert log for the reason it rejected FAL. Verify the named service, destination state and availability of the requested archived sequence. A useful next observation is whether normal transport receives new logs while the gap remains.

I close the rebuild after recording the restored database identity and role, the exact thread, sequence and incarnation received, and the same redo applied. I also verify that lag is back within the agreed range and the measurements are fresh. I keep the RMAN log and the before-and-after Broker and SQL output together so the next DBA can reconstruct which step worked and where the time went.

Oracle Data Guard troubleshooting guide

UNDERSTAND FIRST

Start with a free 30-minute initial assessment.

Book a free initial assessment