drop table sales1;
--范围必须越来越大
CREATE TABLE sales1(
year int ,
month int,
day int,
fee number)
PARTITION by range (year,month,day)
(
partition sale1 values less than(1999,02,01) tablespace ts1,
partition sale2 values less than(2000,01,01) tablespace ts2,
partition sale3 values less than(2001,01,01) tablespace ts3,
partition sale4 values less than(2002,01,01) tablespace ts4,
partition sale5 values less than(MAXVALUE,MAXVALUE,MAXVALUE) tablespace ts5
);
--第一种索引
drop index idx_sales1;
create index idx_sales1 on sales1(year);
--第二种索引
drop index idx_sales1;
--ORA-14021: 必须指定所有列的 MAXVALUE
--ORA-14010: 不可以指定索引分区的此物理属性
create index idx_sales1 on sales1(year)
global partition by range(year)
(
partition sale1 values less than(1999) tablespace tsi1,
partition sale2 values less than(2000) tablespace tsi2,
partition sale3 values less than(2001) tablespace tsi3,
partition sale4 values less than(2002) tablespace tsi4,
partition sale5 values less than(MAXVALUE) tablespace tsi5
);
--第三种索引
drop index idx_sales1;
--ORA-14024: LOCAL 索引的分区数必须等于基本表的分区数(索引分区名可以与表分区名不一致,不过索引 数据怎么存储呢?)
CREATE INDEX idx_sales1 ON SALES1 (YEAR)
TABLESPACE EXAMPLE LOCAL
(
PARTITION aSALE1 tablespace tsi1,
PARTITION aSALE2 tablespace tsi2,
PARTITION aSALE3 tablespace tsi3,
PARTITION aSALE4 tablespace tsi4)
;
insert into sales1 values(1999,01,01,1);
--null 插入到maxvalue表空间。
insert into sales1 values(null,null,null,0);
--ORA-14400: 插入的分区关键字未映射到任何分区
insert into sales1 values(2004,01,01,1);
commit;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/235507/viewspace-566752/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/235507/viewspace-566752/