日期:2014-05-16  浏览次数:20449 次

Oracle 分区索引
-- Create table
drop table PERSON2;
create table PERSON2
(
  ID       VARCHAR2(32) not null,
  PID      NUMBER,
  ORDERID  NUMBER,
  DPT      VARCHAR2(4),
  DPC      VARCHAR2(16),
  GDS      VARCHAR2(8),
  XM       VARCHAR2(64),
  XB       VARCHAR2(2),
  MZ       VARCHAR2(32),
  JG       VARCHAR2(64),
  XTLB     VARCHAR2(100),
  QFBS     VARCHAR2(2),
  CSRQ     VARCHAR2(32),
  SFZH     VARCHAR2(60),
  ZZMM     VARCHAR2(16),
  RDTSJ    VARCHAR2(32),
  WHCD     VARCHAR2(32),
  XW       VARCHAR2(8),
  BYSJ     VARCHAR2(32),
  BYXX     VARCHAR2(128),
  SXZY     VARCHAR2(60),
  CJGZSJ   VARCHAR2(32),
  SZJG     VARCHAR2(128),
  SZBM     VARCHAR2(128),
  ZP       BLOB,
  BZ       CLOB,
  ZW       VARCHAR2(128),
  ZWDM     VARCHAR2(4),
  RZSJ     VARCHAR2(32),
  LDBS     VARCHAR2(4),
  ZWGP     VARCHAR2(1),
  JBDY     VARCHAR2(4),
  ZYJB     VARCHAR2(3),
  ZYTC     VARCHAR2(64),
  ZYJSZCDJ VARCHAR2(1),
  ZYJSZCLB VARCHAR2(3),
  ZYJSZC   VARCHAR2(64),
  ZYJSZWLB VARCHAR2(3),
  ZYJSZW   VARCHAR2(64),
  PRSJ     VARCHAR2(32),
  RYJG     VARCHAR2(10),
  BZLX     VARCHAR2(4),
  KZQD     VARCHAR2(2),
  GZZE     NUMBER(10,2),
  RYLB     VARCHAR2(3),
  GWLB     VARCHAR2(2),
  DRQDW    VARCHAR2(128),
  DRSJ     VARCHAR2(60),
  LBSJ     VARCHAR2(32),
  HBYY     VARCHAR2(4),
  HBSJ     VARCHAR2(32),
  HJSJ     VARCHAR2(60),
  HJYY     VARCHAR2(4),
  ZBZT     VARCHAR2(1),
  BY0      VARCHAR2(1),
  BY1      VARCHAR2(2),
  BY2      VARCHAR2(4),
  BY3      VARCHAR2(8),
  BY4      VARCHAR2(16),
  BY5      VARCHAR2(32),
  BY6      VARCHAR2(64),
  BY7      VARCHAR2(128),
  SDCZ     VARCHAR2(10) default 0 not null,
  DIAOLI   VARCHAR2(10) default 0 not null,
  BZZH     VARCHAR2(200),
  TJSJ     VARCHAR2(32),
  QHDM     VARCHAR2(10),
  JYSJ     VARCHAR2(32),
  LTSJ     VARCHAR2(32)
)
partition by range (QHDM)
(
  partition J0 values less than ('220099')
    tablespace DATA_J0
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition CC values less than ('220199')
    tablespace DATA_CC
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition JL values less than ('220299')
    tablespace DATA_JL
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition SP values less than ('220399')
    tablespace DATA_SP
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition LY values less than ('220499')
    tablespace DATA_LY
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition TH values less than ('220599')
    tablespace DATA_TH
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition BS values less than ('220699')
    tablespace DATA_BS
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition SY values less than ('220799')
    tablespace DATA_SY
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition BC values less than ('220899')
    tablespace DATA_BC
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    ),
  partition YB values less than ('222499')
    tablespace DATA_YB
    pctfree 10
    initrans 1
    maxtrans 255
    storage
    (
      initial 64K
      minextents 1
      maxextents unlimited
    )
);
-- Create/Recreate primary, unique and foreign key constraints 
alter table PERSON2
  add constraint PK_PERSO