How to Implement online DB2 Import

Source: Internet
Author: User
Tags db2 connect db2 connect to

Online DB2 import is a frequently used operation. The following describes the implementation of online DB2 import. If you are interested, take a look.

DB2 online Import

Note: Make sure that the tablespace name and page size are consistent with those of the schema before importing.

1. Import table structures, views, stored procedures, triggers, functions, sequences, and so on, excluding binary objects such as Blob exported to the specified file

Run the following command on the DB2 console:

-- Log on to DB2
Db2 connect to tb33_s

-- Specify schema

Db2 set current schEmA tb33

-- Import the export file TB33. SQL as DB2
Db2-tvf TB33. SQL

-T: Specifies the statement termination character.

-V: display the execution content on the console

-F: Read the input file.

2. Import table data

You can import table data in two steps: generate an import Command Script file and execute an import command script file.

1. Generate the import Command Script file:

Run the following statement using the DB2Manager tool to generate the import table data command. type = 'T' indicates that only table data is exported;

-- Import table data statement
Select 'import from H: \ DB2 \ TB33 \ '| rtrim (tabname) | '. ixf of ixf insert into '| ''| rtrim (tabname) |'; 'from syscat. tables where tabschema = 'tb33' and type = 'T'

Command Execution instructions:

Import command for generating table data in the database schema TB33; import all table structure files in the path H: \ db2 \ TB33;

Save the generated commands as an import.txt file.

2. Execute the import Command Script:

Run the following command on the DB2 console:

Db2-tvf import.txt

-T: Specifies the statement termination character.

-V: display the execution content on the console

-F: Read the input file.

After the script is successfully executed, You can query the data table in DB2Manager and view the imported data.

Common db2 stored procedure statements

Usage of the DB2 create server statement

Usage of DB2 Merge statements

In-depth discussion of DB2 table connection principles

Common DB2 cycle usage

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.