Monday, May 15, 2006

Creating a primary key with a parallel degree.

Step 1: (Create a primary key, disabled.)
alter table table_name
add (constraint pk_key_name
primary key (field_name))
disable primary key;


Step 2: (Create an unique index with the same name and columns as the primary key.)
create unique index pk_key_name on table_name(field_name)
tablespace tablespace_name
storage (initial ?M next ?M pctincrease 0)
parallel (degree ?)
nologging;

Step 3: (Now enable the primary key.)
alter table table_name enable primary key;

No comments: