Oracle-降低表的高水位線


在應用中存在一系列的表,對表的操作是批量插入又批量刪除,最終導致表的水位線很高。高水位線影響全索引掃描的SQL。即影響系統的性能。

現有方法降低表的水位線:

1、降低表的高水位線
select 'alter table '||TABLE_NAME||' move tablespace '||TABLESPACE_NAME||';' from user_tables where table_name='&TABLE_NAME';
2、重建表上的索引
select 'alter index '||index_name||' rebuild online;' from user_indexes where table_name='&TABLE_NAME';
3、收集表上的統計信息
select 'analyze table '||TABLE_NAME||' compute statistics;' from user_tables where table_name='&TABLE_NAME';
4、收集索引上的統計信息
select 'analyze index '||index_name||' compute statistics;' from user_indexes where table_name='&TABLE_NAME';

注意:

1、需將對應的表名替換'&TABLE_NAME',表名要大寫,依次執行上述步驟的“查詢結果”;

2、需停服務執行,否則腳本報錯;


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM