Solve the problem that Oracle11g cannot export empty tables. oracle11g exports empty tables

Source: Internet
Author: User

Solve the problem that Oracle11g cannot export empty tables. oracle11g exports empty tables
ORACLE 11g export database file backup using the exp command, it is found that only a part of the table can be exported and no error is prompted, the solution can not be found before the export of the table can only be re-created. Later it was found that all empty tables were not exported. So I want to check it out, because there is no such problem in the previous 10G version.

Data Query shows a new feature in Oracle 11G: The new parameter "deferred_segment_creation" indicates that the segment delay is created. The default value is true.

What does it mean?

If this parameter is set to true, you create a new table named Table1 and do not insert data into it, the table will not be allocated extent immediately, that is, it does not occupy data space, that is, tables do not allocate segment to save space. Therefore, these tables cannot be exported. In the system table user_tables, we can also see that the field "NO" or "YES" in the segment_treated field shows whether a table has been allocated a segment. To put it bluntly, we want to save a small amount of space.

You can use the following SQL statement to query and find that the values of the segment_created field of a table not exported are 'no '.

Select segment_created, table_name from user_tables where segment_created = 'no ';

Solution: add the following statement for each empty table:

Alter table TableName allocate extent

1. query all empty tables under the current user (one user is better suited to one default tablespace ). The command is as follows:

SQL> select table_name from user_tables where NUM_ROWS = 0;

2. Based on the preceding query, you can build a command statement for allocating space to empty tables, as shown below:

Select 'alter table' | table_name | 'allocate extent; 'from user_tables where

Num_rows = 0 or num_rows is null or segment_created = 'no'

3. Execute all the statements in 2.

Related Article

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.