解决ora-02429:无法用于删除强制唯一/主键的索引

Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE 1.1    描述

操作系统:REDHAT 5.5

数据库版本:11.2.0.3+asm+rac

问题描述:使用drop index historysettlement.PK_TEST 删除一索引时,出现ora-02429: 无法用于删除强制唯一/主键的索引错误.

SQL> drop index historysettlement.pk_test;

drop index historysettlement.pk_test

                             *

ERROR at line 1:

ORA-02429: cannot drop index used for enforcement of unique/primary key

 

 

SQL>

1.1.1        检查索引信息

SQL> select t.table_name, t.index_type,t.uniqueness,t.status from dba_indexes t

  2  where t.index_name='PK_TEST'

  3  and t.owner='HISTORYSETTLEMENT';

 

TABLE_NAME                     INDEX_TYPE                  UNIQUENES STATUS

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

TEST                           NORMAL                      UNIQUE    VALID

 

SQL>

1.1.2        原因

// *Cause: user attempted to drop an index that is being used as the

//         enforcement mechanism for unique or primary key.

用户在使用drop命令删除主键或者唯一键索引时,会出现此错误.

1.1.3        解决方法

使用alter table tablename drop constraint cons_name 命令来代替drop index 命令.

SQL> alter table historysettlement.test drop constraint pk_test;

 

Table altered.

 

SQL>

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

转载于:http://blog.itpub.net/26276376/viewspace-748152/

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值