ora-02429排查

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


由于将主键约束建立到所要删除的表空间中,所有导致删除这个表空间报如上错误


解决方法:

ql>select segment_name,partition_name,tablespace_name from dba_extents where tablespace_name=upper('表空间名'); //查得主键约束

sql>select 'alter table '||owner||'.'||table_name||' drop constraint '||constraint_name||' ;'
from dba_constraints
where constraint_type in ('U', 'P')
and (index_owner, index_name) in
(select owner, segment_name
from dba_segments
where tablespace_name = '表空间名'); //生成删除主键约束的语句


SQL> select 'alter table '||owner||'.'||table_name||' drop constraint '||constraint_name||' ;'
from dba_constraints
where constraint_type in ('U', 'P')
and (index_owner, index_name) in
(select owner, segment_name
from dba_segments
where tablespace_name = '  2    3    4    5    6    7  aaa');

'ALTERTABLE'||OWNER||'.'||TABLE_NAME||'DROPCONSTRAINT'||CONSTRAINT_NAME||';'
--------------------------------------------------------------------------------
alter table aaa.bbb drop constraint PK_ST_BAIDU_REPORT ;   //生成的删除语句

SQL> alter table aaa.bbb drop constraint PK_ST_BAIDU_REPORT ; //手动执行

Table altered.


然后删除表空间

SQL> drop tablespace SEMTOOLS;
drop tablespace SEMTOOLS
*
ERROR at line 1:
ORA-01549: tablespace not empty, use INCLUDING CONTENTS option


SQL> drop tablespace SEMTOOLS INCLUDING CONTENTS;

Tablespace dropped. //删除OK



END

本文属笔者原创,脚本引自“http://blog.csdn.net/yudehui/article/details/8098936”

作者:john

转载请注明出处

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值