DB2 Import export a single table to explain the operation _DB2

Source: Internet
Author: User
Tags db2 db2 connect db2 connect to wrapper import database
1, export the entire database table structure, methods, stored procedures, etc., execute the script
Db2look–d dbname–e–o db.sql–i username–w Password
DB2-TVF Db.sql

2. Export and import of single table data
Export: Db2move dbname export-tn tablename-u db2user-p PSW
Import: Db2move dbname import-u db2user-p PSW

3, the database backup, recovery
Backup: DB2 backup DATABASE dbname
Recovery: DB2 Restore DATABASE dbname

4. Export and Import database data using the Db2move command
Export the initialization data from another database, first enter the exported directory, first Db2cmd, then enter the command: Db2move dbname export–u username–p password. Note: dbname is the original database name and username is the username password password.
The Restore command is: db2move dbname import-u username-p Password

5. Other:.
Export to a file for SQL statements
db2look-d cqyancao-e-o db.sql-i db2user-w PSW
Database name to go out filename user name password
Example: db2look-d department-u walid-e-o db2look.sql
--This will generate DDL statements for all tables and federated objects created by user WALID
--Db2look output is sent to a file named Db2look.sql
Example: db2look-d department-z myscm1-e-o db2look.sql
--This will generate DDL statements for all tables with a schema name of MYSCM1
--also generates the DDL for all federated objects created $USER.
--Db2look output is sent to a file named Db2look.sql
Example: db2look-d department-u walid-m-o db2look.sql
--This generates an UPDATE statement to capture statistics about the tables/aliases created by the user WALID
--Db2look output is sent to a file named Db2look.sql
Example: db2look-d department-u walid-e-wrapper w1-o db2look.sql
--This will generate DDL statements for all tables created by user WALID
--also generates DDL for all federated objects created by user WALID for wrapper W1
--Db2look output is sent to a file named Db2look.sql
Example: db2look-d department-u walid-e-server s1-o db2look.sql
--This will generate DDL statements for all tables created by user WALID
--also generates DDL for all federated objects created by user WALID for server S1
--Db2look output is sent to a file named Db2look.sql

DB2 backup and import a single table operation
DB2 Connect to database name user login using login password
>DB2 Export to T1.ixf of the IXF select * FROM table name
>DB2 Import from T1.IXF to IXF insert into destination table name or new table name

The data format of the exported library also has two kinds of del (file format) and WSF, but IXF format information is the most complete,
Contains table structure information to recover a deleted table.

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.