Oracle Unusable Indexes Report
Displays indexes that are not in a valid state for a specified schema or for all schemas. Useful for identifying unusable indexes that may affect query performance or require rebuild operations.
oraclesqlindexing-statisticsv1.0.0
0 stars0 downloads20 views0 comments
By OracleDba • Created
Code
(25 lines)12345678910111213141516171819202122232425
-- -----------------------------------------------------------------------------------
-- File Name : https://oracle-base.com/dba/monitoring/unusable_indexes.sql
-- Author : Tim Hall
-- Description : Displays unusable indexes for the specified schema or all schemas.
-- Requirements : Access to the DBA views.
-- Call Syntax : @unusable_indexes (schema-name or all)
-- Last Modified: 28/01/2018
-- -----------------------------------------------------------------------------------
SET VERIFY OFF LINESIZE 200
COLUMN owner FORMAT A30
COLUMN index_name FORMAT A30
COLUMN table_owner FORMAT A30
COLUMN table_name FORMAT A30
SELECT owner,
index_name,
index_type,
table_owner,
table_name
table_type
FROM dba_indexes
WHERE owner = DECODE(UPPER('&1'), 'ALL', owner, UPPER('&1'))
AND status NOT IN ('VALID', 'N/A')
ORDER BY owner, index_name;