检查表碎片
-
maojinyu
2011-03-15 17:14:00
-
数据库开发技术
-
原创
select t.table_name,
avg_row_len * num_rows / (1 - pct_free / 100) / 8192 actual_block,
alloc_block,
1 - ((avg_row_len * num_rows / (1 - pct_free / 100) / 8192) / alloc_block) percen,
'alter table '||t.table_name||'enable row movement'||';' enable_row,
'alter table '||t.table_name||'shrink space'||';' ddl_shrink
from (select segment_name, sum(blocks) alloc_block
from user_extents
having sum(blocks) > 8
group by segment_name) a,
user_tables t
where a.segment_name = t.table_name
and num_rows is not null
and num_rows > 0
order by 4 desc[@more@]