ITPub博客

首页 > 数据库 > Oracle > Oracle学习三 创建表分区

Oracle学习三 创建表分区

原创 Oracle 作者:mckobe23 时间:2007-03-12 14:35:10 0 删除 编辑

在数据库性能需要保障的时候,我们可以使用Oracle进行分区操作.

一 表分区

1.范围分区 一般使用部门字段,地区字段,时间字段

SQL > CREATE TABLE USER

(user_id number(20) primary key,

user_name varchar2(100) not null,

regist_time varcahr(200) not null

)

partition by range(regist_time)

(

partition part_01 values less than(to_date('2003-01-01','yyyy-mm-dd') ) tablespace space_01,

partition part_02 values less than(to_date('2006-01-01','yyyy-mm-dd') ) tablespace space_02,

partition part_03 values less than(maxvalue) tablespace space_03

);

关键字:PARTITION BY RANGE(RANGE_COLUMN)

下面为按照注册日期为表分三个区,最后一个分区不指定日期值,均设定为MAXVALUE.

创建分区的同时为分区指定使用的表空间.

2.散列分区 一般使用编号字段

SQL > CREATE TABLE USER

(user_id number(20) primary key,

user_name varchar2(100) not null,

regist_time varcahr(200) not null

)

partition by hash(user_id)

(

partition part_01 tablespace space_01,

partition part_02 tablespace space_02,

partition part_03 tablespace space_03

)

[@more@]

DBA查看表分区

select * from dba_tab_partitions

USER查看表分区

select * from user_tab_partitions

DBA查看表分区类型

select * from dba_part_tables

USER查看表分区类型

select * from user_part_tables

查询分区表信息

select * from table partition(part_01)

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/9183234/viewspace-904094/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-06-12

  • 博文量
    40
  • 访问量
    587271