ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 解决ora-02429:无法用于删除强制唯一/主键的索引

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

原创 Linux操作系统 作者:gnet飞 时间:2012-11-02 09:19:16 0 删除 编辑
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE1.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博客 ” ,链接:https://blog.itpub.net/26276376/viewspace-748152/ ,如需转载,请注明出处,否则将追究法律责任。

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

注册时间:2011-10-08

  • 博文量
    21
  • 访问量
    107786