签到成功

知道了

CNDBA社区CNDBA社区

db2 表的导入和导出

2021-09-29 23:05 1747 0 原创 DB2
作者: hbhe0316

1.导出表的数据http://www.cndba.cn/hbhe0316/article/4767

http://www.cndba.cn/hbhe0316/article/4767

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

2.导出testdb1库的t3表的表结构http://www.cndba.cn/hbhe0316/article/4767

http://www.cndba.cn/hbhe0316/article/4767

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

3.将t3.txt和t3.sql scp到目标端http://www.cndba.cn/hbhe0316/article/4767

http://www.cndba.cn/hbhe0316/article/4767

scp /tmp/t3.* 192.168.2.167:/tmp

4.如果源端和目标端的数据库的库名不一样,需要修改t3.sql,然后导入导入t3.sqlhttp://www.cndba.cn/hbhe0316/article/4767http://www.cndba.cn/hbhe0316/article/4767

db2 -tvf /tmp/t3.sql

5.导入数据http://www.cndba.cn/hbhe0316/article/4767

http://www.cndba.cn/hbhe0316/article/4767

[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

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
hbhe0316

hbhe0316

关注

1.只有承认无知,才能装下新的东西; 2.进步来自一点点滴滴的积累; 3.广博让你更优秀,而专业让你无法替代; 4.挫折和失败能够转换为一种财富。

  • 889
    原创
  • 1
    翻译
  • 13
    转载
  • 24
    评论
  • 访问:1873774次
  • 积分:1523
  • 等级:核心会员
  • 排名:第6名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ