ORA-01502: index 'indexname' or partition of such index is in unusable state
The reason is that some indexes has been marked unusable by a direct load or by a DDL operation, or shrinking space etc. Here is simple solution.
- Drop the specified index and/or recreate the index
- Rebuild the specified index
- Rebuild the unusable index partition
Here we rebuilding UNUSABLE indexes onling, quering to USER_INDEXES view.
$sqlplus /nologSql> connect system/oracle
Sql> SELECT count(*),status FROM all_indexes GROUP BY status;
Sql> SELECT 'alter index 'table_owner'.'index_name' rebuild online ;' FROM all_indexes where status='UNUSABLE' ORDER BY table_owner
Just execute sql statement output, it will rebuild all unused indexes.
1 comments:
This error messaged appeared when I used SELECT statement in Oracle but at that time I wasn't aware of the cause of that error. Now I understand that it was because of unusable state of Index. I can resolve the error if it occurs in future.
Post a Comment