I have table where it's primary key index got unusable due to partition merge ( I may have done it wrong).
select INDEX_NAME, STATUS from ALL_INDEXES WHERE TABLE_NAME = TRANSACTION' AND INDEX_NAME = 'PK_TRAN';
Status from above query is N/A
(unusable)
Then I tried to drop the index
drop index PK_TRAN;
resulted following error.
SQL Error: ORA-02429: cannot drop index used for enforcement of unique/primary key
Then i tried to drop the constraint
alter table TRANSACTION drop constraint PK_TRAN;
resulted following error,
SQL Error: ORA-02273: this unique/primary key is referenced by some foreign keys
Then i tried to drop the problematic reference constraints
select CONSTRAINT_NAME from all_constraints where constraint_type='R' and r_constraint_name='PK_TRAN';
alter table A drop constraint FK_1;
which resulted following error.
SQL Error: ORA-14650: operation not supported for reference-partitioned tables
How can i make transaction table's pk index valid(usable). Currently operation on this table fails with
ORA-01502: index 'PK_TRAN' or partition of such index is in unusable state
Best Answer
Now, you have to rebuild index(es) according to their type, Global or Local.
Documentation:About Rebuilding Index Partitions