oracle database export empty table problem

There is a new feature in 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

 

  The default value of this parameter is TRUE. When it is changed to FALSE, segments are allocated regardless of whether it is an empty table or a non-empty table.

  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.

  After a long time, I finally found this method.

  

 Query all empty tables under the current user (a user preferably corresponds to a default tablespace). The command is as follows:

   SQL>select table_name from user_tables where NUM_ROWS=0; 

   According to the above query, the command statement for allocating space for an empty table can be constructed as follows:

   SQL>Select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 or num_rows is null (note: many tutorials do not have this, there may be a bit empty here) 

   The above code can generate batches of SQL statements for modifying table extents (as many as there are empty tables), we only need to execute all the generated SQL codes to assign segments to each existing table. OK.

Guess you like

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