oracle分区表

分区表的实现:范围分区表。

实现步骤:1:创建表空间,按照时间分区的表空间,一个月份的历史数据为一个表空间。

2:创建新用户?不需要创建新的用户。

把需要转换的历史表全部删除,因为oracle不支持在线转换功能

直接创建刚才删除的表,建表语句后面加入:


create table SWITCH_UDPTABLE

(

ID VARCHAR2(60) not null,

UDPLOCALADDRESS VARCHAR2(60),

UDPLOCALPORT VARCHAR2(60),

COLLECT_TIME DATE,

RESOURCEID VARCHAR2(60),

IP_ADDRESS VARCHAR2(60)

)

partition by range(COLLECT_TIME)

(

partition p1310 values less than(to_date('2013-11-01','yyyy-mm-dd')) tablespace itsm_sac_2013_10,

partition p1311 values less than(to_date('2013-12-01','yyyy-mm-dd')) tablespace itsm_sac_2013_11,

partition p1312 values less than(to_date('2014-01-01','yyyy-mm-dd')) tablespace itsm_sac_2013_12,

partition p1401 values less than(to_date('2014-02-01','yyyy-mm-dd')) tablespace itsm_sac_2014_01,

partition p1402 values less than(to_date('2014-03-01','yyyy-mm-dd')) tablespace itsm_sac_2014_02,

partition p1403 values less than(to_date('2014-04-01','yyyy-mm-dd')) tablespace itsm_sac_2014_03,

partition p1404 values less than(to_date('2014-05-01','yyyy-mm-dd')) tablespace itsm_sac_2014_04,

partition p1405 values less than(to_date('2014-06-01','yyyy-mm-dd')) tablespace itsm_sac_2014_05,

partition p1406 values less than(to_date('2014-07-01','yyyy-mm-dd')) tablespace itsm_sac_2014_06,

partition p1407 values less than(to_date('2014-08-01','yyyy-mm-dd')) tablespace itsm_sac_2014_07,

partition p1408 values less than(to_date('2014-09-01','yyyy-mm-dd')) tablespace itsm_sac_2014_08,

partition p1409 values less than(to_date('2014-10-01','yyyy-mm-dd')) tablespace itsm_sac_2014_09,

partition p1410 values less than(to_date('2014-11-01','yyyy-mm-dd')) tablespace itsm_sac_2014_10,

partition p1411 values less than(to_date('2014-12-01','yyyy-mm-dd')) tablespace itsm_sac_2014_11

);




3:疑问:1:oracle创建表空间不需要给用户赋予权限

用户就可以直接往表空间的物理数据文件上写?

2:新的建表语句,表结构有改动吗?


oracle分区表优点

1:more high avaliability

节点多,不怕挂

2:维护方便

3:均衡IO

4:改善查询性能


oracle分区表分类:1:范围分区

2:hash分区

3:列表分区表

4:组合分区表



知难行易

so many troubled thing in my head ,and troubled any longer


你可能感兴趣的:(partition,分区表)