oracle 索引重建,oracle重建索引對空間的使用,分析oracle索引空間使用情況,以及索引是否需要重建...

 2023-11-30 阅读 22 评论 0

摘要:分析索引空間使用情況,以及索引是否需要重建分析其他用戶下的索引需要 analyze any的權限分析索引前先查看表的大小和索引的大小,如果索引大小和表大小一樣大或者大于表的大小,那么可以判斷索引可能有問題,需要分析索引查詢對象大小:oracl

分析索引空間使用情況,以及索引是否需要重建

分析其他用戶下的索引需要 analyze any的權限

分析索引前先查看表的大小和索引的大小,如果索引大小和表大小一樣大或者大于表的大小,那么可以判斷索引可能有問題,需要分析索引

查詢對象大小:

oracle 索引重建,select owner,segment_name,segment_type,bytes/1024/1024 from dba_segments order by 4 desc

1.分析索引

SQL> analyze index AA.INDEX_AA validate structure;

SQL>

Index analyzed

oracle修改索引,查詢空間使用情況:

SQL> select name, blocks, lf_blks, ?br_blks, blocks-(lf_blks+br_blks) empty from index_stats;

NAME ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? BLOCKS ? ?LF_BLKS ? ?BR_BLKS ? ? ?EMPTY

------------------------------ ---------- ---------- ---------- ----------

AA ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?262144 ? ? ?253480 ? ? ? ?725 ? ? ? 7939

oracle怎么更新索引。--索引空塊達到了7939

2.查詢索引刪除行和刪除比例(一般刪除率達到30%就要考慮重建索引)

SQL> select t.name, --索引名

2 ? ? ? ? ?t.lf_rows, --number of leaf rows (values in the index)

3 ? ? ? ? ?t.lf_blks,

oracle索引創建。4 ? ? ? ? ?t.del_lf_rows, --number of deleted leaf rows in the index

5 ? ? ? ? ?(t.del_lf_rows / t.lf_rows)*100 ratio --刪除比例

6 ? ? from index_stats t

7 ? ? where t.name='INDEX_AA';

NAME ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?LF_ROWS ? ?LF_BLKS DEL_LF_ROWS ? ? ?RATIO

查詢索引 oracle?------------------------------ ---------- ---------- ----------- ----------

AA ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?77318533 ? ? 253480 ? ? ? ? ? 0 ? ? ? ? ?0

3.查看索引的使用率以及索引深度(深度>=4時就考慮重建索引)

SQL> SELECT height, NAME, BTREE_SPACE, USED_SPACE, PCT_USED FROM INDEX_STATS;

HEIGHT NAME ? ? ? ? ? ? ? ? ? ? ? ? ? BTREE_SPACE USED_SPACE ? PCT_USED

oracle索引失效?---------- ------------------------------ ----------- ---------- ----------

4 INDEX_AA ? ? ? ? ? ? ? ? ? ? ? 2032646380 1231201944 ? ? ? ? 61

--索引深度為4

滿足下列條件考慮重建索引

The most common justifications given for rebuilding an index are:

oracle重建索引后不生效,- index becomes fragmented

- index grows and grows - deleted space is not re-used

- index clustering factor becomes out of sync

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/186648.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息