Flashback Database and Flashback Logs
By: Saurav Das
Tags: Oracle Database, Data Protection, Oracle, High Availability, Flashback

I recently encountered a customer question related to when Flashback logs are deleted vs reused. We changed our documentation to resolve the confusion, but I also learned something new during this process, which I thought I would share with the broader Oracle Database community.

Before we dive into the actual concept of flashback logs management, let’s do a brief refresher of Flashback itself. Flashback is one of the best inherent high availability features of the Oracle Database because of its simplicity. It allows an Oracle Database user to rollback changes without employing complex recovery procedures. It can be used to rewind a database, table, or transaction back to correct problems in various scenarios such as human error, database upgrades, application deployments, testing scenarios, logical corruptions, etc.

There are two kinds of Flashback Technologies available for the Oracle Database as below.

· Logical Flashback — which relies on Undo data that can be used to Flashback a table, transaction or query.

· Physical Flashback — relies on Flashback logs that can be used to Flashback the entire database.

Flashback Database (a component of Physical Flashback) uses its own logging mechanism to create flashback logs in the fast recovery area (FRA). Flashback Database can only be used if flashback logs are available. Additionally, you must configure the fast recovery area and set a flashback retention target to use Flashback Database. The retention target signals the database to copy images of each altered block in every data file into the flashback log at regular intervals. These images are later used to reconstruct a previous incarnation of the database on demand. Any remaining changes are recovered using online and archived redo logs if available.

We always advise customers to size the fast recovery area so that there is enough space available for flashback logs. The four operations for managing flashback logs in the fast recovery area are as below:

· Create — Flashback logs are created if the below criteria are met:

o The fast recovery area has enough space

o DB_FLASHBACK_RETETION_TARGET has been set

· Delete — Flashback logs may be deleted only in the below scenarios

o The flashback logs satisfy a normal restore point and there is space pressure in the fast recovery area

o Flashback logs are obsolete as per retention target and corresponding archived redo logs have been deleted due to space pressure

o Flashback logs have already been backed up to tape

· Reuse or Overwrite — Flashback logs are reused or overwritten in the below situations

o Do not satisfy a retention target

o Do not belong to a guaranteed restore point

o Oldest flashback logs when there is space pressure in fast recovery area

· Retain — Flashback logs are preserved only in the below situations

o Flashback logs are needed to satisfy a guaranteed restore point

There is no space pressure in the fast recovery area

Now let’s return to our original point about the confusion over deletion vs reuse of flashback logs. The descriptions of each operation and rules stated above should resolve that confusion now. Moreover, automatic clearing of flashback logs has been introduced for the Oracle Database in 19c and that means the Oracle Database will now automatically manage flashback logs in the fast recovery area. The flashback logs will be managed as per the defined rules and the Oracle Database will decide whether to delete or reuse a particular flashback log. However, it is still important for an Oracle Database user to be aware when these operations occur to avoid any surprises. It should also be noted that flashback logs cannot be managed in the fast recovery area other than setting the flashback retention target and creating guaranteed restore points. All in all, as long as the sizing of the fast recovery area is appropriate and you configure your restore points with reasonable timeframes and storage in mind, the Oracle database will take care of the rest.

For more details on Flashback Technologies refer to our official documentation here. If you wish to learn more about other high availability features for the Oracle Database, please visit our Maximum Availability Architecture page or follow us on Twitter.

You can also follow our updates on the MAA blog.