I got ” ORA-01502 index or partition of such index is in usable state ” error in Oracle database.
ORA-01502 index or partition of such index is in usable state
Details of error are as follows.
ORA-01502: index "string.string" or partition of such index is in unusable state Cause: An attempt has been made to access an index or index partition that has been marked unusable by a direct load or by a DDL operation Action: DROP the specified index, or REBUILD the specified index, or REBUILD the unusable index partition
SQL>
The ORA-01438 error is related with the unusable state of Index.
If the related index(es) are unusable, then you can drop these indexes or rebuild indexes as follows.
Drop Index Oracle
You can drop the unusable index as follows.
DROP INDEX SCHEMA_NAME.INDEX_NAME;
ORA-01502
To solve The ORA-01502 error, You should rebuild index as follows.
Rebuild Index Oracle
ALTER INDEX SCHEMA_NAME.INDEX_NAME REBUILD;
If you want to rebuild all unusable indexes, you can use the following script.
SELECT 'ALTER INDEX '||OWNER||'.'||INDEX_NAME||' REBUILD;' FROM DBA_INDEXES WHERE STATUS = 'UNUSABLE';
If you want to rebuild index fastly, then you can use the parallel option as follows.
ALTER INDEX SCHEMA_NAME.INDEX_NAME REBUILD PARALLEL 32;
Do you want to learn Oracle SQL, then Click This Link and read the articles.
Oracle SQL Tutorials For Beginners – Learn Oracle SQL from scratch with Oracle SQL Online Course