Oracle Flashback Technologies - 闪回查询

时间:2023-03-08 17:31:55

Oracle Flashback Technologies - 闪回查询

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

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

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

Table created.

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

 row created.

SQL> commit;

Commit complete.

SQL> update y3 set name='nongfushanquan' where id=;

 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name='kaifei' where id=;

 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name='pijiu' where id=;

 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name='hongniu' where id=;

 row updated.

SQL> commit;

Commit complete.

SQL> update y3 set name='kele' where id=;

 row updated.

SQL> commit;

Commit complete.

SQL>

#查询

#查询
SQL> select
name,
versions_starttime,
versions_startscn,
versions_endtime,
versions_endscn,
versions_xid,
versions_operation
from y3
versions between scn minvalue and maxvalue
where id =
order by
/ NAME VERSIONS_STARTTIME VERSIONS_STARTSCN VERSIONS_ENDTIME VERSIONS_ENDSCN VERSIONS_XID V
-------------------- ------------------------- ----------------- ------------------------- --------------- ---------------- -
wahaha -JUN- 08.36. AM -JUN- 08.36. AM I
nongfushanquan -JUN- 08.36. AM -JUN- 08.37. AM 0A00040015040000 U
kaifei -JUN- 08.37. AM -JUN- 08.37. AM 070018009D030000 U
pijiu -JUN- 08.37. AM -JUN- 08.37. AM 01000D0048030000 U
hongniu -JUN- 08.37. AM -JUN- 08.39. AM 02001B0021040000 U
kele -JUN- 08.39. AM 06000400DC040000 U 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 =
order by
/