創建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索引