oralce 闪回


sys@ORCL> variable scn number;
sys@ORCL> exec :scn :=dbms_flashback.get_system_change_number;

PL/SQL procedure successfully completed.

sys@ORCL> print scn;

       SCN
----------
    697882

sys@ORCL> select count(*) from big_table;

  COUNT(*)
----------
     10005

sys@ORCL> delete from big_table;  --删除数据

10005 rows deleted.

sys@ORCL> select count(*) from big_table; --检测是否删除

  COUNT(*)
----------
         0


sys@ORCL> select count(*) from big_table as of scn:scn;

  COUNT(*)
----------
     10005

sys@ORCL> commit; --跨事务

Commit complete.

sys@ORCL> select * 
  2  from (select count(*) from big_table),(select count(*) from big_table as of scn:scn) 
  3  /

  COUNT(*)   COUNT(*)
---------- ----------
         0      10005

sys@ORCL> flashback table big_table to scn:scn;
flashback table big_table to scn:scn
                *
ERROR at line 1:
ORA-08185: Flashback not supported for user SYS


sys@ORCL> show user;
USER is "SYS"

你可能感兴趣的:(sql)