最近用Oracle 11g的exp命令备份数据库,然后恢复,发现导出前表中还从没插入过数据的表并没有导出。以前用9i、10g的时候都没发现过类似问题,着实被坑了一把,google一查发现11g中有个新特性,当表无数据时,不分配segment以节省空间。为了使空表也能导出需要如下处理:
1) 用以下这句查找空表
select 'alter table '||table_name||' allocate extent;' from user_tables where segment_created='NO';
把查询结果导出,执行导出的语句
2) 然后再使用exp命令导出数据库即可
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.
这句话的意思是 DEFERRED_SEGMENT_CREATION 参数的作用是:创建表的时候延迟创建这个表相关的segment(包括lobs,indexes),直到第一次插入数据的时候才创建segment.补充说明:DEFERRED_SEGMENT_CREATION 参数从11.2.0.1引进,默认值为true;如果要使其恢复老版本功能,设置该参数为false.
show parameter DEFERRED_SEGMENT_CREATION;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/28588633/viewspace-1258695/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/28588633/viewspace-1258695/