Oracle 11g 无法导出空表的解决方法
Oracle 11g 无法导出空表的解决办法
oracle 由10g升级为11g后,为节省表空间,当使用 exp 命令时是不会为空表分配区段,即表空间的,所以空表也就无法导出,因为系统默认deferred_segment_creation=true,此时会延迟创建段,在create table ddl 执行时实际不会在表空间生成segment; 解决办法如下:
1:先查询哪些表是空的
select table_name from user_tables where NUM_ROWS=0;
2:用select语句拼接修改表的语句,即拼接为alter table set 的语法格式
select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0
查询出的语句格式如下:
alter table A_JUNCTURE_CABINET_N allocate extent; alter table G_ACLINESEGMENT_LB2 allocate extent; alter table G_ACROSS_TYPE_LB allocate extent; alter table G_ACROSS_TYPE_PT allocate extent; alter table G_AIR_ACLINESEGMENT_LB2 allocate extent; alter table G_ARRESTER_LB allocate extent; alter table G_COMPENSATOR_LB allocate extent; alter table G_COMPENSATOR_PT allocate extent; alter table G_CURRENTTRANSFORMER_LB allocate extent; alter table G_CURRENTTRANSFORMER_PT allocate extent;
3:把查询出的语句全部重新在新窗口重新执行一次,然后再次执行 exp 命令即可