Set Oracle Flashback Database Retention Target with ALTER SYSTEM
Set Oracle Flashback Database Retention Target with ALTER SYSTEM
Oracle Flashback Database lets you rewind your entire database to a past point in time without a full restore. The command ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET controls how far back in time that rewind can go.
What This Command Does
The DB_FLASHBACK_RETENTION_TARGET parameter sets the upper limit, in minutes, on how far back you can flashback your database. Oracle uses this setting to decide how much flashback log data to keep inside the Fast Recovery Area (FRA). Think of it as a time window β anything older than the target may be cleaned up to free space.
The Code
1-- Set the flashback database retention target
2ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=<minutes> SCOPE=BOTH;
3/
Replace <minutes> with the number of minutes you want Oracle to retain flashback data.
Common examples:
| Retention Window | Minutes Value |
|---|---|
| 1 day (default) | 1440 |
| 2 days | 2880 |
| 3 days | 4320 |
| 7 days | 10080 |
Breakdown of the Code
ALTER SYSTEM
This is an Oracle DDL statement that changes a system-level initialization parameter. It affects the entire database instance, not just your current session.
SET DB_FLASHBACK_RETENTION_TARGET=<minutes>
This sets the parameter value. The value is always in minutes (integer). For example, to retain 7 days of flashback data, use 10080 because 7 Γ 24 Γ 60 = 10080. The valid range is 0 to 4,294,967,295 (the maximum value of a 32-bit integer).
SCOPE=BOTH
This keyword applies the change in two places at once:
- MEMORY β takes effect immediately for the running instance
- SPFILE β persists the change so it survives a database restart
Without SCOPE=BOTH, the change is temporary and lost after a restart.
/
The forward slash at the end executes the SQL statement in SQL*Plus or SQL Developer. It is a standard SQL*Plus execution terminator.
Key Points
- The default value is
1440minutes (1 day). - This parameter is modifiable online using
ALTER SYSTEMβ no database restart is required. - The parameter is NOT modifiable inside a Pluggable Database (PDB) in a multitenant environment; it must be set at the CDB (Container Database) level.
- Oracle treats this as a target, not a guarantee. If the Fast Recovery Area runs out of space, Oracle will delete older flashback logs even if they are still within the retention window.
- You cannot manually delete flashback logs stored in the FRA. Oracle manages them automatically based on space and the retention target.
How It Works Inside Oracle
When Flashback Database is enabled, Oracle writes block images from every changed data file into the flashback logs at regular intervals. These block images allow Oracle to reconstruct the exact state of the database at any past moment within the retention window.
The DB_FLASHBACK_RETENTION_TARGET parameter tells Oracle how long to keep these logs. The actual amount of disk space consumed depends heavily on your redo generation rate β a write-heavy workload generates much more flashback data than a read-heavy one.
Storage Planning
Before you increase this parameter, you must plan your Fast Recovery Area size carefully. Oracle provides this formula:
Target FRA = Current FRA + (DB_FLASHBACK_RETENTION_TARGET Γ 60 Γ Peak Redo Rate in MB/sec)
For example, with a retention of 360 minutes and a peak batch redo rate of 30 MB/sec over 4 hours, you could need up to ~443 GB of additional FRA space. Always query V$FLASHBACK_DATABASE_LOG to check your oldest available flashback time after configuration.
Best Practices
- Set
DB_FLASHBACK_RETENTION_TARGETto at least 60 minutes if you use Oracle Data Guard, so you can reinstate a failed primary database after a failover. - For user error recovery, set the target equal to the longest time window from which you ever expect to recover.
- In a Data Guard environment, set the same value on both the primary and standby databases.
- Verify the current setting with:
1SHOW PARAMETER DB_FLASHBACK_RETENTION_TARGET;
- Verify Flashback is actually enabled on the database with:
1SELECT FLASHBACK_ON FROM V$DATABASE;
Important Insights
- A lower retention target saves FRA space but limits your recovery options. Balance your business recovery time objectives (RTO) against your storage budget.
- Reducing the target value is safe. Oracle will simply age out older flashback logs the next time it needs space, with no data corruption risk.
- Flashback Database is not a replacement for RMAN backups. It handles short-term, fast point-in-time rewinds; RMAN handles long-term archival recovery.
- In Oracle 23ai, new parameters like
DB_FLASHBACK_LOG_DESTallow you to store flashback logs outside the FRA for the first time, giving more storage flexibility.
References
- Oracle 10g Documentation β DB_FLASHBACK_RETENTION_TARGET Parameter Reference β Official Oracle 10g initialization parameter reference for
DB_FLASHBACK_RETENTION_TARGET, describing its purpose, range, and modifiability. - Oracle 21c Documentation β DB_FLASHBACK_RETENTION_TARGET β Oracle 21c official parameter reference, including PDB restriction details.
- Oracle 23c β Flashback Best Practices β Official Oracle best practices guide for Flashback Database, including FRA sizing formula and Data Guard recommendations.
- Oracle 19c β Using Flashback Database and Restore Points β Oracle 19c Backup and Recovery guide covering how to enable and configure Flashback Database step by step.
- Schneide Blog β Time Travel with Oracle Database's Flashback Queries β Practical developer blog post demonstrating how to calculate retention minutes and apply
ALTER SYSTEM SET DB_FLASHBACK_RETENTION_TARGET=10080 SCOPE=BOTH. - DBA Genesis β Oracle Flashback Setup Guide β Step-by-step DBA guide covering the full flashback enable workflow including setting retention target, mounting the database, and enabling flashback logging.
- DBAKevlar β ORA-19809, Failed RMAN Backups and Flashback β Practical blog post explaining the default 1440-minute retention value and the relationship between FRA size, retention target, and common errors.
- Red Gate Simple Talk β Introduction to Oracle Flashback Technology Part 3 β Detailed technical introduction to Oracle Flashback Database, covering the retention target, FRA management, and enabling flashback logging.
- Oracle 10g Setup and Maintenance for Flashback Database β Official Oracle documentation covering FRA sizing for flashback logs and how the retention target indirectly controls disk usage.
- LinkedIn β Flashback Logs Off the FRA in Oracle 23ai β Overview of new Oracle 23ai flashback storage flexibility, showing how
DB_FLASHBACK_RETENTION_TARGETworks with the newDB_FLASHBACK_LOG_DESTparameter.