Oracle分区和子分区

时间:2019-05-07 12:10:24

标签: oracle database-partitioning subpartition

当前,我们使用类似于以下内容的查询来添加分区:

ALTER TABLE ${" + DDL_VARIABLE_KEY_SCHEMA_NAME + "}.${" +
  DDL_VARIABLE_KEY_TABLE_NAME + "} ADD PARTITION ${" +
  DDL_VARIABLE_KEY_PARTITION_NAME + "} VALUES LESS THAN(${" +
  DDL_VARIABLE_KEY_CUTOFF_DATE + "})"

我应该如何创建查询以创建子分区?

下面的内容足以满足要求吗? 还是需要任何更改?

alter table xxxxx.xxxxx
modify PARTITION BY RANGE (CREATEDATE)
SUBPARTITION BY LIST (PURGEID)
subpartition template(
SUBPARTITION SP1 values (0),
SUBPARTITION SP2 values (1),
SUBPARTITION SP3 values (2),
SUBPARTITION SP4 values (3))
(
PARTITION p1 VALUES LESS THAN (TO_DATE('01-JAN-2018', 'DD-MON-YYYY')),
PARTITION p2 VALUES LESS THAN (TO_DATE('01-MAY-2018', 'DD-MON-YYYY')),
PARTITION p3 VALUES LESS THAN (TO_DATE('01-SEP-2018', 'DD-MON-YYYY')),
PARTITION p5 VALUES LESS THAN (maxvalue)) online;

0 个答案:

没有答案