Oracle 9i allows you to easily obtain DDL statements for table creation and indexing.

Source: Internet
Author: User

The ORACLE tutorial is: Oracle 9i allows you to easily obtain DDL statements for table creation and index creation. We all know that before 9i, It is very troublesome to obtain statements for creating tables and indexes. We usually use export with rows = no, but its output cannot be used directly due to format issues. Another method is to write complex scripts to query data dictionaries. However, for a slightly complex object, such as IOT and nested tables, it still cannot be found.

It is often used to obtain DDL statements from the data dictionary, especially when the system is upgraded/rebuilt. In Oracle 9i, we can directly investigate DDL statements from the data dictionary by executing dbms_metadata. With this powerful tool, we can obtain DDL statements for a single object or the entire SCHEMA. It is best because it is easy to use.

1. How to obtain a single table and index DDL statements:

Below is the output. We only need to extract the table creation/index statement and add a semicolon to it to run it directly.

2. method for obtaining the entire schema ddl statement:

Note that when our table has external keys (reference constraints), we need to determine the order between reference tables to ensure that the reconstruction is performed in a reasonable order. You can query dba_constraints and dba_cons_columns to determine the order between tables.

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.