今天在oracle11g 上用exp命令导出的时候遇到一个奇怪的现象,无数据的表exp总是导不出来,查询了一下发现这是oracle 11g的新特性,当表无数据时,不分配segment,以节省空间。而使用exp命令时,无Segment的表不会被导出。
解决办法:
select ‘alter table ‘||table_name||‘ allocate extent;‘ from user_tables where num_rows=0;
结果形如:
Alter table XXX allocate extent;
查询出所有的结果,在sqlplus里重新执行。
?
?
DEFERRED_SEGMENT_CREATION参数:
Property |
Description |
Parameter type |
Boolean |
Default value |
true |
Modifiable |
ALTER SESSION,?ALTER SYSTEM |
Range of values |
true | false |
Basic |
No |
?
DEFERRED_SEGMENT_CREATION?specifies the semantics of deferred segment creation. If set to?true, then segments for tables and their dependent objects (LOBs, indexes) will not be created until the first row is inserted into the table.
Before creating a set of tables, if it is known that a significant number of them will not be populated, then consider setting this parameter to?true. This saves disk space and minimizes install time.
从Oracle 11g release 2开始,添加了一个DEFERRED_SEGMENT_CREATION参数,默认值为true表示新创建表的时候分配extent,只有在插入数据的时候才开始分配extent。在常规环境,由于创建表的时候并不会立即分配extent,节约空间,减少创建时间,所以能提高效率。
可以使用如下命令禁用此feature:
alter system set deferred_segment_creation=false;
这只会影响以后创建的表,并不能影响之间创建的表。
?
Ref
http://dbaora.com/deferred-segment-creation-on-demand-oracle-database-11g-release-2-11-2/
http://blog.csdn.net/tianlesoftware/article/details/6603608
http://stackoverflow.com/questions/18924704/how-to-export-empty-tables-in-oracle
http://www.cnblogs.com/downmoon/archive/2012/12/03/2799864.html