首页 > 应用开发 > IT综合 > 简单方法消息行移植和行链接
降低HWM,消除行移植和行链接。
我们可以用下面的办法来最方便的进行重组,消除row migration:
SQL> alter table t add t1 date default sysdate;
Table altered.
SQL> c/t1/t2
1* alter table t add t2 date default sysdate
SQL> /
Table altered.
SQL> c/t2/t3
1* alter table t add t3 date default sysdate
SQL> /
Table altered.
SQL> analyze table t compute statistics;
Table analyzed.
SQL> select table_name,num_rows,CHAIN_CNT from user_tables where table_name='T';
TABLE_NAME NUM_ROWS CHAIN_CNT
------------------------------ ---------- ----------
T 41616 3908
SQL> alter table t move ;
Table altered.
SQL> analyze table t compute statistics;
Table analyzed.
SQL> select table_name,num_rows,CHAIN_CNT from user_tables where table_name='T';
TABLE_NAME NUM_ROWS CHAIN_CNT
------------------------------ ---------- ----------
T 41616 0
Index 需要rebuild 或者删除重建 。
--------------------------------------------------------------------------------------------------------
如何消除表中的chained rows?(测试表中存在较多的链接行)
创建chained rows需要的表:
sql> @/home/oracle/product/9.2.0/rdbms/admin/utlchain.sql
将表中的chained row移动到chained_rows表
sql> analyze table test_table_name list chained rows;
sql> select table_name,head_rowid from chained_rows
where table_name = ‘TEST_TABLE_NAME’;
sql> select * from agent_account where rowid in
(select head_rowid from chained_rows where table_name = ‘TEST_TABLE_NAME’)
---------------------------------------------------------------------------------------------------
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/271283/viewspace-1001844/ ,如需转载,请注明出处,否则将追究法律责任。