Oracle 11G with EXP import, export, when, if empty table to solve the problems encountered in the import and export

 

 

 

 

11G there are new features, when the table is no data segment is not allocated, to save space

  Solution:

  1, insert a row, then a rollback segment generated.

  This method is inserted in the null data in the table, and then delete is generated segment. You can export the empty table export.

  2, the parameter setting deferred_segment_creation

 

show parameter deferred_segment_creation 

NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
deferred_segment_creation            boolean     TRUE 
SQL> alter system set deferred_segment_creation=false; 

系统已更改。 

SQL> show parameter deferred_segment_creation 

NAME                                 TYPE        VALUE 
------------------------------------ ----------- ------------------------------ 
deferred_segment_creation            boolean     FALSE

 

 

 

  The default value of the parameter is TRUE, the FALSE when changed, whether it is empty or non-empty list table, are assigned segment.

  Note that: When the value is set to an empty table does not have an effect on previously imported, still can not export, can only have an effect on the back of the new table. To export before an empty table, only the first method.

I engage in a long time, finally found the method.

First of all inquiries about the empty table in the current user

select table_name from user_tables where NUM_ROWS=0;

With the following phrase to find an empty table

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

The export query results, the export statement

'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
-----------------------------------------------------------
alter table AQ$_AQ$_MEM_MC_H allocate extent;
alter table AQ$_AQ$_MEM_MC_G allocate extent;
alter table AQ$_AQ$_MEM_MC_I allocate extent;
alter table AQ$_AQ_PROP_TABLE_T allocate extent;
alter table AQ$_AQ_PROP_TABLE_H allocate extent;
alter table AQ$_AQ_PROP_TABLE_G allocate extent;
alter table AQ$_AQ_PROP_TABLE_I allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_T allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_H allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_G allocate extent;
alter table AQ$_KUPC$DATAPUMP_QUETAB_I allocate extent;

'ALTERTABLE'||TABLE_NAME||'ALLOCATEEXTENT;'
-----------------------------------------------------------
alter table AQ$_SYS$SERVICE_METRICS_TAB_T allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_H allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_G allocate extent;
alter table AQ$_SYS$SERVICE_METRICS_TAB_I allocate extent;

Then perform

exp username / password @ database name file = / home / oracle / exp.dmp log = / home / oracle / exp_smsrun.log

  success!

 

 

Transfer: https://www.cnblogs.com/wangzhuxing/p/6474689.html

 

The second, with a view of solving the same problem

 

Oralce used to import and export a variety of ways, pde, sql (export format does not support blog), dmp format, feel .dmp most convenient, you can export all the table structure, data, SEQ and stored procedures, the following specific process begins and if the table is not described how to import the data.

.Dmp import and export commands in cmd window to perform, which is a file storage location:

imp username / password @ net service name = xxx.dmp Full = the y-File
exp username / password @ net service name file = xxx.dmp tables = (table name);
exp username / password @ net service name file = xxx .dmp owner = (1 user name, user name, 2);
use dba privileges to import imp 'username / password @ net service name as sysdba' file = XXX.dmp full = y
database there are two tables, a table has data, a table has no data:

 

 Specifically Export command, you can clearly see export only the data of a table, no data is not exported:

In practice, such a situation is not desirable, it is desirable to export and import all the tables and data and other, as follows:

first step:

 

Step two: out of the alter execute sql statement is executed in the window

The third step, query status, SEGMENT_CREATED is YES:

As can be seen from the figure, the two tables are derived, there is no data after the table shows the data 0:

 

Import table and data:

 

Transfer: https://blog.csdn.net/lyy176/article/details/79565690

Guess you like

Origin www.cnblogs.com/isme-zjh/p/11389558.html