oracle index unusable
1,應用人員反應:
某資料庫T_TABLE_XX_15表,沒有做任何處理,索引還在,
但查詢慢,影響歷史查詢,影響應用伺服器,體現在介面操作慢
。select * from T_TABLE_XX_15 a where a.order_id ='101505103 ';
2,登記檢視
##執行計劃確實是全表
掃描:set autotrace traceonly explain;
select * from USERXX.T_TABLE_XX_15 a where a.order_id ='101505103';
執行計劃
------------------------------------------------ ----------
計劃雜湊值:3479521290
----------------------------------- -------------------------------------------------- ------
| Id | 操作| 名稱| 行| Bytes | 成本(%CPU)| 時間|
-------------------------------------------------- -----------------------------------------
| 0 | SELECT STATEMENT | | 25 | 2225 | 4494K(1)| 14:58:52 |
| * 1 | TABLE ACCESS FULL | T_TABLE_XX_15 | 25 | 2225 | 4494K(1)| 14:58:52 |
-------------------------------------------------- -----------------------------------------
##表情況
SELECT T.TABLE_NAME, T.LAST_ANALYZED,NUM_ROWS,AVG_ROW_LEN,T.PARTITIONED,T.TABLESPACE_NAME,CEIL(S.BYTES / 1048576)MB
FROM DBA_TABLES T,DBA_SEGMENTS S
WHERE T.OWNER ='USERXX'AND T.TABLE_NAME IN
('T_TABLE_XX_15')
AND S.OWNER = T.OWNER AND S.SEGMENT_TYPE ='TABLE'AND S.SEGMENT_NAME(+)= T.TABLE_NAME
ORDER BY 1;
TABLE_NAME LAST_ANALYZE NUM_ROWS AVG_ROW_LEN PAR TABLESPACE_NAME MB
------------------------------ ------------ - --------- ----------- --- --------------------------- --- ----------
T_TABLE_XX_15 27-DEC-16 1434934004 89否BASE_USERXX 32568
##索引情況
SET頁100行132
COL COLUMN_NAME FOR A20
COL POS FOR 999
SELECT I.TABLE_NAME,I.INDEX_NAME, I.STATUS,C.COLUMN_NAME,C.COLUMN_POSITION AS POS,
SUBSTRB(I.UNIQUENESS,1,1)AS U,I.PARTITIONED
FROM DBA_INDEXES我,DBA_IND_COLUMNS?
WHERE I.TABLE_OWNER ='USERXX'AND I.TABLE_NAME IN
( 'T_TABLE_XX_15')
AND C.TABLE_OWNER = I.TABLE_OWNER AND C.TABLE_NAME = I.TABLE_NAME AND C.INDEX_NAME = I.INDEX_NAME
ORDER BY 1,2,4;
TABLE_NAME INDEX_NAME STATUS COLUMN_NAME POS U PAR
------------------------------ ------------- ----------------- -------- -------------------- ---- - ---
T_TABLE_XX_15 SYS_C00452863 UNUSABLE APPLY_ID 1 U NO
T_TABLE_XX_15 SYS_C00452863不可用標誌5 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE ORDER_ID 2 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE P_SEQ 4 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE INST_ID 3 U無命令
大小:
SQL> select sum(bytes) / 1024/1024 from dba_segments其中segment_name ='SYS_C00452863';
SUM(BYTES)/
1024/1024 --------------------
106970
##確認索引狀態是UNUSABLE,即不可用:
select / * + INDEX(a SYS_C00452863) * / * from USERXX.T_TABLE_XX_15 a where a.order_id ='101505103';
錯誤在第1行:
ORA-01502:索引'USERXX.SYS_C00452863'或這種索引的分割槽處於不可用狀態
##擴使用者臨時表空間到40GB:
alter tablespace TMP_USERXX新增tempfile'/ dev / rdblv187'size 8190m;
alter tablespace TMP_USERXX add tempfile'/ dev / rdblv188'size 8190m;
alter tablepace TMP_USERXX add tempfile'/ dev / rdblv189'size 8190m;
建立新索引(只針對欄位ORDER_ID)
在T_TABLE_XX_15(ORDER_ID)上建立索引T_TABLE_XX_15_01表空間INDX_USERXX;
SQL> select sum(bytes)/ 1024/1024/1024 from dba_segments where segment_name ='T_TABLE_XX_15_01';
SUM(BYTES)/
1024/1024/1024
------------------------- 32.234375
##索引知識點:
#set autotrace traceonly explain;
alter index index_name enable;
alter index index_name disable;
alter index index_name不可用;
alter index index_name rebuild;
alter index index_name不可見;
alter index index_name visible;
啟用/禁用針對函式索引。
不可用的索引是被最佳化器所忽略,並且不被dml操作維護,如果索引被不可用後,需要重建
。invisible索引被忽略,但是dml操作仍然會維護索引。 11g新特性)
某資料庫T_TABLE_XX_15表,沒有做任何處理,索引還在,
但查詢慢,影響歷史查詢,影響應用伺服器,體現在介面操作慢
。select * from T_TABLE_XX_15 a where a.order_id ='101505103 ';
2,登記檢視
##執行計劃確實是全表
掃描:set autotrace traceonly explain;
select * from USERXX.T_TABLE_XX_15 a where a.order_id ='101505103';
執行計劃
------------------------------------------------ ----------
計劃雜湊值:3479521290
----------------------------------- -------------------------------------------------- ------
| Id | 操作| 名稱| 行| Bytes | 成本(%CPU)| 時間|
-------------------------------------------------- -----------------------------------------
| 0 | SELECT STATEMENT | | 25 | 2225 | 4494K(1)| 14:58:52 |
| * 1 | TABLE ACCESS FULL | T_TABLE_XX_15 | 25 | 2225 | 4494K(1)| 14:58:52 |
-------------------------------------------------- -----------------------------------------
##表情況
SELECT T.TABLE_NAME, T.LAST_ANALYZED,NUM_ROWS,AVG_ROW_LEN,T.PARTITIONED,T.TABLESPACE_NAME,CEIL(S.BYTES / 1048576)MB
FROM DBA_TABLES T,DBA_SEGMENTS S
WHERE T.OWNER ='USERXX'AND T.TABLE_NAME IN
('T_TABLE_XX_15')
AND S.OWNER = T.OWNER AND S.SEGMENT_TYPE ='TABLE'AND S.SEGMENT_NAME(+)= T.TABLE_NAME
ORDER BY 1;
TABLE_NAME LAST_ANALYZE NUM_ROWS AVG_ROW_LEN PAR TABLESPACE_NAME MB
------------------------------ ------------ - --------- ----------- --- --------------------------- --- ----------
T_TABLE_XX_15 27-DEC-16 1434934004 89否BASE_USERXX 32568
##索引情況
SET頁100行132
COL COLUMN_NAME FOR A20
COL POS FOR 999
SELECT I.TABLE_NAME,I.INDEX_NAME, I.STATUS,C.COLUMN_NAME,C.COLUMN_POSITION AS POS,
SUBSTRB(I.UNIQUENESS,1,1)AS U,I.PARTITIONED
FROM DBA_INDEXES我,DBA_IND_COLUMNS?
WHERE I.TABLE_OWNER ='USERXX'AND I.TABLE_NAME IN
( 'T_TABLE_XX_15')
AND C.TABLE_OWNER = I.TABLE_OWNER AND C.TABLE_NAME = I.TABLE_NAME AND C.INDEX_NAME = I.INDEX_NAME
ORDER BY 1,2,4;
TABLE_NAME INDEX_NAME STATUS COLUMN_NAME POS U PAR
------------------------------ ------------- ----------------- -------- -------------------- ---- - ---
T_TABLE_XX_15 SYS_C00452863 UNUSABLE APPLY_ID 1 U NO
T_TABLE_XX_15 SYS_C00452863不可用標誌5 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE ORDER_ID 2 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE P_SEQ 4 U無
T_TABLE_XX_15 SYS_C00452863 UNUSABLE INST_ID 3 U無命令
大小:
SQL> select sum(bytes) / 1024/1024 from dba_segments其中segment_name ='SYS_C00452863';
SUM(BYTES)/
1024/1024 --------------------
106970
##確認索引狀態是UNUSABLE,即不可用:
select / * + INDEX(a SYS_C00452863) * / * from USERXX.T_TABLE_XX_15 a where a.order_id ='101505103';
錯誤在第1行:
ORA-01502:索引'USERXX.SYS_C00452863'或這種索引的分割槽處於不可用狀態
##擴使用者臨時表空間到40GB:
alter tablespace TMP_USERXX新增tempfile'/ dev / rdblv187'size 8190m;
alter tablespace TMP_USERXX add tempfile'/ dev / rdblv188'size 8190m;
alter tablepace TMP_USERXX add tempfile'/ dev / rdblv189'size 8190m;
建立新索引(只針對欄位ORDER_ID)
在T_TABLE_XX_15(ORDER_ID)上建立索引T_TABLE_XX_15_01表空間INDX_USERXX;
SQL> select sum(bytes)/ 1024/1024/1024 from dba_segments where segment_name ='T_TABLE_XX_15_01';
SUM(BYTES)/
1024/1024/1024
------------------------- 32.234375
##索引知識點:
#set autotrace traceonly explain;
alter index index_name enable;
alter index index_name disable;
alter index index_name不可用;
alter index index_name rebuild;
alter index index_name不可見;
alter index index_name visible;
啟用/禁用針對函式索引。
不可用的索引是被最佳化器所忽略,並且不被dml操作維護,如果索引被不可用後,需要重建
。invisible索引被忽略,但是dml操作仍然會維護索引。 11g新特性)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27126919/viewspace-2135154/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle invisible index與unusable index的區別OracleIndex
- skip_unusable_index parameterIndex
- unusable index對DML/QUERY的影響Index
- 【INDEX】索引失效或者不可用 UNUSABLEIndex索引
- ORA-20000:index is in unusableIndex
- ORA-01502 index is in unusable stateIndex
- Some indexes or index partitions of table have been marked unusableIndex
- 10g可以通過命令使index unusable!Index
- alter index unusable無法起作用的情況Index
- alter index unusable 無法起作用的情況 ztIndex
- ORA-20000: index "xxxx" or partition of such index is in unusable stateIndex
- ORA-01502 index state unusable錯誤成因和解決方法Index
- oracle document indexOracleIndex
- Oracle Index InternalsOracleIndex
- 【Oracle】global index & local index的區別OracleIndex
- skip_unusable_indexesIndex
- oracle index索引原理OracleIndex索引
- zt_oracle indexOracleIndex
- oracle hint_no_indexOracleIndex
- oracle index monitoringOracleIndex
- oracle index 聚集因子OracleIndex
- oracle hints index格式OracleIndex
- oracle hint之full,index,index_asc,index_desc,index_combile示例OracleIndex
- oracle hint之hint_index_ffs,index_joinOracleIndex
- SKIP_UNUSABLE_INDEXES InitializationIndex
- ORACLE中index的rebuildOracleIndexRebuild
- oracle小知識點7--索引的unusable,disable,invisibleOracle索引
- NBU detected IBM drives as unusableIBM
- Oracle索引分裂(Index Block Split)Oracle索引IndexBloC
- oracle hint_no_parallel_no_parallel_indexOracleParallelIndex
- oracle hint_parallel_parallel_indexOracleParallelIndex
- Oracle alter index rebuild 說明OracleIndexRebuild
- [轉載]oracle_Bitmap IndexOracleIndex
- oracle INDEX BY Pl/sql陣列OracleIndexSQL陣列
- Oracle的Index-3(轉)OracleIndex
- Oracle的Index-2(轉)OracleIndex
- Oracle的Index-1(轉)OracleIndex
- Oracle筆記 之 索引(index)Oracle筆記索引Index