ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ora_rowscn

ora_rowscn

原创 Linux操作系统 作者:安佰胜 时间:2011-10-17 15:18:47 0 删除 编辑

ora_rowscn
===============
10g之后开始使用
用了标志row版本变化情况
默认是对块生效
通过设置rowdependencies可以对行生效
要对行生效需要重新建表
只需要建表时添加关键字rowdependencies即可
其实就是在表中添加一个隐含字段
表的空间开销会有所增加
create table attt(id int) rowdependencies;

--------------
测试
不适用rowdependence
对于同一个块中两行数据只修改一行
rowscn全部发生变化
an@DB10> drop table attt;
表已删除。
an@DB10> create table attt (id int);
表已创建。
an@DB10>
an@DB10> insert into attt select 1 from dual;
已创建 1 行。
an@DB10> insert into attt select 2 from dual;
已创建 1 行。
an@DB10> commit;
提交完成。
an@DB10>
an@DB10>
an@DB10> select dbms_rowid.rowid_block_number(rowid) blockno,to_char(ora_rowscn) from attt;
   BLOCKNO TO_CHAR(ORA_ROWSCN)
---------- ----------------------------------------
     23524 41250033602
     23524 41250033602
an@DB10>
an@DB10> update attt set id=3 where id=2;
已更新 1 行。
an@DB10> commit;
提交完成。
an@DB10>
an@DB10> select dbms_rowid.rowid_block_number(rowid) blockno,to_char(ora_rowscn) from attt;
   BLOCKNO TO_CHAR(ORA_ROWSCN)
---------- ----------------------------------------
     23524 41250033605
     23524 41250033605
=====================
开启rowdependencies后同一块中数据只有发生修改行的rowscn发生变化
 
an@DB10> drop table attt;
表已删除。
an@DB10> create table attt (id int) rowdependencies;
表已创建。
an@DB10>
an@DB10> insert into attt select 1 from dual;
已创建 1 行。
an@DB10> insert into attt select 2 from dual;
已创建 1 行。
an@DB10> commit;
提交完成。
an@DB10>
an@DB10>
an@DB10> select dbms_rowid.rowid_block_number(rowid) blockno,to_char(ora_rowscn) from attt;
   BLOCKNO TO_CHAR(ORA_ROWSCN)
---------- ----------------------------------------
     23532 41250034034
     23532 41250034034
an@DB10>
an@DB10> update attt set id=3 where id=2;
已更新 1 行。
an@DB10> commit;
提交完成。
an@DB10>
an@DB10> select dbms_rowid.rowid_block_number(rowid) blockno,to_char(ora_rowscn) from attt;
   BLOCKNO TO_CHAR(ORA_ROWSCN)
---------- ----------------------------------------
     23532 41250034034
     23532 41250034037

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

上一篇: v$bgprocess
下一篇: 模拟死锁
请登录后发表评论 登录
全部评论

注册时间:2009-08-26

  • 博文量
    215
  • 访问量
    660352