当前位置:首页 > 数据库 > Oracle

Oracle Flashback Technologies - 闪回查询

Oracle Flashback Technologies - 闪回查询

 

查看表中,某行数据的修改记录

#创建一个表,并插入和修改数据

SQL> create table y3(id int,name varchar2(20));

Table created.

SQL> insert into y3 values(1,wahaha);

1 row created.

SQL> commit;

Commit complete.

SQL> update y3 set name=nongfushanquanwhere id=1;

1 row updated.

SQL> commit;

Commit complete.
 
SQL> update y3 set name=kaifeiwhere id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name=pijiuwhere id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name=hongniuwhere id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name=kelewhere id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL>


#查询

            #查询
SQL> select2   name,
  3   versions_starttime,
  4   versions_startscn,
  5   versions_endtime,
  6   versions_endscn,
  7   versions_xid,
  8   versions_operation
  9from y3
 10   versions between scn minvalue and maxvalue
 11where id = 112   order by 313   /

NAME                 VERSIONS_STARTTIME        VERSIONS_STARTSCN VERSIONS_ENDTIME          VERSIONS_ENDSCN VERSIONS_XID     V
-------------------- ------------------------- ----------------- ------------------------- --------------- ---------------- -
wahaha               23-JUN-1508.36.07 AM               146631823-JUN-1508.36.46 AM             14663330400200065030000 I
nongfushanquan       23-JUN-1508.36.46 AM               146633323-JUN-1508.37.16 AM             1466347 0A00040015040000 U
kaifei               23-JUN-1508.37.16 AM               146634723-JUN-1508.37.31 AM             1466355 070018009D030000 U
pijiu                23-JUN-1508.37.31 AM               146635523-JUN-1508.37.49 AM             1466364 01000D0048030000 U
hongniu              23-JUN-1508.37.49 AM               146636423-JUN-1508.39.04 AM             1466400 02001B0021040000 U
kele                 23-JUN-1508.39.04 AM               1466400                                           06000400DC040000 U

6 rows selected.

SQL>  

 

 

查看语句

            select
            
 name,
 versions_starttime,
 versions_startscn,
 versions_endtime,
 versions_endscn,
 versions_xid,
 versions_operation
 
            from
             y3
 versions between scn minvalue and maxvalue
 #versions between timestamp minvalue and maxvalue 也可以根据时间戳来查看
 
            where id = 1
 order by 3
 /

 

原文:http://www.cnblogs.com/abclife/p/4595843.html


【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐