Oracle: ORA-01502 Index UNUSABLE

Il arrive, après des manipulations plus ou moins discutable (truncate un peu violent dans un table) que les indexes deviennent invalident.

L’erreur remonté par Oracle: ORA-01502

Pour connaitre la liste des Indexes invalide :

select TABLE_OWNER, TABLE_NAME,
INDEX_NAME, STATUS
from user_indexes
where status = ‘UNUSABLE’;

A partir de cette liste, un recalcule de ses indexes :

begin
for r_list in (
select TABLE_OWNER, TABLE_NAME, INDEX_NAME, STATUS
from user_indexes
where status = ‘UNUSABLE’)
loop
EXECUTE IMMEDIATE ‘ALTER INDEX ‘ || r_list.index_name || ‘ REBUILD’;
end loop;
end;
/

This entry was posted in Oracle and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>