Oracle Database 闪回(FLASHBACK)

闪回版本查询
SQL> set line 200
SQL> col starttime for a30
SQL> col endtime for a30
SQL> col operation for a30

SQL> select to_char(versions_starttime,'yyyy-mm-dd hh24:mi:ss') starttime,to_char(versions_endtime,'yyyy-mm-dd hh24:mi:ss') endtime,
   versions_xid xid,versions_operation operation from soe.customers versions
   between timestamp to_date('2018-09-22 14:00:00','yyyy-mm-dd hh24:mi:ss') and sysdate where versions_xid is not null;
STARTTIME                      ENDTIME                        XID              OPERATION
------------------------------ ------------------------------ ---------------- ------------------------------
2018-09-22 14:00:36                                           05001100B8030000 U
2018-09-22 13:59:59                                           05000700B8030000 U
2018-09-22 14:00:25                                           08001B00CC030000 U
2018-09-22 14:00:14                                           05001000B8030000 I
2018-09-22 14:00:20                                           09001700C9030000 I
2018-09-22 14:00:05                                           0B00200041000000 I
2018-09-22 14:00:05                                           09000700CA030000 I
2018-09-22 14:00:11                                           03001800B4030000 I
8 rows selected.

闪回事务查询
SQL> select undo_sql from flashback_transaction_query where xid = hextoraw('03001800B4030000');
UNDO_SQL
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
delete from "SOE"."LOGON" where ROWID = 'AAAVU+AAGAAAavRAB6';
delete from "SOE"."CARD_DETAILS" where ROWID = 'AAAVU4AAHAAAQEoABz';
delete from "SOE"."ADDRESSES" where ROWID = 'AAAVU3AAHAAAbuoAAy';
delete from "SOE"."CUSTOMERS" where ROWID = 'AAAVU2AAGAAAaqxAAO';
SQL> select undo_sql from flashback_transaction_query where xid = hextoraw('08001B00CC030000');

UNDO_SQL
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
update "SOE"."CUSTOMERS" set "PREFERRED_ADDRESS" = '1162533' where ROWID = 'AAAVU2AAGAAACC9AAS';
delete from "SOE"."ADDRESSES" where ROWID = 'AAAVU3AAHAAAbumAA5';


猜你喜欢

转载自blog.51cto.com/13598811/2178965