oracle数据库跨分区转移数据记录后,rowid会改变

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:86

oracle数据库跨分区转移数据记录后,rowid会改变,以下是验证过程
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

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】