The export procedure for DB2 database migration is in the Linux operating system

Source: Internet
Author: User

The following article describes how to migrate and export a DB2 Database in a Linux operating system. We all know that DB2 Universal Database™(DB2 UDB) has a very useful tool to help you implement this cross-platform backup and recovery function.

The db2move tool uses the DB2 data movement tool export and import or load to move database tables. However, because the database content is far more than the user table, you need to use other methods to migrate other database objects between different databases, such as constraints, triggers, indexes, sequences, tablespaces, and buffer pools.

This is why the db2look tool appears. With this tool, you can capture the Data Definition Language DDL used to define these objects in the source database) and recreate these objects in the target database using these data definition languages.

1. Environment Description:

DB2 database migration is named sample, SCHEMA is also oatest, and username is oatest

2. Export Steps:

(1) create a new directory. If you need to pay attention to the permission of the directory in linux, the directory should be accessible by db2inst1 users.

 
 
  1. [db2inst1@devsvr2 db2inst1]$ pwd  
  2. /home/db2inst1  
  3. [db2inst1@devsvr2 db2inst1]$ mkdir oatest0303  
  4. [db2inst1@devsvr2 db2inst1]$ ls  
  5. db2inst1 db2test Desktop oatest0303 sqllib 

(2) enter this directory

 
 
  1. [db2inst1@devsvr2 db2inst1]$ cd oatest0303/  
  2. [db2inst1@devsvr2 oatest0303]$ 

(3) Use the database Extraction Tool db2look to export the database structure

Main commands

 
 
  1. db2look -d sample -e -z oatest -l -o oatest.sql  
  2. [db2inst1@devsvr2 oatest0303]$ db2look -d sample -e -z oatest -l -o oatest.sql 

No user id is specified. db2look tries to use the environment variable USER

USER: DB2INST1

The specified mode is OATEST.

Create Table DDL

The Mode name of the union is ignored.

Output is sent to the file: oatest. SQL

The script includes the DDL statements used to create bufferpool and tablespace during DB2 database migration.

(4) use the db2move tool to export database data

Main commands

 
 
  1. db2move sample export  
  2. [db2inst1@devsvr2 oatest0303]$ db2move sample export  
  3. ***** DB2MOVE *****  
  4. Action: EXPORT  
  5. Start time: Sun Mar 5 11:00:52 2006  
  6. Connecting to database SAMPLE ... successful! Server: DB2 Common Server V8.2.0  
  7. EXPORT: 0 rows from table "OATEST "."ATTACHFILE"  
  8. EXPORT: 0 rows from table "OATEST "."BASE"  
  9. …… 

(5) package and compress the oatest0303/

Main commands:

 
 
  1. tar zcvf oatest0303.tar.gz oatest0303/  
  2. [db2inst1@devsvr2 oatest0303]$ cd ..  
  3. [db2inst1@devsvr2 db2inst1]$ tar zcvf oatest0303.tar.gz oatest0303/  
  4. oatest0303/  
  5. oatest0303/oatest.sql  
  6. oatest0303/EXPORT.out  
  7. oatest0303/db2move.lst  
  8. oatest0303/tab1.msg  
  9. oatest0303/tab1.ixf  
  10. …… 

The above content is an introduction to the steps for migrating and exporting DB2 databases on the Linux platform. I hope you will have some gains.

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.