ITPub博客

首页 > Linux操作系统 > Linux操作系统 > oracle10g--11gR2分区表汇总五

oracle10g--11gR2分区表汇总五

原创 Linux操作系统 作者:jack22220613 时间:2011-03-18 09:36:32 0 删除 编辑
3.2.7.3 (分区表diable keep index)—(非分区表disable keep index)—exchange--exchange

解释:

首先:分区表primary key disable的,非分区表primary key disable的;

其次:交换分区且包括 including indexes;

然后:再次交换分区包括 including indexes;

 

SQL> select INDEX_NAME,PARTITION_NAME,STATUS from User_Ind_Partitions where INDEX_name='IND_T_PAR_RANGE';

 

INDEX_NAME          PARTITION_NAME      STATUS                                                     

------------------ ------------------ ----------------  

IND_T_PAR_RANGE     P_T_PAR_RANGE_0    USABLE                                                                                   

IND_T_PAR_RANGE     P_T_PAR_RANGE_1    USABLE            

                                                                    

SQL> drop index ind_t_par_range;

 

索引已删除。

 

SQL> alter table t_no_par add constraint ind_t_no_par primary key(time,id) using index;

 

表已更改。

 

SQL> alter table t_par_range add constraint ind_t_par_range primary key(time,id) using index local;

 

表已更改。

 

SQL> select * from t_no_par;

 

未选定行

 

SQL> select * from t_par_range;

 

TIME                   ID    CITY_ID     VALUE1 VALUE2                         

-------------- ---------- ---------- ---------- --------------------            

01-3 -11              1         10          1 a                              

01-4 -11              2         20          2 b                              

 

SQL> select constraint_name,constraint_type,status,validated from User_Constraints where constraint_name in ('IND_T_NO_PAR','IND_T_PAR_RANGE');

 

CONSTRAINT_NAME                C STATUS   VALIDATED                            

------------------------------ - -------- -------------                        

IND_T_PAR_RANGE                P ENABLED  VALIDATED                            

IND_T_NO_PAR                   P ENABLED   VALIDATED                                                                               

 

SQL> SELECT index_name,index_type,status FROM USER_INDEXES WHERE index_NAME in ('IND_T_NO_PAR');

 

INDEX_NAME          INDEX_TYPE             STATUS                                              

------------------------------------------------------------                   

IND_T_NO_PAR         NORMAL                 VALID                   

                                                                               

SQL> select INDEX_NAME,PARTITION_NAME,STATUS from User_Ind_Partitions where INDEX_name='IND_T_PAR_RANGE';

 

INDEX_NAME          PARTITION_NAME      STATUS                                                      

------------------ ------------------ ----------------  

IND_T_PAR_RANGE     P_T_PAR_RANGE_0    USABLE                                                                                   

IND_T_PAR_RANGE     P_T_PAR_RANGE_1    USABLE            

                                                                            

 

SQL>

SQL> alter table t_no_par disable constraint ind_t_no_par keep index;

 

表已更改。

 

SQL> alter table t_par_range disable constraint ind_t_par_range keep index;

 

表已更改。

 

SQL>

SQL> select INDEX_NAME,PARTITION_NAME,STATUS from User_Ind_Partitions where INDEX_name='IND_T_PAR_RANGE';

 

INDEX_NAME          PARTITION_NAME      STATUS                                                     

------------------ ------------------ ----------------  

IND_T_PAR_RANGE     P_T_PAR_RANGE_0    USABLE                                                                                   

IND_T_PAR_RANGE     P_T_PAR_RANGE_1    USABLE            

                                                                               

 

SQL> select constraint_name,constraint_type,status,validated from User_Constraints where constraint_name in ('IND_T_NO_PAR','IND_T_PAR_RANGE');

 

CONSTRAINT_NAME                C STATUS   VALIDATED                            

------------------------------ - -------- -------------                        

IND_T_PAR_RANGE                P DISABLED  NOT VALIDATED                            

IND_T_NO_PAR                   P DISABLED  NOT VALIDATED                                                                               

 

                                                                               

SQL> SELECT index_name,index_type,status FROM USER_INDEXES WHERE index_NAME in ('IND_T_NO_PAR');

 

INDEX_NAME          INDEX_TYPE             STATUS                                              

------------------------------------------------------------                   

IND_T_NO_PAR         NORMAL                 VALID                    

                                                                               

SQL> alter table t_par_range exchange partition p_t_par_range_0 with table t_no_par including indexes;

 

表已更改。

 

SQL>

SQL> select * from t_no_par;

 

TIME                   ID    CITY_ID     VALUE1 VALUE2                         

-------------- ---------- ---------- ---------- --------------------           

01-3 -11              1         10          1 a                              

 

SQL> select * from t_par_range;

 

TIME                   ID    CITY_ID     VALUE1 VALUE2                         

-------------- ---------- ---------- ---------- --------------------           

01-4 -11              2         20          2 b                               

 

SQL> select constraint_name,constraint_type,status,validated from User_Constraints where constraint_name in ('IND_T_NO_PAR','IND_T_PAR_RANGE');

 

CONSTRAINT_NAME                C STATUS   VALIDATED                            

------------------------------ - -------- -------------                        

IND_T_PAR_RANGE                P DISABLED  NOT VALIDATED                            

IND_T_NO_PAR                   P DISABLED  NOT VALIDATED                                                                                

                                                                               

 

SQL> SELECT index_name,index_type,status FROM USER_INDEXES WHERE index_NAME in ('IND_T_NO_PAR');

 

INDEX_NAME          INDEX_TYPE             STATUS                                              

------------------------------------------------------------                   

IND_T_NO_PAR         NORMAL                 VALID                   

                                                                               

 

SQL> select INDEX_NAME,PARTITION_NAME,STATUS from User_Ind_Partitions where INDEX_name='IND_T_PAR_RANGE';

 

INDEX_NAME          PARTITION_NAME      STATUS                                                      

------------------ ------------------ ----------------  

IND_T_PAR_RANGE     P_T_PAR_RANGE_0    USABLE                                                                                   

IND_T_PAR_RANGE     P_T_PAR_RANGE_1    USABLE            

                                                                               

 

SQL> alter table t_par_range exchange partition p_t_par_range_0 with table t_no_par including indexes;

 

表已更改。

 

SQL> select * from t_no_par;

 

未选定行

 

SQL> select * from t_par_range;

 

TIME                   ID    CITY_ID     VALUE1 VALUE2                         

-------------- ---------- ---------- ---------- --------------------           

01-3 -11              1         10          1 a                               

01-4 -11              2         20          2 b                              

 

SQL> select constraint_name,constraint_type,status,validated from User_Constraints where constraint_name in ('IND_T_NO_PAR','IND_T_PAR_RANGE');

 

CONSTRAINT_NAME                C STATUS   VALIDATED                            

------------------------------ - -------- -------------                        

IND_T_PAR_RANGE                P DISABLED  NOT VALIDATED                            

IND_T_NO_PAR                   P DISABLED  NOT VALIDATED                                                                               

                                                                               

 

SQL> SELECT index_name,index_type,status FROM USER_INDEXES WHERE index_NAME in ('IND_T_NO_PAR');

 

INDEX_NAME          INDEX_TYPE             STATUS                                              

------------------------------------------------------------                   

IND_T_NO_PAR         NORMAL                 VALID                   

                                                                               

 

SQL> select INDEX_NAME,PARTITION_NAME,STATUS from User_Ind_Partitions where INDEX_name='IND_T_PAR_RANGE';

 

INDEX_NAME          PARTITION_NAME      STATUS                                                     

------------------ ------------------ ----------------  

IND_T_PAR_RANGE     P_T_PAR_RANGE_0    USABLE                                                                                    

IND_T_PAR_RANGE     P_T_PAR_RANGE_1    USABLE           

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10037372/viewspace-689825/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2009-05-13

  • 博文量
    94
  • 访问量
    350382