hankyoon

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语句没用的条件下,不可乱删哦).

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

分类:

技术点:

相关文章:

  • 2021-05-04
  • 2021-05-26
  • 2021-09-08
  • 2018-06-02
  • 2021-07-11
  • 2019-03-29
  • 2021-12-20
  • 2021-09-08
猜你喜欢
  • 2021-05-24
  • 2021-11-06
  • 2021-10-13
  • 2021-04-06
  • 2021-08-12
  • 2021-05-10
  • 2021-07-05
相关资源
相似解决方案