A Rollback Plan in Minutes: Guaranteed Restore Points and Flashback Database with a Cross-Cloud Standby
Every change window needs a way back. For schema changes, application releases and data fixes, restoring the database from backup is the slowest possible rollback: hours for a large database, plus recovery, plus rebuilding the standby. A guaranteed restore point gives you a rollback measured in minutes. The database records the old version of every block that changes after the restore point, and FLASHBACK DATABASE puts those blocks back.
This post prepares a primary in OCI and its Data Guard standby in Azure for a release, takes the restore points in the right order, performs a rollback, and checks that the standby in the other cloud follows the primary back in time.
The Use Case
An application release changes the schema of the SALES database and runs a large data conversion. If the post-release checks fail, the business wants the database back exactly as it was before the release, within 30 minutes, with the disaster recovery standby still in sync. Restoring 3 TB from backup would take most of a day.
Environment used in this runbook
Primary: SALES_OCI, Oracle Database 19c (19.24) on an OCI VM
Standby: SALES_AZURE, physical standby on an Azure VM, managed by the Data Guard broker
Fast recovery area: +RECO with 2 TB on both sides
Change window: Saturday 20:00 to 23:00, release conversion generates about 150 GB of redo
Licence: Flashback Database and guaranteed restore points are Enterprise Edition features; no extra option is needed
How Guaranteed Restore Points Work
A restore point is a name for an SCN. A guaranteed restore point also forces the database to keep every flashback log needed to return to that SCN, whatever the retention target says.
Flashback logs hold old block images. The first time a block changes after the restore point, its previous version is written to a flashback log in the fast recovery area.
FLASHBACK DATABASE rewinds the data files to the restore point using those logs, then applies a little redo to make the database consistent. The database opens with RESETLOGS, as a new incarnation.
Space is the cost. Flashback logs for a guaranteed restore point cannot be deleted until the restore point is dropped. If the fast recovery area fills, the database stops.
Step 1: Check Flashback and the Recovery Area on Both Sides
Run on the primary and on the standby. Flashback Database is not required for a guaranteed restore point, but enabling it on both sides lets the standby follow a flashback of the primary without being rebuilt.
SQL |
SELECT db_unique_name, database_role, log_mode, flashback_on FROM v$database;
COLUMN name FORMAT A8
SELECT name, ROUND(space_limit/1024/1024/1024) AS limit_gb, ROUND(space_used/1024/1024/1024) AS used_gb FROM v$recovery_file_dest; |
Expected output |
DB_UNIQUE_NAME DATABASE_ROLE LOG_MODE FLASHBACK_ON
---------------- ---------------- ------------ ------------------
SALES_OCI PRIMARY ARCHIVELOG NO
NAME LIMIT_GB USED_GB
-------- ---------- ----------
+RECO 2048 706What to expect: ARCHIVELOG mode (required), flashback currently off, and about 1.3 TB free in the fast recovery area. The standby shows the same picture with the role PHYSICAL STANDBY. Plan for flashback logs roughly the size of the blocks the release changes, often in the same range as the redo it generates, plus the redo itself.
Step 2: Enable Flashback Database on the Primary
Since 11g Release 2, Flashback Database can be turned on while the database is open. Set a modest retention target: the guaranteed restore point keeps what it needs regardless, and the target only affects routine flashback logging.
SQL |
-- On the primary SALES_OCI ALTER SYSTEM SET db_flashback_retention_target = 1440 SCOPE = BOTH; ALTER DATABASE FLASHBACK ON;
SELECT flashback_on FROM v$database; |
Expected output |
System altered.
Database altered.
FLASHBACK_ON
------------------
YESWhat this does: It starts flashback logging with a one-day retention target (the value is in minutes). Flashback logging adds some write activity to the fast recovery area; on most systems the overhead is a few percent. If you prefer not to keep flashback on permanently, enable it before the change window and turn it off afterwards.
Step 3: Enable Flashback Database on the Standby
On a physical standby, Flashback Database can only be enabled while redo apply is stopped. Use the broker to stop and restart apply around the change.
Shell |
# On the standby host dgmgrl / "edit database 'SALES_AZURE' set state='APPLY-OFF'"
sqlplus -s / as sysdba <<'EOF' ALTER SYSTEM SET db_flashback_retention_target = 1440 SCOPE = BOTH; ALTER DATABASE FLASHBACK ON; SELECT database_role, flashback_on FROM v$database; EOF
dgmgrl / "edit database 'SALES_AZURE' set state='APPLY-ON'" |
Expected output |
Succeeded.
System altered.
Database altered.
DATABASE_ROLE FLASHBACK_ON
---------------- ------------------
PHYSICAL STANDBY YES
Succeeded.What to expect: Apply stops, flashback is enabled, apply restarts. Redo kept arriving the whole time, so the standby catches up within seconds. A standby with flashback on can also be reinstated after a failover without a rebuild, which is worth having anyway.
Step 4: Create the Restore Points, Standby First
Create the guaranteed restore point on the standby first, then on the primary. The standby's restore point is then at an earlier SCN than the primary's, so the standby can always be flashed back to a point before the primary's restore point.
SQL |
-- 1. On the standby SALES_AZURE (apply can stay on) CREATE RESTORE POINT before_rel_4_12 GUARANTEE FLASHBACK DATABASE;
-- 2. On the primary SALES_OCI, just before the release starts CREATE RESTORE POINT before_rel_4_12 GUARANTEE FLASHBACK DATABASE;
COLUMN name FORMAT A16
SELECT name, scn, guarantee_flashback_database AS guaranteed, TO_CHAR(time, 'YYYY-MM-DD HH24:MI') AS created FROM v$restore_point; |
Expected output |
Restore point created.
Restore point created.
NAME SCN GUARANTEED CREATED
---------------- ---------- ---------- ----------------
BEFORE_REL_4_12 91442018 YES 2026-10-31 19:58What to expect: One guaranteed restore point on each database with the same name; the query shows the primary's. Write down its SCN in the change record. Using the same name on both sides keeps the runbook simple during a stressful rollback.
Step 5: Watch the Space During the Change
While the release runs, flashback logs and archived logs accumulate. Check the recovery area every half hour, and see how much flashback log the database estimates it needs.
SQL |
SELECT file_type, percent_space_used AS pct_used, percent_space_reclaimable AS pct_reclaimable FROM v$recovery_area_usage WHERE file_type IN ('FLASHBACK LOG', 'ARCHIVED LOG');
SELECT ROUND(flashback_size/1024/1024/1024) AS flashback_gb, ROUND(estimated_flashback_size/1024/1024/1024) AS estimated_gb FROM v$flashback_database_log; |
Expected output |
FILE_TYPE PCT_USED PCT_RECLAIMABLE
----------------------- ---------- ---------------
ARCHIVED LOG 31.42 18.05
FLASHBACK LOG 7.81 0
FLASHBACK_GB ESTIMATED_GB
------------ ------------
160 214What to expect: Flashback logs growing and not reclaimable while the restore point exists. If the recovery area approaches its limit, add space (DB_RECOVERY_FILE_DEST_SIZE) or back up and delete archived logs that are already on the standby. Never let it fill: a full recovery area with a guaranteed restore point stops the database.
Step 6: Decide: Keep the Release or Roll Back
After the release, the application team runs its checks. If they pass, drop the restore points (Step 10) and the change is finished. If they fail, roll back. Before you do, record what the database looks like now, for the incident report.
SQL |
-- On the primary, before any rollback SELECT current_scn, TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI') AS now FROM v$database;
SELECT COUNT(*) AS invalid_objects FROM dba_objects WHERE status = 'INVALID' AND owner = 'SALES'; |
Expected output |
CURRENT_SCN NOW
----------- ----------------
94120775 2026-10-31 22:41
INVALID_OBJECTS
---------------
37What to expect: The current SCN and time, and in this example 37 invalid objects in the application schema: the release failed and the decision is to roll back. Everything that happened after the restore point, including any transactions users made after the release, will be lost. Confirm that with the business owner before continuing.
Step 7: Flash the Primary Back
Flashback Database runs with the database mounted. Stop the application, then use the broker so that it knows what is happening, or run the commands directly in SQL*Plus as shown.
SQL |
-- On the primary SALES_OCI SHUTDOWN IMMEDIATE STARTUP MOUNT
FLASHBACK DATABASE TO RESTORE POINT before_rel_4_12;
ALTER DATABASE OPEN RESETLOGS;
SELECT open_mode, resetlogs_change#, TO_CHAR(resetlogs_time, 'YYYY-MM-DD HH24:MI') AS resetlogs FROM v$database; |
Expected output |
Database closed.
Database dismounted.
ORACLE instance shut down.
ORACLE instance started.
Database mounted.
Flashback complete.
Database altered.
OPEN_MODE RESETLOGS_CHANGE# RESETLOGS
-------------------- ----------------- ----------------
READ WRITE 91442020 2026-10-31 22:49What to expect: "Flashback complete" after a few minutes, depending on how much changed, then the database opens with RESETLOGS at an SCN just after the restore point. The schema, the data and the invalid objects are back to exactly the state before the release. Recompile and check the application before reopening it to users.
Step 8: Check That the Standby Followed
The primary is now in a new incarnation. With Flashback Database enabled on the standby, Oracle Database 19c flashes the standby back automatically when it receives the redo of the new incarnation, and redo apply continues. Check from the broker and on the standby.
Shell |
dgmgrl / "show configuration" |
SQL |
-- On the standby SALES_AZURE SELECT database_role, open_mode, resetlogs_change# FROM v$database; |
Expected output |
DATABASE_ROLE OPEN_MODE RESETLOGS_CHANGE#
---------------- -------------------- -----------------
PHYSICAL STANDBY MOUNTED 91442020What to expect: The standby shows the same RESETLOGS_CHANGE# as the primary, which proves it is now in the new incarnation, and the broker reports SUCCESS after a few minutes. If the standby instead reports ORA-16700 or apply stops with a message about a different incarnation, flash it back manually: stop apply, run FLASHBACK DATABASE TO SCN 91442018 (two less than the primary's RESETLOGS_CHANGE#), and start apply again.
Step 9: Verify Redo Is Flowing Again
Before closing the incident, make sure the configuration is healthy and the standby is current. Run the release again only after the cause of the failure is understood.
SQL |
-- On the standby COLUMN name FORMAT A14 COLUMN value FORMAT A14
SELECT name, value FROM v$dataguard_stats WHERE name IN ('transport lag', 'apply lag'); |
Expected output |
NAME VALUE
-------------- --------------
transport lag +00 00:00:00
apply lag +00 00:00:01What to expect: Transport and apply lag near zero: the standby in Azure is back in step with the rolled-back primary in OCI, and disaster protection is intact.
Tip: Rehearse the rollback once on a test copy before relying on it, including the standby. A rehearsal shows how long the flashback really takes and how much flashback log a release of this size produces.
Step 10: Drop the Restore Points
Whether the release succeeded or was rolled back, drop the guaranteed restore points as soon as they are no longer needed, on both databases. Until then, flashback logs keep accumulating.
SQL |
-- On the primary, then on the standby DROP RESTORE POINT before_rel_4_12;
SELECT COUNT(*) AS restore_points FROM v$restore_point; |
Expected output |
Restore point dropped.
RESTORE_POINTS
--------------
0What this does: It releases the guaranteed flashback logs, which then age out according to DB_FLASHBACK_RETENTION_TARGET. Add a check for forgotten guaranteed restore points to your daily monitoring: a restore point left behind for weeks is one of the most common reasons a fast recovery area fills up.
Summary
A guaranteed restore point turns a release rollback from a day-long restore into a few minutes. Check ARCHIVELOG mode and recovery area space on both sides, enable Flashback Database on the primary and, with apply stopped, on the standby. Create the restore point on the standby first and then on the primary, and watch the space during the change. If the release fails, flash the primary back and open it with RESETLOGS, confirm that the standby in the other cloud followed into the new incarnation, and check the lag. Either way, drop the restore points as soon as the decision is made.
Comments