|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
能够从网络上找到的多半是对Oracle分区技术理论的阐述,以下内容将以实例的形式,简单明了的告诉大家如何具体的去应用分区技术。为了提高系统性能,应采用Partition_Key来作为分区条件。而在数据加载的时候,通过计算得出Partition_Key。因为Oracle系统在将明细数据写入分区表的时候,需要做判断,判断条件越简单,插入数据的性能越高。
CREATE TABLE demo
(
CUST_TYPE_KEY NUMBER(3) NOT NULL,
SP_SRV_KEY INTEGER NOT NULL,
DEPT_KEY NUMBER(10) NOT NULL,
USR_TYPE_KEY NUMBER(3) NOT NULL,
GENDER_KEY NUMBER(3) NOT NULL,
AGE_KEY NUMBER(3) NOT NULL,
SRV_PLAN_KEY NUMBER(10) NOT NULL,
OCCP_TYPE_KEY NUMBER(3) NOT NULL,
ATTH_AREA_KEY NUMBER(6) NOT NULL,
HR_SEG_KEY NUMBER(3) NOT NULL,
IN_NET_DURATION_KEY NUMBER(3) NOT NULL,
DT_KEY NUMBER(8) NOT NULL,
COMM_FIRST_RTE_CHRG NUMBER(13,2),
COMM_SEC_RTE_CHRG NUMBER(13,2),
INFO_FIRST_RTE_CHRG NUMBER(13,2),
INFO_SEC_RTE_CHRG NUMBER(13,2),
FIRST_RTE_TELE_CHARGE NUMBER(13,2),
SECOND_RTE_TELE_CHARGE NUMBER(13,2),
INFO_TIMES NUMBER(8),
USR_QTY INTEGER,
PARTITION_KEY NUMBER(3) NOT NULL,
LST_UPD_DT DATE DEFAULT SYSDATE NOT NULL
)
TABLESPACE DW1_GEN_TBL
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
)
NOLOGGING
PARTITION BY RANGE (PARTITION_KEY)
(
PARTITION PT01 VALUES LESS THAN (1)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT02 VALUES LESS THAN (2)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT03 VALUES LESS THAN (3)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT04 VALUES LESS THAN (4)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT05 VALUES LESS THAN (5)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT06 VALUES LESS THAN (6)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT07 VALUES LESS THAN (7)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT08 VALUES LESS THAN (8)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT09 VALUES LESS THAN (9)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT10 VALUES LESS THAN (10)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT11 VALUES LESS THAN (11)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
),
PARTITION PT12 VALUES LESS THAN (12)
NOLOGGING
NOCOMPRESS
TABLESPACE DW1_GEN_TBL
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 1M
MINEXTENTS 1
MAXEXTENTS 2147483645
BUFFER_POOL DEFAULT
)
)
NOCACHE
NOPARALLEL; |
|