Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

tablespace of primary key

884570Sep 14 2011 — edited Sep 14 2011
Hello,

We are currently using the following (simplified for readability) form of creating primary keys:
create table ALEX.alex_constraint2 (columnn1 varchar2(5)) tablespace mytablespace;
ALTER TABLE ALEX.alex_constraint2 ADD CONSTRAINT alex_constraint2
PRIMARY KEY (columnn1) ;

The one issue is the key gets created in the default tablespace.

So I'm planning on modifying the code to do:
create table ALEX.alex_constraint (columnn1 varchar2(5)) tablespace mytablespace;
ALTER TABLE ALEX.alex_constraint ADD CONSTRAINT alex_constraint
PRIMARY KEY (columnn1) USING INDEX tablespace mytablespace;
(the difference is 'USING INDEX tablespace mytablespace'

The intention has always been to create the primary key on same tablespace as the table. Previously we accomplished it by setting the default tablespace to match.
Is there any difference between doing this (assuming default tablespace is 'mytablespace'):
ALTER TABLE ALEX.alex_constraint2 ADD CONSTRAINT alex_constraint2
PRIMARY KEY (columnn1) ;
or this (not making assumption about default tablespace):
ALTER TABLE ALEX.alex_constraint ADD CONSTRAINT alex_constraint
PRIMARY KEY (columnn1) USING INDEX tablespace mytablespace;


Thank you for any assistance
Alex

Edited by: user5947840 on Sep 14, 2011 10:26 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 12 2011
Added on Sep 14 2011
2 comments
509 views