The solution for Oracle 11g exporting empty tables and few tables

There is a new feature in ORACLE 11G. When the table has no data, segments are not allocated to save space.

Solution:

  1) Insert a line, and then rollback will generate a segment

  This method is to insert data into an empty table, and then delete it to generate a segment. Empty tables can be exported when exporting.

  2) Set the deferred_segment_creation parameter

copy code
SQL> show parameter deferred_segment_creation 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
deferred_segment_creation            boolean     TRUE 
SQL> alter system set deferred_segment_creation=false; 
System has changed.
SQL> show parameter deferred_segment_creation 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------ 
deferred_segment_creation            boolean     FALSE
copy code

  It should be noted that: after this value is set, it does not affect the previously imported empty table, and still cannot be exported, but only affects the newly added table. To export the previous empty table, only the first method can be used.

       3) Batch process empty tables

       First use the following sql statement to query all empty tables under the current user

select table_name from user_tables where NUM_ROWS=0;

  Then execute the query with the following SQL statement

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

  Suppose we have empty tables TBL_1, TBL_2, TBL_3, TBL_4 here, the query results are as follows:

alter table TBL_1 allocate extent;
alter table TBL_2 allocate extent;
alter table TBL_3 allocate extent;
alter table TBL_4 allocate extent;

  Finally, we can execute the above SQL statement.

 

See information:

http://ligaosong.iteye.com/blog/1317886

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326595422&siteId=291194637