ORA-14404

OS:

Oracle Linux Server release 5.7

 

DB:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 - Production
NLSRTL Version 11.2.0.3.0 - Production

 

在测试环境中删除表空间释放磁盘空间时报错,如下:

SQL> drop tablespace TBS_MYPAYMENT including contents and datafiles;
drop tablespace TBS_MYPAYMENT including contents and datafiles
*
ERROR at line 1:
ORA-14404: partitioned table contains partitions in a different tablespace

 

解决方法:

select 'alter table '||owner||'.'||segment_name||' drop partition '||partition_name||' ;'
from dba_segments
where segment_name in (select distinct segment_name
from dba_segments
where tablespace_name = 'TBS_MYPAYMENT'
and segment_type like '%PART%')
and tablespace_name <> 'TBS_MYPAYMENT';

 

得出:

alter table CP.IDX_CP_HANDLE_BATCH_NO drop partition SYS_P200 ;
alter table CP.IDX_CP_HANDLE_REQUEST_ID drop partition SYS_P200 ;
alter table CP.IDX_CP_PAYMENT_REQUEST_ID drop partition SYS_P201 ;
alter table CP.IDX_CP_PAYMENT_TRAN_NO drop partition SYS_P201 ;
alter table CP.IDX_CP_REQUEST_ID drop partition SYS_P199 ;
alter table CP.IDX_CP_REQUEST_TRAN_NO drop partition SYS_P199 ;
alter table CP.TBL_CP_HANDLE drop partition SYS_P200 ;
alter table CP.TBL_CP_PAYMENT drop partition SYS_P201 ;
alter table CP.TBL_CP_REQUEST drop partition SYS_P199 ;

 

执行上面得出的DDL语句即可删除表空间(切记:在上面的DDL语句没用的条件下,不可乱删哦).

无法删除的原因是因为分区表不在一个表空间下.

posted @ 2016-02-01 09:29  __Yoon  阅读(407)  评论(0编辑  收藏  举报