Frage

Within the oracle database 11g the table FLASHBACK_TRANSACTION_QUERY provides the UNDO_SQL column which SQL reverses the modification done by a specific previously executed query.

However, I need the REDO_SQL (the original SQL which has been executed) instead. Is there a way (using SQLs) to extract REDO_SQL information from the oracle flashback area?

War es hilfreich?

Lösung

As you can see in documentation, Oracle flashback features focused on data rather than SQL statements. Therefore you can't discover statements from flashback data.

Instead, you can enable AUDIT feature in database settings (AUDIT_TRAIL parameter), then manage auditing settings with AUDIT statement as described here.

Logged statements can be accessed with DBA_AUDIT_TRAIL or USER_AUDIT_TRAIL views.

Another way to reach same target is to use DBMS_FGA package to tune up audit policies and then refer DBA_FGA_AUDIT_TRAIL or V$XML_AUDIT_TRAIL for list of executed statements. This option involves Fine Grained Auditing feature and available only for Enterprise version of Oracle Database.

Update

Sorry for initial mistake, real name of view to examine audit records is DBA_AUDIT_TRAIL (corrected above).

This view can be joined on TRANSACTIONID field with the field XID of FLASHBACK_TRANSACTION_QUERY view to get corresponding flashback records.

Besides Oracle documentation there are a number of good articles on Oracle-Base site about auditing.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top