Wednesday , December 25 2024

Flashback Transaction In Oracle

In today’s article, we will learn important information and process steps about Flashback Transaction in Oracle Database.

There are some prerequisites to use Flashback Transaction:

The database must be in archive mode,
Supplemental logging must be active.

Flashback transaction uses LOGMINER in the background, so anything that is not supported by LogMiner is not supported by Flashback Transaction.

Data types that Flashback Transaction does not support:

BFILE,
BLOB,
CLOB,
NCLOB,
XML

Recovery with Flashback Transaction is done with the TRANSACTION_BACKOUT procedure of the DBMS_FLASHBACK api package.

Parameters of this procedure;

NUMTXNS (Number Of Transaction) – Number of transactions to be recovered.

XIDS (Transaction List) – Transaction ID numbers to recover.

Back-Out Options – Used to specify dependent processes.
CASCADE – Used with transactions on which all transactions are dependent.
NOCASCADE – Used in operations that do not have dependencies. It is the default value.
NOCASCADE FORCE – The transaction is recovered regardless of dependent transactions.
NONCONFLICT ONLY – Recovers non-conflicting lines.
TIME & SCN Hint – Used to enable the LogMiner tool to find the desired transactions easily. If left as default, the UNDO_RETENTION parameter is considered the starting point.

Flashback Transaction process steps.

1. First, database checks should be done.

Is the database in archive mode?

Is Supplemental Logging active?

2. Let’s create two tables with Foreign Key connections.

3. Let’s insert the data.

4. Let’s learn the SCN number.

5. Now let’s delete our connected data.

6. Let’s learn our SCN number again.

7. Now, let’s find out the transaction ID number with the Flashback Transaction Query feature using the SCN number.

8. Now let’s save all the dependent variables with the CASCADE option.

9. We confirm “After”. You should not forget to “Commit”.

10. We see that data comes to our table.

11. When the recovery process is successful, we can find out by querying the DBA_FLASHBACK_TXN_STATE image.

12. Operations taken to recover can be seen by querying the dba_FLASHBACK_TXN_REPORT image.

Loading

About Onur ARDAHANLI

Leave a Reply

Your email address will not be published. Required fields are marked *