Oracle DBMS – Unusable Index on Primary Key

indexoracle

We are executing a large number of INSERT operations (140k circa) on a table during an ETL process and this error pops out:

Caught SQLException for insert into DMALM_USER_ROLES [...]
Caused by: java.sql.SQLException: ORA-01502: index 'DM_ALM.DM_ALM_USER_ROLES_PK' or partition of such index is in unusable state

The DBMS is Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 – 64bit Production

Any hint?

edit: after this process, the table DMALM_USER_ROLES is empty

Best Answer

You can rebuild an unusable index using

alter index DM_ALM.DM_ALM_USER_ROLES_PK rebuild;