ITPub博客

首页 > 数据库 > 数据库开发技术 > db2导出数据库定义及迁移数据

db2导出数据库定义及迁移数据

原创 数据库开发技术 作者:long_small 时间:2022-04-27 16:56:12 0 删除 编辑

db2导出全库定义

① db2look -d sample(库名称) -a -e -l -x -o ddl20210420.out

② db2look -d sample(库名称) -a -e  -x -f -o ddl20210420.out (导出表,索引,序列等对象)

③   db2look -d sample -createdb -printdbcfg -l -o ddl0423.out(数据库建库语句,包含buffpool,tablesapces,参数)

   -- db2look -d sample(库名称) -a -ct -x -o   ddl20210420.out(导出表,索引,序列等对象)


导出数据

[db2inst1@long-ibm1 ~]$ db2 "select * from db2inst1.org"


DEPTNUMB DEPTNAME       MANAGER DIVISION   LOCATION     

-------- -------------- ------- ---------- -------------

      10 Head Office        160 Corporate  New York     

      15 New England         50 Eastern    Boston       

      20 Mid Atlantic        10 Eastern    Washington   

      38 South Atlantic      30 Eastern    Atlanta      

      42 Great Lakes        100 Midwest    Chicago      

      51 Plains             140 Midwest    Dallas       

      66 Pacific            270 Western    San Francisco

      84 Mountain           290 Western    Denver       


  8 record(s) selected.


[db2inst1@long-ibm1 ~]$ db2 "export to db2inst1.org of ixf select * from db2inst1.org"


删除数据

 db2 "delete from  db2inst1.org"


导入数据

[db2inst1@long-ibm1 ~]$ db2 "export to db2inst1.org of ixf select * from db2inst1.org"


db2 "select * from db2inst1.org"

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/25846553/viewspace-2769128/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
吕生龙,现就职于IBM,db2 dba,oracle 10G OCP

注册时间:2020-04-07

  • 博文量
    64
  • 访问量
    66984