Oracle 23.26SQLLab-verified · 2026-11-29

ORA-01502: index or partition of such index is in unusable state

An index on the table is UNUSABLE, and the statement needs it (a unique index on INSERT, or a query forced to use it).

Oracle AI Database 26ai Free 23.26.3.0.0
ORA-01502: index 'LAB_A.EMP_UK' or partition of such index is in unusable state

Jump to a cause

  1. 01ALTER TABLE MOVE (table reorganization) left the index UNUSABLE
  2. 02Index set UNUSABLE for a bulk load and not rebuilt
  3. 03TRUNCATE PARTITION made a global index UNUSABLE

Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-29 · container image gvenzl/oracle-free:23-slim

Some maintenance operations leave indexes in UNUSABLE state without any error at the time. The error appears later, when a DML or query needs that index. Find them with SELECT index_name, status FROM user_indexes WHERE table_name = '…'.

In every case below, ALTER INDEX … REBUILD sets the status back to VALID and the failed statement works.

01ALTER TABLE MOVE (table reorganization) left the index UNUSABLE

ALTER TABLE emp MOVE rewrites the table and leaves its index UNUSABLE without any message. The next INSERT fails because the unique index EMP_UK must be maintained.

Setup
Setuprun as lab_a
CREATE TABLE emp (empno NUMBER, ename VARCHAR2(20));
CREATE UNIQUE INDEX emp_uk ON emp (empno);
INSERT INTO emp VALUES (1, 'KIM');
COMMIT;
ALTER TABLE emp MOVE;
OUTPUT
Table created.


Index created.


1 row created.


Commit complete.


Table altered.
Reproducerun as lab_a
INSERT INTO emp VALUES (2, 'LEE');
✕ ERROR
INSERT INTO emp VALUES (2, 'LEE')
*
ERROR at line 1:
ORA-01502: index 'LAB_A.EMP_UK' or partition of such index is in unusable state
Help: https://docs.oracle.com/error-help/db/ora-01502/
Checkrun as lab_a
SELECT index_name, status FROM user_indexes WHERE table_name = 'EMP';
OUTPUT
INDEX_NAME                     STATUS
------------------------------ ------------------------------
EMP_UK                         UNUSABLE

1 row selected.
Checkrun as lab_a
SELECT * FROM emp;
OUTPUT
     EMPNO ENAME
---------- --------------------
         1 KIM

1 row selected.
Fixrun as lab_a
ALTER INDEX emp_uk REBUILD;
OUTPUT
Index altered.

USER_INDEXES shows EMP_UK as UNUSABLE, while a plain SELECT * FROM emp still works. After ALTER INDEX emp_uk REBUILD the INSERT succeeds and the status is VALID.

After the fixrun as lab_a
INSERT INTO emp VALUES (2, 'LEE');
COMMIT;
SELECT index_name, status FROM user_indexes WHERE table_name = 'EMP';
✓ SUCCESS
1 row created.


Commit complete.


INDEX_NAME                     STATUS
------------------------------ ------------------------------
EMP_UK                         VALID

1 row selected.

02Index set UNUSABLE for a bulk load and not rebuilt

Indexes are often made UNUSABLE to speed up a large load. If the rebuild step is forgotten, a query that uses the index (here forced with an INDEX hint) fails.

Setup
Setuprun as lab_a
CREATE TABLE sales (id NUMBER, amount NUMBER);
CREATE INDEX sales_ix ON sales (id);
INSERT INTO sales VALUES (1, 100);
COMMIT;
ALTER INDEX sales_ix UNUSABLE;
OUTPUT
Table created.


Index created.


1 row created.


Commit complete.


Index altered.
Reproducerun as lab_a
SELECT /*+ INDEX(sales sales_ix) */ * FROM sales WHERE id = 1;
✕ ERROR
SELECT /*+ INDEX(sales sales_ix) */ * FROM sales WHERE id = 1
*
ERROR at line 1:
ORA-01502: index 'LAB_A.SALES_IX' or partition of such index is in unusable state
Help: https://docs.oracle.com/error-help/db/ora-01502/
Fixrun as lab_a
ALTER INDEX sales_ix REBUILD;
OUTPUT
Index altered.

Run ALTER INDEX sales_ix REBUILD at the end of the load. The same query then returns the row.

After the fixrun as lab_a
SELECT /*+ INDEX(sales sales_ix) */ * FROM sales WHERE id = 1;
✓ SUCCESS
        ID     AMOUNT
---------- ----------
         1        100

1 row selected.

03TRUNCATE PARTITION made a global index UNUSABLE

sales_p_uk is a global unique index on a partitioned table. ALTER TABLE … TRUNCATE PARTITION p2025 without index maintenance marks it UNUSABLE, so an INSERT into a different partition fails too.

Setup
Setuprun as lab_a
CREATE TABLE sales_p (id NUMBER, sale_date DATE)
PARTITION BY RANGE (sale_date) (
  PARTITION p2025 VALUES LESS THAN (DATE '2026-01-01'),
  PARTITION p2026 VALUES LESS THAN (DATE '2027-01-01')
);
CREATE UNIQUE INDEX sales_p_uk ON sales_p (id);
INSERT INTO sales_p VALUES (1, DATE '2025-06-01');
INSERT INTO sales_p VALUES (2, DATE '2026-06-01');
COMMIT;
ALTER TABLE sales_p TRUNCATE PARTITION p2025;
OUTPUT
Table created.


Index created.


1 row created.


1 row created.


Commit complete.


Table truncated.
Reproducerun as lab_a
INSERT INTO sales_p VALUES (3, DATE '2026-07-01');
✕ ERROR
INSERT INTO sales_p VALUES (3, DATE '2026-07-01')
*
ERROR at line 1:
ORA-01502: index 'LAB_A.SALES_P_UK' or partition of such index is in unusable state
Help: https://docs.oracle.com/error-help/db/ora-01502/
Fixrun as lab_a
ALTER INDEX sales_p_uk REBUILD;
OUTPUT
Index altered.

ALTER INDEX sales_p_uk REBUILD makes it VALID again and the INSERT works.

After the fixrun as lab_a
INSERT INTO sales_p VALUES (3, DATE '2026-07-01');
COMMIT;
SELECT index_name, status FROM user_indexes WHERE index_name = 'SALES_P_UK';
✓ SUCCESS
1 row created.


Commit complete.


INDEX_NAME                     STATUS
------------------------------ ------------------------------
SALES_P_UK                     VALID

1 row selected.

FAQ

How do I fix ORA-01502?

Find the UNUSABLE index in USER_INDEXES (or USER_IND_PARTITIONS for a partitioned index) and run ALTER INDEX <name> REBUILD.

How do I find unusable indexes in Oracle?

SELECT index_name, status FROM user_indexes WHERE status = 'UNUSABLE';

Does ALTER TABLE MOVE make indexes unusable?

Yes, without any warning. Check USER_INDEXES after the move and rebuild the indexes.

Why does INSERT fail but SELECT works?

In the test, SELECT * FROM emp worked while the index was UNUSABLE, but the INSERT had to maintain the unique index and failed until it was rebuilt.

How we verify

Each scenario starts from fresh database users. A script runs the setup, confirms the exact error code, applies the fix and runs the statement again. The output shown is what the database printed, saved by the script.

lab_a and lab_b are ordinary users created for the test; system is the DBA account. Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free 23.26.3.0.0