Lab-verifiedReproduced and fixed on Oracle AI Database 26ai Free 23.26.3.0.0 · 2026-11-25 · container image gvenzl/oracle-free:23-slim
Oracle does not let you create a second index with the same column list, in the same order, as an existing one. The existing index can have any name, and it may have been created for you by a primary key or unique constraint. CREATE INDEX then fails with ORA-01408.
Check user_ind_columns first to see which index already covers the columns. The three cases below were run on a real database.
01Creating an index on a primary key column
orders.order_id was the primary key. CREATE INDEX orders_id_ix ON orders (order_id) failed with ORA-01408.
user_indexes joined with user_ind_columns showed why: the primary key had already created ORDERS_PK, a UNIQUE index on ORDER_ID. No extra index is needed.
For deployment scripts that must not fail, the retry step wraps the CREATE INDEX in a PL/SQL block that first checks whether the same column list is already indexed. It printed skip: ORDER_ID already indexed and finished without an error.
Setup
CREATE TABLE orders (order_id NUMBER CONSTRAINT orders_pk PRIMARY KEY, cust_id NUMBER, order_date DATE);Table created.CREATE INDEX orders_id_ix ON orders (order_id);CREATE INDEX orders_id_ix ON orders (order_id)
*
ERROR at line 1:
ORA-01408: such column list already indexed
Help: https://docs.oracle.com/error-help/db/ora-01408/COLUMN index_name FORMAT A15
COLUMN column_name FORMAT A12
SELECT i.index_name, i.uniqueness, c.column_name, c.column_position
FROM user_indexes i JOIN user_ind_columns c ON c.index_name = i.index_name
WHERE i.table_name = 'ORDERS' ORDER BY i.index_name, c.column_position;INDEX_NAME UNIQUENES COLUMN_NAME COLUMN_POSITION
--------------- --------- ------------ ---------------
ORDERS_PK UNIQUE ORDER_ID 1
1 row selected.The check compares the column list with LISTAGG(column_name, ',') WITHIN GROUP (ORDER BY column_position), so it does not depend on the index name.
SET SERVEROUTPUT ON
DECLARE
n NUMBER;
BEGIN
SELECT COUNT(*) INTO n FROM (
SELECT index_name FROM user_ind_columns
WHERE table_name = 'ORDERS'
GROUP BY index_name
HAVING LISTAGG(column_name, ',') WITHIN GROUP (ORDER BY column_position) = 'ORDER_ID');
IF n = 0 THEN
EXECUTE IMMEDIATE 'CREATE INDEX orders_id_ix ON orders (order_id)';
DBMS_OUTPUT.PUT_LINE('created');
ELSE
DBMS_OUTPUT.PUT_LINE('skip: ORDER_ID already indexed');
END IF;
END;
/skip: ORDER_ID already indexed
PL/SQL procedure successfully completed.02Same columns in the same order, just a different index name
orders_cust_date_ix on (cust_id, order_date) already existed. CREATE INDEX ix_orders_cust ON orders (cust_id, order_date) failed with ORA-01408. A different name does not make it a different index.
If the existing index is enough, there is nothing to create. If you really need the other column order, CREATE INDEX orders_date_cust_ix ON orders (order_date, cust_id) succeeded, and both indexes were listed afterwards.
Setup
CREATE TABLE orders (order_id NUMBER PRIMARY KEY, cust_id NUMBER, order_date DATE);
CREATE INDEX orders_cust_date_ix ON orders (cust_id, order_date);Table created.
Index created.CREATE INDEX ix_orders_cust ON orders (cust_id, order_date);CREATE INDEX ix_orders_cust ON orders (cust_id, order_date)
*
ERROR at line 1:
ORA-01408: such column list already indexed
Help: https://docs.oracle.com/error-help/db/ora-01408/CREATE INDEX orders_date_cust_ix ON orders (order_date, cust_id);Index created.Only the same columns in the same order count as a duplicate. (order_date, cust_id) is a different column list.
COLUMN index_name FORMAT A20
COLUMN cols FORMAT A22
SELECT index_name, LISTAGG(column_name, ',') WITHIN GROUP (ORDER BY column_position) AS cols
FROM user_ind_columns WHERE table_name = 'ORDERS' AND index_name <> (SELECT index_name FROM user_constraints WHERE table_name = 'ORDERS' AND constraint_type = 'P')
GROUP BY index_name ORDER BY index_name;INDEX_NAME COLS
-------------------- ----------------------
ORDERS_CUST_DATE_IX CUST_ID,ORDER_DATE
ORDERS_DATE_CUST_IX ORDER_DATE,CUST_ID
2 rows selected.03Replacing a normal index with a UNIQUE one on the same column
members_email_ix was a normal index on email. CREATE UNIQUE INDEX members_email_ux ON members (email) failed with ORA-01408.
Creating the unique index as INVISIBLE worked. Then the old index was made invisible, the new one visible, and the old one dropped. Only MEMBERS_EMAIL_UX (UNIQUE, VISIBLE) remained.
Setup
CREATE TABLE members (member_id NUMBER PRIMARY KEY, email VARCHAR2(50));
CREATE INDEX members_email_ix ON members (email);
INSERT INTO members VALUES (1, 'kim@example.com');
INSERT INTO members VALUES (2, 'lee@example.com');
COMMIT;Table created.
Index created.
1 row created.
1 row created.
Commit complete.CREATE UNIQUE INDEX members_email_ux ON members (email);CREATE UNIQUE INDEX members_email_ux ON members (email)
*
ERROR at line 1:
ORA-01408: such column list already indexed
Help: https://docs.oracle.com/error-help/db/ora-01408/CREATE UNIQUE INDEX members_email_ux ON members (email) INVISIBLE;
ALTER INDEX members_email_ix INVISIBLE;
ALTER INDEX members_email_ux VISIBLE;
DROP INDEX members_email_ix;Index created.
Index altered.
Index altered.
Index dropped.This keeps an index on email at every step. Creating the UNIQUE index still requires the existing data to have no duplicates.
COLUMN index_name FORMAT A18
SELECT index_name, uniqueness, visibility FROM user_indexes WHERE table_name = 'MEMBERS' AND index_name LIKE 'MEMBERS_EMAIL%';INDEX_NAME UNIQUENES VISIBILIT
------------------ --------- ---------
MEMBERS_EMAIL_UX UNIQUE VISIBLE
1 row selected.FAQ
What does ORA-01408 such column list already indexed mean?
There is already an index with the same columns in the same order. Oracle does not create a second one, even under a different name.
Do I need an index on a primary key column?
No. The primary key creates its own unique index (here ORDERS_PK), which is why CREATE INDEX on that column gives ORA-01408.
How do I find which index already covers my columns?
Query user_ind_columns for the table and look at column_name and column_position per index_name.
How do I change a non-unique index to UNIQUE?
Create the UNIQUE index as INVISIBLE, make the old index invisible and the new one visible, then drop the old index.
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