ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 10g里的ora_rowscn

10g里的ora_rowscn

原创 Linux操作系统 作者:wujianbo702 时间:2008-09-03 11:13:08 0 删除 编辑

转载

10g里面有了一项新功能,ora_rowscn


 
SQL >create table tt(id number);
Table created.
 
SQL >select ora_rowscn from tt;
no rows selected
 
SQL >insert into tt values(1);
1 row created.
 
 
insert 后查询ora_rowscn

SQL> select ora_rowscn from tt;

ORA_ROWSCN
----------
   2261349

SQL> commit;

提交完成。

SQL> select ora_rowscn from tt;

ORA_ROWSCN
----------
   2261361

 
SQL >insert into test values(2);
1 row created.
 
再插入一条记录,查看ora_rowscn,发现两条记录的ora_rowscn相同
 


SQL> select ora_rowscn from tt;

ORA_ROWSCN
----------
   2261361
   2261361

SQL> commit;

提交完成。

事务完成后ora_rowscn发生变化
SQL> select ora_rowscn from tt;

ORA_ROWSCN
----------
   2261428
   2261428

 下面看rowdependencies后的rowscn


SQL> create table ttt (id number) rowdependencies
  2  ;

表已创建。

SQL> insert into ttt values (1);

已创建 1 行。



SQL> select ora_rowscn from ttt;

ORA_ROWSCN
----------


SQL> commit;

提交完成。

事务递交后,可以查询到ora_rowscn
SQL> select ora_rowscn from ttt;

ORA_ROWSCN
----------
   2261501

插入第2条数据,
 


SQL> insert into ttt values(2);

已创建 1 行。

SQL> select ora_rowscn from ttt;

ORA_ROWSCN
----------
   2261501


SQL> commit;

提交完成。

SQL> select ora_rowscn from ttt;

ORA_ROWSCN
----------
   2261501
   2261601

2条记录的ora_rowscn并不一样,说明scn是基于行的变化生成的。

 
SQL> select scn_to_timestamp(ora_rowscn) from ttt;

SCN_TO_TIMESTAMP(ORA_ROWSCN)
------------------------------------------------------------
16-11月-06 03.53.48.000000000 下午
16-11月-06 03.56.27.000000000 下午

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/165278/viewspace-440726/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: DDL锁
请登录后发表评论 登录
全部评论

注册时间:2008-01-11

  • 博文量
    46
  • 访问量
    95715