Error while creating Foreign key on table:
ALTER TABLE USER1.table1 ADD CONSTRAINT sringra_FK FOREIGN KEY (CUST_ID) REFERENCES USER2.table2 (TAB1_ID) ENABLE ;
but i am getting
ORA-01031: insufficient privileges
Solution:
grant references on user2.table2 to user1;
now issue the command
ALTER TABLE USER1.table1 ADD CONSTRAINT sringra_FK FOREIGN KEY (CUST_ID) REFERENCES USER2.table2 (TAB1_ID) ENABLE ;
--------------------------------------------------------------------------------------------------------------------------
How to rebuild an index?
ALTER INDEX <index_name> REBUILD;
ALTER INDEX <index_name> REBUILD ONLINE; ---> to rebuild an index online.
--------------------------------------------------------------------------------------------------------------------------
Can you disable and enable Primary key?
yes.we have to disable reference keys on child tables.
--------------------------------------------------------------------------------------------------------------------------
ALTER TABLE USER1.table1 ADD CONSTRAINT sringra_FK FOREIGN KEY (CUST_ID) REFERENCES USER2.table2 (TAB1_ID) ENABLE ;
but i am getting
ORA-01031: insufficient privileges
Solution:
grant references on user2.table2 to user1;
now issue the command
ALTER TABLE USER1.table1 ADD CONSTRAINT sringra_FK FOREIGN KEY (CUST_ID) REFERENCES USER2.table2 (TAB1_ID) ENABLE ;
--------------------------------------------------------------------------------------------------------------------------
How to rebuild an index?
ALTER INDEX <index_name> REBUILD;
ALTER INDEX <index_name> REBUILD ONLINE; ---> to rebuild an index online.
--------------------------------------------------------------------------------------------------------------------------
Can you disable and enable Primary key?
yes.we have to disable reference keys on child tables.
--------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment