日期:2014-05-16  浏览次数:20526 次

oracle exp/imp 空表不能导出的问题

类似BIN$dJ5h8mAhLr/gQAB/AQB0oA==$0 TABLE这样的表发现有很多,本来200个表的,select  count(*) from tab 都上千了。从网上找资料发现时因为开启了flash功能。



使用命令:

drop table role;
commit;

可以删除role表,但是会产生一个类似:
BIN$dJ4hg1pva6/gQAB/AQByAw==$0 TABLE
的表。

如果这个表还存在,可以使用命令:

flashback table “BIN$dJ4hg1pva6/gQAB/AQByAw==$0” to before drop;
commit;

来恢复至删除前。

彻底删除一个表

drop table role(表名) purge;
commit;

清空所有flash中缓存的表:

purge recyclebin;
commit;

如果想清楚flash中指定的表,可以使用命令:

purge table role(表名);
commit;


11G中有个新特性:deferred_segment_creation 当表无数据时,不分配segment,以节省空间

修改deferred_segment_creation 属性:
show parameter deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean TRUE
SQL> alter system set deferred_segment_creation=false;

系统已更改。

SQL> show parameter deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
deferred_segment_creation boolean FALSE


但是如果你没有权限修改呢?


select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0


查询到的结果就是你要执行的命令。执行完之后就可以复制空表了。