一 dba_tables中的行迁移信息
chain_cnt
select a.chain_cnt,a.table_name,a.owner,a.num_rows,a.blocks from dba_tables a where a.chain_cnt<>0 ; 这个字段并不准,dbms_stats并不收集这个信息,只能设置成0,通过执行analyze table <table_name> compute statistics收集这个字段的唯一方法,然而这个会导致这个表中的所有统计信息被覆盖,实际中不推荐使用--参见《troubleshooting oracle performance》第十二章
SQL> @?/rdbms/admin/utlchain.sql
SQL> analyze table XMWXCS.UNI_USERS list chained rows into CHAINED_ROWS;
Table analyzed.
建立行迁移的备份表
create table XMWXCS.UNI_USERS_TMP as select * from XMWXCS.UNI_USERS where rowid in (select head_rowid from chained_rows);
Delete from XMWXCS.UNI_USERS where rowid in (select head_rowid from chained_rows);
Insert into table_name select * from XMWXCS.UNI_USERS_TMP ;
当然也可以alter table move或者exp/imp
二 系统启动所产生的行迁移
SELECT 'Chained or Migrated Rows = '||value
FROM v$sysstat
WHERE name = 'table fetch continued row'; 整个所占比重
SELECT (select value from v$sysstat WHERE name = 'table fetch continued row')/(select sum(value)
FROM v$sysstat WHERE name like '%table%' ) from dual