oracle10g索引不生效,oracle 10g分区表索引失效测试
一、測試環(huán)境
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE10.2.0.3.0Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.3.0 - Productio
NLSRTL Version 10.2.0.3.0 - Production
二、測試步驟
1.全局索引測試步驟
create table tab (num number,name char(2))
partition by range(num)
(partition a values less than(10),
partition b values less than(20),
partition c values less than(30));
insert into tab values(1,'a');
insert into tab values(11,'a');
insert into tab values(21,'a');
commit;
create index g_idx on tab (num);
----------------------- add測試----------------------------
alter table tab add partition d values less than (40);
alter table tab add partition e values less than (maxvalue);
----------------------- drop測試---------------------------
insert into tab values(31,'a');
commit;
alter table tab drop partition e;
alter table tab drop partition d;
alter index g_idx rebuild;
----------------------- truncate測試----------------------------
alter table tab add partition d values less than (40);
alter table tab add partition e values less than (maxvalue);
insert into tab values(31,'a');
commit;
alter table tab truncate partition e;
alter table tab truncate partition d;
alter index g_idx rebuild;
----------------------- split測試---------------------------
alter table tab add partition d values less than (maxvalue);
alter table tab split partition d at (40) into (partition d,partition e);
insert into tab values(45,'a');
commit;
alter table tab split partition e at (50) into (partition e,partition f);
insert into tab values(65,'a');
commit;
alter table tab split partition f at (60) into (partition f,partition g);
insert into tab values(75,'a');
commit;
alter table tab split partition g at (70) into (partition g,partition h);
alter index g_idx rebuild;
-----------------------查詢語句---------------------------
select index_name,status from dba_indexes where wner='TEST'
2.本地索引測試步驟
create table tab (num number,name char(2))
partition by range(num)
(partition a values less than(10),
partition b values less than(20),
partition c values less than(30));
insert into tab values(1,'a');
insert into tab values(11,'a');
insert into tab values(21,'a');
commit;
create index l_idx on tab (num) local;
----------------------- add測試----------------------------
alter table tab add partition d values less than (40);
alter table tab add partition e values less than (maxvalue);
----------------------- drop測試---------------------------
insert into tab values(31,'a');
commit;
alter table tab drop partition e;
alter table tab drop partition d;
----------------------- truncate測試----------------------------
alter table tab add partition d values less than (40);
alter table tab add partition e values less than (maxvalue);
insert into tab values(31,'a');
commit;
alter table tab truncate partition e;
alter table tab truncate partition d;
----------------------- split測試---------------------------
alter table tab add partition d values less than (maxvalue);
alter table tab split partition d at (40) into (partition d,partition e);
insert into tab values(45,'a');
commit;
alter table tab split partition e at (50) into (partition e,partition f);
insert into tab values(65,'a');
commit;
alter table tab split partition f at (60) into (partition f,partition g);
insert into tab values(75,'a');
commit;
alter table tab split partition g at (70) into (partition g,partition h);
alter index l_idx rebuild partition h;
alter index l_idx rebuild partition g;
-----------------------查詢語句---------------------------
select index_name,partition_name,status from dba_ind_partitions where index_owner='TEST'
三、測試結(jié)論
add partition
drop partition
truncate partition
分區(qū)表中無數(shù)據(jù)
分區(qū)表中有數(shù)據(jù)
分區(qū)表中無數(shù)據(jù)
分區(qū)表中有數(shù)據(jù)
global index
VALID
VALID
UNUSABLE
VALID
UNUSABLE
local index
USABLE
USABLE
USABLE
USABLE
USABLE
split partition( split partition a into a and b )
a,b分區(qū)均無數(shù)據(jù)
a分區(qū)有數(shù)據(jù)
b分區(qū)無數(shù)據(jù)
a分區(qū)無數(shù)據(jù)
b分區(qū)有數(shù)據(jù)
a,b分區(qū)均有數(shù)據(jù)
global index
VALID
VALID
VALID
UNUSABLE
local index
USABLE
USABLE
USABLE
UNUSABLE
所查數(shù)據(jù)字典:
全局索引:dba_indexes
本地索引:dba_ind_partitions
rebuild index語句:
全局索引:alter index g_idx rebuild;
本地索引:alter index l_idx rebuild partition h;
總結(jié)
以上是生活随笔為你收集整理的oracle10g索引不生效,oracle 10g分区表索引失效测试的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: “客心贫易动”下一句是什么
- 下一篇: 地坪漆多少钱一平方啊?