Flashback
Flashback query (undo)
SELECT * FROM table_name as of timestamp
To_timestamp (' 2008-03-03 12:00:00 ', ' yyyy-mm-dd hh24:mi:ss '); SELECT * FROM table_name as of SCN 123456;
Flashback table (undo, Restore table to a point in time, block write operation)--must turn on row movement
ALTER TABLE table_name enable row movement; Flashback table table_name to timestamp (jul-07-2008,02:33:00); Flashback table table_name to SCN 123456;
Flashback table table_name to timestamp ' 2008-03-03 12:05:00 ' enable triggers; --Restores only the trigger or index state and does not revert changes
Flashback Drop (RecycleBin)--management recyclebin show RecycleBin;
SELECT * from User_recyclebin; SELECT * from Dba_recyclebin; Purge RecycleBin; --Flash back drop table
Flashback table table_name to before drop [rename to New_name];
--recyclebin has the same name, flashback was recently deleted, after the flash back there is a table with the same name, need to rename
Flashback Database (Flashback log,redo log,archive log)--open Flashback database shutdown immediate startup mount
ALTER DATABASE flashback on-The archive must be opened first
--Flashback database (Mount status, read only mode check, Resetlogs mode open) flashback to time to_date (XXX);
Flashback database to time to_timestamp (XXX); Flashback database to SCN xxx;
Flashback database to sequence XXX thread 1; Flashback database to timestamp (SYSDATE-1/24); --Manage the Flash back zone
Db_recovery_file_dest--Flashback zone path Db_recovery_file_dest_size--flash back area size Db_flashback_retention_target--Flashback number Save time
SELECT * from V$flash_recovery_area_usage; --utilization rate of flash back zone
SELECT * from V$flashback_database_log; -The flashback zone, such as the earliest point of time that can be recovered
Flashback version query (undo)
--Querying multiple versions of a table, recording row changes
Select Versions_starttime,versions_endtime,versions_startscn,versions_endscn, Versions_xid,versions_operation,a, B
From test versions between timestamp MinValue and MaxValue order by Versions_starttime;
Flashback transaction query (undo)--View the current transaction number
Select XID from V$transaction; --View Undo_sql
Select Undo_sql from Flashback_transaction_query
where Xid =hextoraw (' xxxxxxx '); --it is difficult to use the index of the system without using Hextoraw
Oracle Flashback Command Manual