加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flashback version query(待完善)

发布时间:2020-12-15 06:12:14 所属栏目:百科 来源:网络整理
导读:SQL create table dep(id number,name varchar2(10)); Table created. SQL insert into dep values(1,'dep1'); 1 row created. SQL commit; Commit complete. SQL select ora_rowscn,id,name from dep; ORA_ROWSCN???????? ID NAME ---------- ---------- --
SQL> create table dep(id number,name varchar2(10));

Table created.

SQL> insert into dep values(1,'dep1');

1 row created.

SQL> commit;

Commit complete.

SQL> select ora_rowscn,id,name from dep;

ORA_ROWSCN???????? ID NAME
---------- ---------- ----------
?? 1445309????????? 1 dep1

SQL> update dep set name='dep11' where id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> select ora_rowscn,name from dep;

ORA_ROWSCN???????? ID NAME
---------- ---------- ----------
?? 1445369????????? 1 dep11

SQL> /

ORA_ROWSCN???????? ID NAME
---------- ---------- ----------
?? 1445369????????? 1 dep11

SQL> update dep set name='dep12' where id=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> select ora_rowscn,name from dep;

ORA_ROWSCN???????? ID NAME
---------- ---------- ----------
?? 1445404????????? 1 dep12
col versions_xid format a16 heading 'XID'
col versions_startscn format 99999999 heading 'VSN|start|scn'
col versions_endscn format 99999999 heading 'vsn|end|scn'
col versions_operation format a12 heading 'operation'
select versions_xid,versions_startscn,versions_endscn,
decode(versions_operation,'I','INSERT','U','UPDATE','D','DELETE','ORIGINAL') "OPERATION",
ID,NAME
FROM DEP
VERSIONS BETWEEN SCN MINVALUE AND MAXVALUE
WHERE ID=1;


?????????????????????? VSN?????? vsn
???????????????????? start?????? end
XID??????????????????? scn?????? scn OPERATIO???????? ID NAME
---------------- --------- --------- -------- ---------- ----------
0A000100DF010000?? 1445404?????????? UPDATE??????????? 1 dep12
09000E0020020000?? 1445369?? 1445404 UPDATE??????????? 1 dep11
04002200CC010000?? 1445309?? 1445369 INSERT??????????? 1 dep1

-----------------------------------------------------------------------

通过SCN和STAMPSTAMP查询

SQL> select salary from emp ? 2? versions between ? 3? scn minvalue and maxvalue ? 4? where id=1; ??? SALARY ---------- ?????? 120 ?????? 100 select salary from emp versions between timestamp to_timestamp('2012-04-15 15:30:01','yyyy-mm-dd hh24:mi:ss') and to_timestamp('2012-04-15 17:30:00','yyyy-mm-dd hh24:mi:ss') where id=1;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读