oracle10g--11gR2分区表汇总六

3.2.7.4 (分区表diable)—(非分区表disable)—exchange--exchange

解释:

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

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

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

 

SQL>

SQL>

SQL> alter table t_no_par disable constraint ind_t_no_par ;

 

表已更改。

 

SQL>

SQL> alter table t_par_range disable constraint ind_t_par_range ;

 

表已更改。

 

SQL>

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      CONSTRAINT STATUS     VALIDATED                           

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

IND_T_NO_PAR         P          DISABLED   NOT VALIDATED                       

IND_T_PAR_RANGE      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_no_par enable constraint ind_t_no_par;

 

表已更改。

 

SQL> alter table t_par_range enable constraint ind_t_par_range;

 

表已更改。

 

SQL> alter table t_no_par disable constraint ind_t_no_par;

 

表已更改。

 

SQL> alter table t_par_range disable constraint ind_t_par_range;

 

表已更改。

 

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      CONSTRAINT STATUS     VALIDATED                           

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

IND_T_NO_PAR         P          DISABLED   NOT VALIDATED                       

IND_T_PAR_RANGE      P          DISABLED   NOT VALIDATED                       

 

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

 

未选定行

 

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

 

未选定行

 

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

 

表已更改。

 

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

 

表已更改。

 

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      CONSTRAINT STATUS     VALIDATED                           

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

IND_T_NO_PAR         P          DISABLED   NOT VALIDATED                       

IND_T_PAR_RANGE      P          DISABLED   NOT VALIDATED                       

 

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                              

 

3.3 分区表与分区表的交换   

 不一定支持;

 

试验:

3.3.1 range分区表和list分区表(不支持)

SQL>

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> create table t_par_list (time date,

  2  id number,

  3  city_id number,

  4  value1 number,

  5  value2 varchar2(10)

  6  ) partition by list(city_id)

  7   ( partition p_t_par_list_0 values(10) ,

  8   partition p_t_par_list_1 values(20)

  9   )

 10  ;

 

表已创建。

 

SQL>

SQL> select * from t_par_list;

 

未选定行

 

 

SQL> alter table t_par_range exchange partition p_t_par_range_0 with table t_par_list;

alter table t_par_range exchange partition p_t_par_range_0 with table t_par_list

                                                                      *

1 行出现错误:

ORA-14095: ALTER TABLE EXCHANGE 要求非分区, 非聚簇的表

 

 

SQL> alter table t_par_range exchange partition p_t_par_range_0 with table t_par_list with validation;

alter table t_par_range exchange partition p_t_par_range_0 with table t_par_list with validation

                                                                      *

1 行出现错误:

ORA-14095: ALTER TABLE EXCHANGE 要求非分区, 非聚簇的表

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

转载于:http://blog.itpub.net/10037372/viewspace-689827/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值