首页 > 技术文章 > oracle11g导出空表

czrwxw 2014-06-19 15:42 原文

ORACLE 11G在用EXP导出时,发现空表(没有数据或者没有用过的表)不能导出了。     查了一下资料,说是Oracle 11G中有个新特性,当表无数据时,不分配segment,以节省空间,所以这些表也没能导出来。用下面的SQL查询,发现不能导出的表, segment_created 字段值都是 'NO'。 Select * from user_tables where segment_created = 'NO';

在sqlplus中,执行如下命令:

   SQL>alter system set deferred_segment_creation=false;

该值设置后只对后面新增的表产生作用,对之前建立的空表不起作用。对已存在表的处理如下:

1、执行以下语句,批量生成修改语句,在执行生成后的修改语句:

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

Select 'alter table '||table_name||' allocate extent;' from user_tables where segment_created= 'NO';

 

拷贝生成的sql,进行执行

推荐阅读