Today we are going to discuss with you the actual operation steps for correctly importing the DB2 database under the Linux operating platform. If you want to import the DB2 database, if you are curious, the following articles will unveil its mysteries.
(1) Extract
Main commands:
- tar zxfv oatest0303.tar.gz
- [db2inst1@devsvr2 db2inst1]$ tar zxfv oatest0303.tar.gz
- oatest0303/
- oatest0303/oatest.sql
- oatest0303/EXPORT.out
- oatest0303/db2move.lst
- ……
(2) create a new database db2 create db sample
Main commands:
- db2 create db sample
- [db2inst1@devsvr2 db2inst1]$ db2 create db sample
The DB20000I create database Command is successfully completed.
(3) execute the oatest. SQL script to create a database
Main commands:
- db2 -tvf oatest.sql
- [db2inst1@devsvr2 db2inst1]$ cd oatest0303
- [db2inst1@devsvr2 oatest0303]$ db2 -tvf oatest.sql
- ……
(4) import data by performing the db2move migration to migrate the DB2 database on the Linux platform
Main commands:
- db2move sample load
- [db2inst1@devsvr2 oatest0303]$ db2move sample load
- ……
- * LOAD: table "OATEST "."UM_USER"
- -Rows read: 1529
- -Loaded: 1529
- -Rejected: 0
- -Deleted: 0
- -Committed: 1529
- Disconnecting from database ... successful!
- End time: Sun Mar 5 10:24:22 2006
(5) check consistency
Main commands:
- db2 set integrity for oatest.UM_USER immediate checked
- [db2inst1@devsvr2 oatest0303]$ db2 connect to sample
Database connection information
Database Server = DB2/LINUX 8.2.0
SQL authorization id = DB2INST1
Local Database alias = SAMPLE
- [db2inst1@devsvr2 oatest0303]$ db2 "select count(*) from
- oatest.um_user"
- 1
SQL0668N the operation is not allowed due to the cause code "1" on the table "OATEST. UM_USER.
- SQLSTATE=57016
- [db2inst1@devsvr2 oatest0303]$ db2 set integrity for oatest.UM_USER
- immediate checked
The DB20000I SQL command is successfully completed.
- [db2inst1@devsvr2 oatest0303]$ db2 "select count(*) from
- oatest.um_user"
- 1
- 1529
1 record selected.
Use SQL statements to obtain the execution statement of the table to be checked