1.导出表的数据

db2 "export to /tmp/t3.txt of del select * from t3"

2.导出testdb1库的t3表的表结构

db2look -d testdb1 -u db2inst1 -t t3 -e -o /tmp/t3.sql

3.将t3.txt和t3.sql scp到目标端

scp /tmp/t3.* 192.168.2.167:/tmp

4.如果源端和目标端的数据库的库名不一样,需要修改t3.sql,然后导入导入t3.sql​​​

db2 -tvf /tmp/t3.sql

5.导入数据​

[db2inst1@db02 data]$ db2 "import from /tmp/t3.txt of del insert into t3"
SQL3109N The utility is beginning to load data from file "/tmp/t3.txt".

SQL3110N The utility has completed processing. "3" rows were read from the
input file.

SQL3221W ...Begin COMMIT WORK. Input Record Count = "3".

SQL3222W ...COMMIT of any database changes was successful.

SQL3149N "3" rows were processed from the input file. "3" rows were
successfully inserted into the table. "0" rows were rejected.


Number of rows read = 3
Number of rows skipped = 0
Number of rows inserted = 3
Number of rows updated = 0
Number of rows rejected = 0
Number of rows committed = 3

版权声明:本文为博主原创文章,未经博主允许不得转载。

Linux,oracle