oracle 表分区原理,oracle分区表原理学习

1.创建普通表

create table normal_shp(id number,day date,city_number number,note varchar2(100)) tablespace p;

插入10000条记录

insert into normal_shp(id,day,city_number,note) select rownum,to_date(to_char(sysdate-180,'J')+trunc(dbms_random.value(0,180)),'J'),ceil(dbms_random.value(1,7)),rpad('a',100,'a') from dual connect by rownum <=100000;

2.创建范围分区表

create table range_shp(id number,day date,city_number number,note varchar2(100))

partition by range(day)

(

partition p1 values less than (to_date('2019-02-01','YYYY-MM-DD')) tablespace p1,

partition p2 values less than (to_date('2019-03-01','YYYY-MM-DD')) tablespace p2,

partition p3 values less than (to_date('2019-04-01','YYYY-MM-DD')) tablespace p3,

partition p4 values less than (to_date('2019-05-01','YYYY-MM-DD'

你可能感兴趣的:(oracle,表分区原理)