在做數據遷移是,開發用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