Oracle 11gR2 新特性:段区延迟创建 (EXP-00003)

来源:互联网 发布:淘宝专卖店 编辑:程序博客网 时间:2024/06/10 00:21

在做数据迁移是,开发用exp导出数据。但发现报错:“EXP-00003 未找到段的存储定义。”这样造成导出备份的数据不完整。

查资料发现Oracle 11g R2 增加了一个新参数: deferred_segment_creation,
含义是段延迟创建,默认为true。即新表在创建,但是未插入数据时,数据库不会立即为此表分配segment。当使用exp命令进行导出数据时,未分配空间的表是不会被导出的。

1.修改参数 (需要重启数据库)

alter system set deferred_segment_creation=false;

2.修改后之对 之后创建的表有效。之前的表还是没有分配,所以我们要补齐。
手动为空表分配空间。

set heading off;set echo off;set feedback off;set termout on;spool '/data/sql_allocate.sql';select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 or num_rows is null;select 'alter table '||table_name||' modify partition '||partition_name||' allocate extent;' from user_tab_partitions;spool off
0 0