--整理表碎片
select 'alter table '||table_name||' enable row movement;
alter table '||table_name||' shrink space cascade;
alter table '||table_name||' disable row movement;'
from user_tables order by table_name;
select 'alter index '||index_name||' shrink space cascade;'
from user_indexes order by index_name;
select 'alter index '||index_name ||' rebuild online;
commit;' from user_indexes
order by index_name;
SELECT 'analyze table '||TABLE_NAME||' compute statistics;'
FROM USER_TABLES
ORDER BY TABLE_NAME
本文提供了一种通过SQL脚本的方式整理数据库表碎片的方法,包括使表行可移动、收缩表空间、重建索引以及在线重建索引等操作,并最后通过analyze命令更新表统计信息。
1648

被折叠的 条评论
为什么被折叠?



