ORA-39901 EXPDP分区报错/分区表删除不完全

[oracle@localhost zgy]$ expdp orders/orders directory=DUMPDIR DUMPFILE=test_exp.dmp TRANSPORT_TABLESPACES= "(TEST30000,IDX_TEST30000)" LOGFILE=test_exp.log
Export: Release 11.2.0.1.0 - Production on Fri Nov 27 18:00:20 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "ORDERS"."SYS_EXPORT_TRANSPORTABLE_01": orders/******** directory=DUMPDIR DUMPFILE=test_exp.dmp TRANSPORT_TABLESPACES= (TEST30000,IDX_TEST30000) LOGFILE=test_exp.log
ORA-39123: Data Pump transportable tablespace job aborted
ORA-39187: The transportable set is not self-contained, violation list is

ORA-39901: Partitioned table ORDERS.BIN$JX3n8VzplF7gUAB/AQA/ow==$0 is partially contained in the transportable set.

查询发现:
select distinct table_name from user_tab_partitions;

4 BIN$JN2deIa0FDTgUAB/AQBqFg==$0
9 BIN$JYRUHXHYtu7gUAB/AQAyww==$0
20 BIN$JYRX86DYa1DgUAB/AQAyxQ==$0
分析解决:
当一个分区表被DROP后,查询user_tab_partitions视图发现出现上面不规则的分区表表名。其实DROP后不是将表直接删除的,而是放在回收站了,查询user_recyclebin可以发现,这样,回收站的表信息是可以被恢复或彻底删除的。
flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop;
上面的语句是将回收站里的表恢复为原表名称
flashback table <user_recyclebin.object_name or user_recyclebin.original_name> to before drop rename to <new_table_name>;
将回收站里的表恢复为指定的新表名称,表中数据不会丢失。
若要彻底删除表,则使用语句:drop table <table_name> purge;这样drop后的表就不被放入回收站
如果是清除回收站中指定的表,可以使用语句purge table <table_name>;
如果是清除当前用户回收站所有的表,可以使用语句purge recyclebin;
如果是清除所有用户的回收站:purge dba_recyclebin;
到此,按上面的方法清除回收站的数据后,再查询user_tab_partitions视图,发现不规则表名已经没有了
truncate操作后不释放空间的解决办法
Truncate不支持回滚,并且不能truncate一个带有外键的表,如果要删除首先要取消外键,然后再删除。
truncate table 后,有可能表空间仍没有释放,可以使用如下语句:
alter table 表名称 deallocate UNUSED KEEP 0;
注意如果不加KEEP 0的话,表空间是不会释放的。
例如:
alter table tablename deallocate UNUSED KEEP 0;
或者:
TRUNCATE TABLE tablename DROP STORAGE才能释放表空间。
例如: truncate table tablename DROP STORAGE;

原文地址:https://www.cnblogs.com/ritchy/p/10898681.html