Oracle 工具類 Sql 分析索引的 碎片率

2022-02-13 12:07:44 字數 657 閱讀 3238

cbo基於成本的優化器分析  分配合適的儲存桶 使用儲存過程dbms_stats

1、索引分析

分析語句:

sql>analyze index validate structure online;

分析表:

analyze table tablename compute statistics;

analyze index indexname compute statistics;

檢視索引碎片的情況:

sql>select name,del_lf_rows_len,lf_rows_len,(del_lf_rows_len/lf_rows_len)*100 from index_stats;

索引碎片率:(del_lf_rows_len/lf_rows_len)*100

如果索引碎片率超過20%,oracle就會認為索引碎片已經非常嚴重,此時就需要對索引碎片進行整理。

2、索引碎片整理

索引碎片整理包括兩種策略:

(1)重建索引(rebuild)

sql>alter index rebuild;

(2)壓縮索引(coalesce)

sql>alter index coalesce;

oracle建議定期分析之後採用重建索引(rebuild)的策略。

工具 Sql 匯出到 Oracle

公司切換資料庫,需要原來mssql資料庫的資料匯出到oracle中。本來sql自帶的 匯入與匯出 工具就挺好用的。不過由於我們的表結構比較特殊,sql的 匯入與匯出 不太好使。所興就自己寫了乙個,現與大家分享!使用很簡單,只需要按指令碼語法寫了指令碼 執行 即可。指令碼語法 注釋 和大多數程式語言一...

oracle中常見的工具sql

1.檢視一張表是不是分割槽表 select from user part tables where table name 或者是select from user tab partitions where table name 表名 2.oracle中建立分割槽的方法有範圍分割槽,雜湊分割槽,列表分割...

oracle中常見的工具sql

1.檢視一張表是不是分割槽表 select from user part tables where table name 或者是select from user tab partitions where table name 表名 2.oracle中建立分割槽的方法有範圍分割槽,雜湊分割槽,列表分割...