Oracle分区索引--本地索引和全局索引比较(二)

2014-11-24 18:44:07 · 作者: · 浏览: 1
USABLE


SQL> create index i_id_global on test(data) global
2 partition by range(id)
3 ( partition p1 values less than (2000) tablespace p1,
4 partition p2 values less than (maxvalue) tablespace p2
5 );


create index i_id_global on test(data) global
partition by range(id)
( partition p1 values less than (2000) tablespace p1,
partition p2 values less than (maxvalue) tablespace p2
)


ORA-14038: GLOBAL 分区索引必须加上前缀


SQL> create bitmap index i_id_global on test(id) global
2 partition by range(id)
3 ( partition p1 values less than (2000) tablespace p1,
4 partition p2 values less than (maxvalue) tablespace p2
5 );


create bitmap index i_id_global on test(id) global
partition by range(id)
( partition p1 values less than (2000) tablespace p1,
partition p2 values less than (maxvalue) tablespace p2
)


ORA-25113: GLOBAL 可能无法与位图索引一起使用


三、分区索引不能够将其作为整体重建,必须对每个分区重建



SQL> alter index i_id_global rebuild online nologging;


alter index i_id_global rebuild online nologging


ORA-14086: 不能将分区索引作为整体重建


这个时候可以查询dba_ind_partitions,或者user_ind_partitions,找到partition_name,然后对每个分区重建


SQL> select index_name,partition_name from user_ind_partitions where index_name='I_ID_GLOBAL';


INDEX_NAME PARTITION_NAME
------------------------------ ------------------------------
I_ID_GLOBAL P1
I_ID_GLOBAL P2


SQL> alter index i_id_global rebuild partition p1 online nologging;


Index altered


SQL> alter index i_id_global rebuild partition p2 online nologging;


Index altered