Two Methods for importing and exporting DB2 table structures (1)

Source: Internet
Author: User
Tags db2 installation

This document introduces two common methods for importing and exporting table structures in the DB2 database.

Method 1

In the object View window of the control center, select the data table of the table structure to be exported, press Ctrl or Shift to select multiple data tables, right click, and choose-> Generate DDL.

Method 2

◆ Step 1: Open the command line tool of DB2, create a new folder data under the BIN folder of the DB2 installation directory, and enter the directory.

Create this directory: mkdir data

Go to the directory: cd data


◆ Step 2: export the table structure. The command line is as follows:

Db2look-d dbname-e-a-x-I username-w password-o ddlfile. SQL

After successful execution, you will find the SQL file in the folder you just created.

◆ Step 3: export data. The command line is as follows:

Db2move databasename export-u username-p password

So far, data export has ended.

2. Export table data

Export to [path (example: D: "TABLE1.ixf)] of ixf select [field (example: * or col1, col2, col3)] from TABLE1;

Export to [path (example: D: "TABLE1.del)] of del select [field (example: * or col1, col2, col3)] from TABLE1;

Import table data


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.