ITPub博客

跨分区转移记录后,rowid会改变

原创 Linux操作系统 作者:paulyibinyi 时间:2007-12-17 14:52:52 0 删除 编辑
以下是验证过程
SQL> create table t1(x int) partition by range(x)
2 (partition p1 values less than (5),
3 partition p2 values less than (10))
4 /

Table created.

SQL> insert into t1 select rownum from dba_objects where rownum<8;

7 rows created.

SQL> commit;

Commit complete.

SQL> select rowid,x from t1;

ROWID X
------------------ ----------
AAABkiAABAAAFRaAAA 1
AAABkiAABAAAFRaAAB 2
AAABkiAABAAAFRaAAC 3
AAABkiAABAAAFRaAAD 4
AAABkjAABAAAFR6AAA 5
AAABkjAABAAAFR6AAB 6
AAABkjAABAAAFR6AAC 7

7 rows selected.

SQL> select dbms_rowid.rowid_block_number('AAABkiAABAAAFRaAAA') from dual;

DBMS_ROWID.ROWID_BLOCK_NUMBER('AAABKIAABAAAFRAAAA')
---------------------------------------------------
21594

SQL> update t1 set x=9 where x=1;
update t1 set x=9 where x=1
*
ERROR at line 1:
ORA-14402: updating partition key column would cause a partition change


SQL> alter table t1 enable row movement;

Table altered.

SQL> update t1 set x=9 where x=1;

1 row updated.

SQL> commit;

Commit complete.

SQL> select rowid,x from t1;

ROWID X
------------------ ----------
AAABkiAABAAAFRaAAB 2
AAABkiAABAAAFRaAAC 3
AAABkiAABAAAFRaAAD 4
AAABkjAABAAAFR6AAA 5
AAABkjAABAAAFR6AAB 6
AAABkjAABAAAFR6AAC 7
AAABkjAABAAAFR6AAD 9

7 rows selected.

SQL> select dbms_rowid.rowid_block_number('AAABkjAABAAAFR6AAD') from dual;

DBMS_ROWID.ROWID_BLOCK_NUMBER('AAABKJAABAAAFR6AAD')
---------------------------------------------------
21626

SQL>

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

请登录后发表评论 登录
全部评论
oracle 10g ocm oracle 10g/11g/12c ocp aix 6.1 administrator,ogg expert,ITSS 技术交流群 201703254 微信公众号 paulyibin 探讨技术,开心工作 电话 13719354869 ,深入研究数据库和开始研究big data

注册时间:2007-12-11

  • 博文量
    905
  • 访问量
    6483504