Chinaunix首页 | 论坛 | 博客
  • 博客访问: 509680
  • 博文数量: 101
  • 博客积分: 1635
  • 博客等级: 上尉
  • 技术积分: 1282
  • 用 户 组: 普通用户
  • 注册时间: 2012-07-05 01:51
文章分类

全部博文(101)

文章存档

2019年(2)

2018年(16)

2013年(14)

2012年(69)

我的朋友

分类: Oracle

2012-11-14 13:15:31

創建hash分區:
SQL> create table t_partition_hash (id number,name varchar2(50))
  2  partition by hash (id) (
  3  partition  t_hash_p1 tablespace tbspart01,
  4  partition  t_hash_p2 tablespace tbspart02,
  5  partition  t_hash_p3 tablespace tbspart03);
Table created
要實現同樣的效果可以:
SQL> create table t_partition_hash2 (id number,name varchar2(50))
  2  partition by hash(id) partitions 3 store in (tbspart01,tbspart02,tbspart03);
Table created
這就是說 指定分區數量和可供使用的表空間,分區數并不一定要等於表空間數。
要查詢表的分區信息,仍然通過user_part_tables,user_tab_partitions 兩個數據字典。
global 索引hash分區
hash 分區索引的字句與hash分區表的創建子句完全相同,例如:
SQL> create index idx_part_hash_id on t_partition_hash(id)
  2  global partition by hash(id)
  3  partitions 3 store in(tbspart01,tbspart02,tbspart03);
 
create index idx_part_hash_id on t_partition_hash(id)
global partition by hash(id)
partitions 3 store in(tbspart01,tbspart02,tbspart03)
 
ORA-14005: missing RANGE keyword
可能是9i不支持global index
創建local索引:
create index idx_part_hash_id2 on t_partition_hash(id) local;
create index idx_part_hash_id on t_partition_hash(id)
global partition by hash(id)
partitions 3 store in(tbspart01,tbspart02,tbspart03);
對於global 索引,在10g中只能支持range和hash分區
local其形式完全依賴與索引所在表的形式
默認的是global索引
阅读(3247) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~