闪回查询
查看是否开启了闪回:
Selectflashback_on from V$database;
SQL> select * from t1;
A
----------
8
6
SQL> delete from t1 where t1.a =6;
commit;
select * from t1;
select * from t1 as of timestamp sysdate - 1/1440;
1 row deleted.
SQL>
Commit complete.
SQL>
A
----------
8
SQL>
A
----------
8
6
SCN
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
1.3577E+10
SQL> selectdbms_flashback.get_system_change_number||'' from dual;
DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER|
----------------------------------------
13576873488
SQL> select * from t1;
A
----------
8
SQL> delete from t1 where t1.a =8;
commit;
select * from t1;
select * from t1 as of scn 13576873488
1 row deleted.
SQL>
Commit complete.
SQL>
no rows selected
SQL>
2 ;
A
----------
8
As of 用来修饰表。
SQL> set linesize 3000;
SQL>
selecta,VERSIONS_STARTSCN,VERSIONS_STARTTIME,VERSIONS_ENDSCN,VERSIONS_ENDTIME,VERSIONS_OPERATION,VERSIONS_XIDfrom t1 versions between scn minvalue and maxvalue;SQL>
AVERSIONS_STARTSCN VERSIONS_STARTTIME VERSIONS_ENDSCN VERSIONS_ENDTIME V VERSIONS_XID
---------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------- -----------------
8 1.3577E+10 20-MAR-14 04.26.01 PM D 060018004F0A0000
8 1.3577E+1020-MAR-14 04.26.01 PM