Oracle
分區的具體優點
列表分區表create table BS_CDR_WLAN_LOC_
(
DAY_NUMBER NUMBER(
……
TPREMARK VARCHAR
)
partition by list (DAY_NUMBER)
(
partition P_BS_CDR_OTH_LOC_
partition P_BS_CDR_OTH_LOC_
……
partition P_BS_CDR_OTH_LOC_
)
按范圍分區
注
SQL> create table niegc_part
Hash分區(散列分區)
散列分區通過指定分區編號來均勻分布數據的一種分區類型
如將part_id的數據根據自身的情況散列地存放在指定的三個表空間中
create table niegc_part
(
part_id integer primary key
part_date date
part_dec varchar
)
partition by hash(part_id)
(
partition part_
partition part_
)
復合分區
create table tab_students
(c_id number
c_name varchar
c_age number
c_birthday date
c_nation varchar
)
partition by range(c_id)
subpartition by list(c_nation)
SUBPARTITION TEMPLATE
(SUBPARTITION part_hanzu VALUES (
SUBPARTITION part_others VALUES (DEFAULT)
)
(
PARTITION part_id
PARTITION part_id
PARTITION part_id
)
索引分區
注意
全局索引建立時global子句允許指定索引的范圍值
create index idx_part_id on niegc_part(part_dec)
global partition by range(part_dec)
(
partition idx_
partition idx_
)
局部索引分區的建立
(注
create index idx_part_id on niegc_part(part_dec)
local
(
partition idx_
partition idx_
)
分區維護
(
alter table tablename add partition new_partitionname values less than(maxvalue)
(
alter table tablename merge partitions partitionname
alter table tablename split partition partitionname
partition newpartition
注意
(
alter table niegc_part drop partition partitionname
(
alter table table_name rename Partition partition_name to partition_name
(
alter table table_name move partition_name
tablespace tablespace_name nologging
(
select count(*) from table_name partition (partition_name)
(
insert into table_name select * from table_name partition (partition_name)
(
userid=USER/PWD
buffer=
tables=table_name
file=E
log=E
(
alter table table_name set unused column column_name
(
alter table table_name add column_name number(
六
分區表是將大表的數據分成稱為分區的許多小的子集
From:http://tw.wingwit.com/Article/program/Oracle/201311/18966.html