【ORACLE】创建表-主键分区索引

– Create table
create table xxx
(
f1 VARCHAR2(12) not null,
f2 VARCHAR2(8) not null,
sjjcpch VARCHAR2(20),
sjjcsj DATE
)
partition by list (f2)
(
partition P201701 values (‘201701’)
tablespace txx
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
),
partition P_OTHER values (DEFAULT)
tablespace txx
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
)
);
– Add comments to the table
comment on table xxx
is ‘xxx’;
– Add comments to the columns
comment on column xxx.f1
is ‘f1’;
comment on column xxx.sjjcpch
is ‘数据集成批次号’;
comment on column xxx.sjjcsj
is ‘数据集成时间’;
– Create/Recreate indexes
create index i_xxx on xxx (f2)
tablespace txx
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
)
nologging;
– Create/Recreate primary, unique and foreign key constraints
alter table xxx
add constraint PK_f12 primary key (f1, f2)
using index
tablespace txx
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);

你可能感兴趣的:(【ORACLE】创建表-主键分区索引)