Oracle ORA-14404和ORA-14407错误的解决方法

来源:互联网 发布:手机时间网络时间不对 编辑:程序博客网 时间:2024/05/29 09:20

1、ORA-14404错误的解决方法

ORA-14404错误信息、原因和解决措施如下表:

ORA-14404

partitioned table contains partitions in a different tablespace

Cause

An attempt was made to drop a tablespace which contains tables whose partitions are not completely contained in this tablespace

Action

find tables with partitions which span the tablespace being dropped and some other tablespace(s). Drop these tables or move partitions to a different tablespace


下面通过例子来说明解决ORA-14404的方法。

例1:当要删除表空间mytemp1时出现错误

SQL> drop tablespace mytemp1 including contents;

drop tablespace mytemp1 including contents

*

1行出现错误:

ORA-14404: 分区表包含不同表空间中的分区

意思是分区表的数据分布在不同表空间中的分区,解决方法是,找到这些跨越(span)不同表空间的表,将这些表删除或是将这些表备份到不同的表空间。

找到在不同的表空间的分区表语句是:

SQL> edit

已写入 file afiedt.buf

  1  SELECT x.table_name,x.partition_name,x.tablespace_name表空间1, y.tablespace_name表空间2

  2  FROM dba_tab_partitions x, dba_tab_partitionsy

  3* WHEREx.tablespace_name ='MYTEMP1' AND y.tablespace_name <> 'MYTEMP1' AND x.table_name=y.table_name

SQL> /

执行结果如下:


即找到名称为PART_BOOK的分区表的数据在表空间mytemp1、mytemp2和mytemp3上。详细的信息可使用下面的语句查询:

SQL> SELECT table_name,partition_name,tablespace_name FROMdba_tab_partitions WHERE tablespace_name in ('MYTEMP1', 'MYTEMP2', 'MYTEMP3');

结果为: 


要删除表空间mytemp1,将表PART_BOOK删除或将该表备份到其他的表空间。

SQL>DROP TABLE part_book;

表已删除。

SQL> DROP TABLESPAC mytemp1;

表空间已删除。

 

2、ORA-14407错误的解决方法

ORA-14407错误的信息、原因和解决措施如下:

ORA-14407

partitioned table contains subpartitions in a different tablespace

Cause

An attempt was made to drop a tablespace which contains tables whose subpartitions are not completely contained in this tablespace

Action

find tables with subpartitions which span the tablespace being dropped and some other tablespace(s). Drop these tables or move subpartitions to a different tablespace

下面通过例子来说明解决ORA-14407的方法。

例2.  当要删除表空间mytemp1时出现错误:

SQL> drop tablespace mytemp1 including contents;

drop tablespace mytemp1 including contents

*

1行出现错误:

ORA-14407: 分区的表包含在不同表空间中的子分区

出现该错误是因为当删除表空间时,同一分区(这里说的区实际上的段)的子分区分布在不同的表空间中。使用下面的语句可查询出

SELECT segments, segment_type,segment_subtype, tablespace_name

FROM dba_segments

WHERE segments in (SELECT segment_name

FROM dba_segments

WHERE tablespace_name='MYTEMP1')

子查询时查询出表空间MYTEMP1对应的哪些段。结果为:


从上面可以看出,分区表PART_BOOK4在不同的表空间MYTEMP1和MYTEMP2中,要删除表空间MYTEMP1,需要将表PART_BOOK4删除。

SQL> DROP TABLE system.part_book4;

表已删除。

SQL> DROP TABLESPACE mytemp1;

表空间已删除。

原创粉丝点击