码迷,mamicode.com
首页 > 其他好文 > 详细

【练习】flashback基于scn的闪回查询

时间:2016-12-11 14:53:26      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:span   pre   selected   ora   delete   operation   values   ica   cte   

1.创建表dept1:

13:01:03 SCOTT@ORA11GR2>create table dept1 as select * from dept;

Table created.

13:01:40 SCOTT@ORA11GR2>select * from dept1;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
13:02:22 SCOTT@ORA11GR2>insert into dept1 values(50,xxx,xxxx);

1 row created.

 

2.查看当前的scn:

13:04:12 SYS@ORA11GR2>select current_scn from v$database;

CURRENT_SCN
-----------
    1006836

3.删除表dept1:

13:07:51 SCOTT@ORA11GR2>delete from dept1;

4 rows deleted.

13:08:03 SCOTT@ORA11GR2>select * from dept1;

no rows selected

4.基于scn的查询:

13:08:15 SCOTT@ORA11GR2>select * from dept1 as of scn 1006836;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        20 RESEARCH       DALLAS
        30 SALES          CHICAGO
        40 OPERATIONS     BOSTON
        50 xxx            xxxx

 

【练习】flashback基于scn的闪回查询

标签:span   pre   selected   ora   delete   operation   values   ica   cte   

原文地址:http://www.cnblogs.com/tomatoes-/p/6159434.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!