ORACLE11G workaround for not exporting empty table problems when exporting with EXP

Source: Internet
Author: User

A new feature in 11G that does not allocate segment when the table has no data to save space

Workaround:

1, insert a row, and then rollback will produce segment.

The method is to insert data into the empty table and then delete it, resulting in segment. When exporting, you can export empty tables.

2. Set Deferred_segment_creation parameters

Show Parameter Deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Deferred_segment_creation Boolean TRUE


Sql> alter system set DEFERRED_SEGMENT_CREATION=FALSE;

The system has changed.


Sql> Show Parameter Deferred_segment_creation

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
Deferred_segment_creation Boolean FALSE

The parameter value is true by default, and segment is assigned when false, whether it is an empty table or a non-empty table.

It is important to note that this value is set to no effect on previously imported empty tables, and still cannot be exported, but can only work on the new tables that are created later. You can only use the first method if you want to export an empty table before.

After a long time, I finally found this method.

Check all empty tables under the current user first

Select table_name from user_tables where num_rows=0;

Find the empty table using the following sentence

Select ' ALTER TABLE ' | | table_name| | ' allocate extent; ' from User_tables where num_rows=0

Export the query results and execute the exported 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 execute: Exp username/password @ database name File=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log

Export Success!

ORACLE11G workaround for not exporting empty table problems when exporting with EXP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.