Testing Releases on Real Data with a Snapshot Standby in Another Cloud
The best test database is a copy of production, but a full copy of a multi-terabyte database costs storage, time and a refresh process nobody enjoys. If you already run a Data Guard physical standby, you have that copy. A snapshot standby turns it into a read-write database for as long as a test takes, and then discards every change and becomes a standby again.
The standby keeps receiving redo from the primary while it is a snapshot standby, so you do not lose protection against data loss. This post converts a standby that runs on Azure, while the primary runs on OCI, tests a release on it, and converts it back, with the checks that make it safe.
The Use Case
An application team wants to run the database scripts of a new release, and its batch jobs, against real production data before the release weekend. Production runs on OCI; the physical standby runs on Azure, close to the team's test application servers. The test needs about six hours and must not affect the primary or leave anything behind on the standby.
Environment used in this runbook
Primary: SALES_OCI, Oracle Database 19c (19.24) on an OCI virtual machine
Standby: SALES_AZURE, Oracle Database 19c (19.24) on an Azure virtual machine, managed by the Data Guard broker
Database size: 3.1 TB, redo generation about 40 GB per hour at peak
Test window: six hours, from 09:00 on the test day
Licence: snapshot standby is part of Data Guard, included with Enterprise Edition; no Active Data Guard licence is needed for it
How a Snapshot Standby Works
A guaranteed restore point is created on the standby when you convert it. It marks the point the database will return to.
The database opens read write. Users and scripts can change anything, including running DDL.
Redo keeps arriving from the primary and is archived on the standby, but it is not applied while the database is a snapshot standby.
Converting back flashes the database back to the restore point, discarding every test change, and then applies all the redo that arrived in the meantime.
Step 1: Check the Data Guard Configuration
Convert only from a healthy configuration. If the broker already reports warnings, fix them first, because you are about to make this standby fall behind on purpose.
Shell |
# On the standby host, as oracle dgmgrl / "show configuration" dgmgrl / "show database 'SALES_AZURE'" |
Expected output |
Configuration - sales_dg
Protection Mode: MaxPerformance
Members:
SALES_OCI - Primary database
SALES_AZURE - Physical standby database
Fast-Start Failover: Disabled
Configuration Status:
SUCCESS (status updated 37 seconds ago)
Database - SALES_AZURE
Role: PHYSICAL STANDBY
Intended State: APPLY-ON
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 0 seconds (computed 1 second ago)
Average Apply Rate: 18.42 MByte/s
Real Time Query: OFF
Instance(s):
SALES1
Database Status:
SUCCESSWhat to expect: Configuration Status SUCCESS, no lag, and fast-start failover disabled. If fast-start failover is enabled with this standby as its target, the broker will not convert it: choose another target, or disable fast-start failover for the test window with your change process.
Step 2: Check Space in the Fast Recovery Area
While it is a snapshot standby, the database keeps flashback logs for every block the test changes, and it stores all the redo arriving from the primary. Both land in the fast recovery area. Running out of space there stops redo reception.
SQL |
-- On the standby COLUMN name FORMAT A12
SELECT name, ROUND(space_limit/1024/1024/1024) AS limit_gb, ROUND(space_used/1024/1024/1024) AS used_gb, ROUND(space_reclaimable/1024/1024/1024) AS reclaimable_gb FROM v$recovery_file_dest;
SELECT flashback_on FROM v$database; |
Expected output |
NAME LIMIT_GB USED_GB RECLAIMABLE_GB
------------ ---------- ---------- --------------
+RECO 2048 612 480
FLASHBACK_ON
------------------
NOWhat to expect: Enough free space for the test window. A rough estimate is the redo the primary will send (here up to 40 GB per hour for six hours, so about 240 GB) plus flashback logs for the blocks the test changes (often a similar amount for a heavy batch test). With 2 TB of quota and 612 GB used, there is room. FLASHBACK_ON NO is fine: the guaranteed restore point works without Flashback Database being enabled.
Step 3: Prepare Services for the Snapshot Role
Clusterware-managed services start according to the database role. Production services should not start on the snapshot standby, otherwise a misconfigured client could connect to it thinking it is production. Create a dedicated test service that starts only in the snapshot standby role.
Shell |
srvctl add service -db SALES_AZURE -pdb SALESPDB \ -service sales_test.example.internal -role SNAPSHOT_STANDBY
srvctl config service -db SALES_AZURE | grep -E 'Service name|Service role' |
Expected output |
Service name: sales_app.example.internal
Service role: PRIMARY
Service name: sales_test.example.internal
Service role: SNAPSHOT_STANDBYWhat this does: The production service sales_app only runs where the database is primary, and the new sales_test service only runs when this database is a snapshot standby. The test team gets a connect string with sales_test, so they can only ever reach the test copy. On a database without Grid Infrastructure, start the service manually with DBMS_SERVICE after the conversion instead.
Step 4: Convert the Standby to a Snapshot Standby
The broker does the whole conversion: it stops redo apply, creates the guaranteed restore point, and opens the database read write.
Shell |
dgmgrl / "convert database 'SALES_AZURE' to snapshot standby" |
Expected output |
Converting database "SALES_AZURE" to a Snapshot Standby database, please wait...
Database "SALES_AZURE" converted successfullyWhat to expect: The command returns in under a minute. Nothing changes on the primary: it keeps shipping redo to the same destination.
Step 5: Verify the New Role and the Restore Point
Confirm the database is open read write in the snapshot standby role, and look at the restore point the broker created.
SQL |
COLUMN name FORMAT A45
SELECT database_role, open_mode FROM v$database;
SELECT name, guarantee_flashback_database AS guaranteed, TO_CHAR(time,'YYYY-MM-DD HH24:MI') AS created FROM v$restore_point; |
Expected output |
DATABASE_ROLE OPEN_MODE
---------------- --------------------
SNAPSHOT STANDBY READ WRITE
NAME GUARANTEED CREATED
--------------------------------------------- ---------- ----------------
SNAPSHOT_STANDBY_REQUIRED_10/29/2026 08:58:12 YES 2026-10-29 08:58What to expect: The role SNAPSHOT STANDBY, open READ WRITE, and one guaranteed restore point whose name starts with SNAPSHOT_STANDBY_REQUIRED. Do not drop it: it is what the database returns to. Check that the sales_test service is running with srvctl status service before handing the database over.
Step 6: Confirm That Redo Still Arrives
The value of a snapshot standby over a separate test copy is that production stays protected. Check that the standby still receives redo, even though it is not applying it.
SQL |
COLUMN name FORMAT A14 COLUMN value FORMAT A14
SELECT name, value FROM v$dataguard_stats WHERE name IN ('transport lag', 'apply lag');
SELECT thread#, MAX(sequence#) AS last_received FROM v$archived_log WHERE registrar = 'RFS' GROUP BY thread#; |
Expected output |
NAME VALUE
-------------- --------------
transport lag +00 00:00:00
apply lag +00 01:12:40
THREAD# LAST_RECEIVED
---------- -------------
1 52918What to expect: Transport lag stays at zero while apply lag grows with the time since conversion. That is the expected picture: no committed transaction on the primary is lost if the primary fails, but a failover would take longer, because the standby must first flash back and apply the waiting redo.
Step 7: Run the Release Test
Hand the sales_test connect string to the test team. They run the release scripts, the batch jobs and any validation queries, exactly as they would in production. Keep a simple log of what was done, for the release review.
SQL |
-- Connected through sales_test.example.internal as the release user @release_4_12_schema_changes.sql
SELECT object_type, COUNT(*) AS invalid_objects FROM dba_objects WHERE owner = 'SALES' AND status = 'INVALID' GROUP BY object_type; |
Expected output |
Table altered.
Index created.
PL/SQL procedure successfully completed.
no rows selectedWhat to expect: The release scripts run against a full, current copy of production data, so the timings and the errors are real. Here the schema changes applied cleanly and left no invalid objects. Capture elapsed times for the long-running parts: they tell you how long the real release window needs to be.
Tip: If the test includes a workload replay with Real Application Testing (an extra-cost option), a snapshot standby is an ideal replay target: it starts from exactly the state of production at the moment of conversion.
Step 8: Watch Space During the Test
Check the recovery area during the test, especially during heavy batch jobs. The guaranteed restore point prevents flashback logs from being deleted, so usage only grows until you convert back.
SQL |
SELECT file_type, percent_space_used AS pct_used, percent_space_reclaimable AS pct_reclaimable, number_of_files AS files FROM v$recovery_area_usage WHERE percent_space_used > 0 ORDER BY percent_space_used DESC; |
Expected output |
FILE_TYPE PCT_USED PCT_RECLAIMABLE FILES
----------------------- ---------- --------------- ----------
ARCHIVED LOG 34.12 23.41 1214
FLASHBACK LOG 11.86 0 96
BACKUP PIECE 3.44 0 14
CONTROL FILE 0.05 0 1What to expect: Flashback logs and archived logs growing, with flashback logs not reclaimable while the restore point exists. If the total approaches the limit, either add space to DB_RECOVERY_FILE_DEST_SIZE or end the test early. Never drop the guaranteed restore point to free space: without it the database cannot become a standby again and must be rebuilt.
Step 9: Convert Back to a Physical Standby
When the test is finished, convert the database back. The broker shuts it down, flashes it back to the restore point, discarding every change the test made, converts it to a physical standby, and restarts redo apply.
Shell |
dgmgrl / "convert database 'SALES_AZURE' to physical standby" |
Expected output |
Converting database "SALES_AZURE" to a Physical Standby database, please wait...
Operation requires shut down of instance "SALES1" on database "SALES_AZURE"
Shutting down instance "SALES1"...
Connected to "SALES_AZURE"
Database closed.
Database dismounted.
ORACLE instance shut down.
Operation requires start up of instance "SALES1" on database "SALES_AZURE"
Starting instance "SALES1"...
Connected to an idle instance.
ORACLE instance started.
Connected to "SALES_AZURE"
Database mounted.
Continuing to convert database "SALES_AZURE" ...
Database "SALES_AZURE" converted successfullyWhat to expect: A restart of the standby instance and a successful conversion, usually within a few minutes. All test data is gone. The broker uses its own connection to restart the instance, so make sure the static service registration for the broker (the DGMGRL service in listener.ora, or the equivalent your setup uses) is in place before the test day.
Step 10: Watch the Standby Catch Up
After the conversion, redo apply works through everything that arrived during the test. Follow it until the apply lag is back to normal, then report the configuration healthy.
Shell |
dgmgrl / "show database 'SALES_AZURE'" | grep -E 'Role|Lag|Apply Rate' |
Expected output |
Role: PHYSICAL STANDBY
Transport Lag: 0 seconds (computed 1 second ago)
Apply Lag: 1 hour(s) 38 minutes 12 seconds (computed 1 second ago)
Average Apply Rate: 96.10 MByte/sWhat to expect: Role PHYSICAL STANDBY, transport lag zero, and an apply lag that shrinks quickly, because recovery of archived redo runs much faster than the primary generated it. Re-run the command until the apply lag is a few seconds. Then check that the restore point has gone (V$RESTORE_POINT returns no rows) and that sales_test is no longer running.
Summary
A snapshot standby turns the physical standby you already pay for into a full-size, current test database for the length of a test, and back again with one command. Check the configuration and the fast recovery area, give the test team a service that only runs in the snapshot standby role, convert with the broker, and verify the role, the guaranteed restore point and that redo still arrives. Watch space during the test and never drop the restore point. Convert back, watch the apply lag fall, and plan the test window knowing that a failover during it would be slower, though no committed data would be lost.
Comments