oracle数据库跨分区转移数据记录后,rowid会改变
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