I tried:

alter index clave_primaria_de_b local;

and I read:


But I don't know how to do it.


You cannot convert a global index into a local index with an ALTER INDEX command. You need to drop the index and recreate it using the LOCAL keyword.


Suppose I have a table b with a Primary Key called clave_primaria_de_b, then I need to keep this relational structure but also I need to create a local index on b's primary key; so I have read I could:

alter table b disable cnstraint clave_primaria_de_b

create index indice_5 on b(a) local

alter table b enable constraint clave_primaria_de_b using index indice_5

I have a doubt could I include the using index clause when reenabling the constraint?

Thank you for your help.

Also after posting I have a new doubt: Imagine we are in a multiusers environment and we need to keep this table online for clients' queries so then if we want to disable the primary key but also keep new data been enforced by this primary key I would write the first line:

alter table b disable novalidate constraint clave_primaria_de_b

Because by default it is disable validate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.