Oracle Database Flashback Operations

Understanding the Fetch Phase in Oracle SQL

Oracle Flashback Summary

Recently I found myself in a situation where a restore point would have been very useful. However, since the client didn't have one, or even the flashback option enabled in the database, we had to restore the entire database. This led to significant downtime and data loss because archivelogs were not enabled either.

I will write a few articles explaining the flashback options we have, but here I will just provide a small summary of each, so you can understand which options are available and suitable for your scenario.

What is Flashback in Oracle?

Flashback in Oracle is a set of technologies that enables fast and easy data recovery in the database without the need to restore backups. This allows you to view, restore, or recreate data that was accidentally modified or deleted, minimizing downtime and data loss.

Key Benefits of Using Flashback:

  • Minimized Downtime – Fast recovery without restoring full backups.
  • Auditing and Analysis – Tracks data changes.
  • Easy Reversal – Quickly corrects human errors.
  • Granular Recovery – Allows restoring specific tables or even rows.

This feature is essential for production environments where downtime needs to be minimized.


Flashback Summary


Flashback Drop - Table

Allows recovery of entire tables from a type of trash bin known as the recycle bin.

It can be used to recover a table that was accidentally dropped (without the PURGE clause).

Oracle Requirements:

  • Recycle Bin must be enabled (RECYCLEBIN=ON).

  • DROP TABLE without PURGE.

Licensing:

  • Available in all Oracle Database editions.


Flashback Table - Table

Allows the recovery of entire tables to a specific point in time using data from the UNDO Tablespace.

It can be used to undo an accidental UPDATE or DELETE operation.

Oracle Requirements:

  • FLASHBACK TABLE privilege.

  • Sufficient UNDO tablespace.

  • ROW MOVEMENT must be enabled on the table.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Flashback Query - Table

Allows querying data at a specific point in the past using data from the UNDO Tablespace.

It can be used to query data that was accidentally deleted or modified.

Oracle Requirements:

  • SELECT ANY TABLE privilege.

  • Sufficient UNDO tablespace.

Licensing:

  • Available in all Oracle Database editions.


Flashback Versions Query - Table

Allows querying different versions of a row over a specific time interval (instead of a single point in time), using data from the UNDO Tablespace.

It can be used to compare previous, deleted, or modified versions of table rows.

Oracle Requirements:

  • SELECT ANY TABLE privilege.

  • Sufficient UNDO tablespace.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Flashback Time Travel - Table

Flashback Data Archive was renamed to Flashback Time Travel starting with Oracle Database 19c.

Allows maintaining and querying historical data of a table for a pre-configured period, using a dedicated archive completely independent of UNDO data.

It can be used to query historical data and previous versions of table rows.

Oracle Requirements:

  • FLASHBACK ARCHIVE ADMINISTER privilege.

  • Flashback Time Travel configured and enabled.

Licensing:

  • Requires Oracle Database Enterprise Edition.

  • Oracle Advanced Compression Option (ACO).


Flashback Transaction - Transaction

Allows investigating and rolling back a transaction, optionally including dependent transactions, using data from the UNDO Tablespace.

It can be used to undo all steps of an accidentally executed transaction.

Oracle Requirements:

  • FLASHBACK TRANSACTION privilege.

  • Sufficient UNDO tablespace.

  • Supplemental logging enabled.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Flashback Transaction Query - Transaction

Allows querying data about all changes affected by a transaction.

It can be used to query data that was deleted or modified by a transaction.

Oracle Requirements:

  • SELECT ANY TRANSACTION privilege.

  • Sufficient UNDO tablespace.

  • Supplemental logging enabled.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Flashback Database - Database

Allows restoring the database to a specific point in time using Flashback logs.

It can be used to undo TRUNCATE TABLE or DDL changes.

Oracle Requirements:

  • FLASHBACK DATABASE privilege.

  • Flashback logs enabled (DB_FLASHBACK_RETENTION_TARGET set).

  • Database must be in ARCHIVELOG mode.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Restore Point - Database

Allows marking a specific state of the database, creating a restore point that can be used to revert the database to that exact condition.

It can be used to undo significant changes, such as application upgrades, production tests, or migrations.

Oracle Requirements:

  • SYSDBA privilege.

  • Database in ARCHIVELOG mode.

Licensing:

  • Requires Oracle Database Enterprise Edition.


Guaranteed Restore Point - Database

Functions similarly to a regular Restore Point but guarantees that the Flashback logs needed to restore the database to that point are not overwritten.

It can be used to ensure a safe point during major changes, such as critical upgrades, without the risk of losing the ability to revert.

Oracle Requirements:

  • SYSDBA privilege.

  • Database in ARCHIVELOG mode.

  • Sufficient disk space to retain Flashback logs.

Licensing:

  • Requires Oracle Database Enterprise Edition.


In the upcoming posts, I will provide a detailed explanation of each Flashback feature, including their use cases, configuration steps, and best practices. Stay tuned for more in-depth insights to help you leverage Flashback technologies effectively in your Oracle environment.

Here is Oracle License documentation regarding the usage of features above:

Oracle License Documentation

You can also use this one if you prefer:

Oracle License Documentation

Comments

Popular Posts