I am learning Flashback Transaction Query in Oracle 12c.
I executed some DDL and DML statements.
At the end, I executed a select statement on the FLASHBACK_TRANSACTION_QUERY view in order to see the UNDO_SQL value, but it returned no rows.
I am curious to know why it is giving me no rows.
I researched and found that Supplemental Logging has to be enabled first (SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
).
This value is YES.
The queries are as below:-
CREATE TABLE TestAgain
(
Fld1 VARCHAR2(3),
Fld2 NUMBER(3)
);
INSERT INTO TestAgain values ('XYZ', 1);
INSERT INTO TestAgain VALUES ('PQR', 2);
COMMIT;
DELETE FROM TestAgain;
SELECT UNDO_SQL FROM FLASHBACK_TRANSACTION_QUERY
WHERE XID = (SELECT DISTINCT(RAWTOHEX(VERSIONS_XID))
FROM TestAgain VERSIONS BETWEEN TIMESTAMP MINVALUE AND MAXVALUE);
The last query is returning no rows. Please help me to figure out what I am missing here. P.S.: I am just a novice SQL learner.
You have to enable the minimum supplemental log before using Flashback Transaction Query sys> alter database add supplemental log data;
In addition to the minimum supplemental log for Flashback Query, you need to add supplemental log for primary keys and foreign keys in order to trace their changes in Flashback Transaction Query.
SYS> alter database add supplemental log data (primary key) columns; SYS> alter database add supplemental log data (foreign key) columns;