DB2 usually used commands 常用命令 functions

本文介绍了如何使用DB2命令行工具执行SQL脚本文件、删除数据库及恢复等操作,并提供了快速删除所有数据的方法。

运行 sql file:

   db2   -tvf   ttt.sql

   db2 -td@ -f filename  // @为分隔符

db2 list command options

    Some of the options that you can control are:

  • The auto-commit of each statement that you can define using the cflag.
  • An an input file that provides the DB2 commands and SQL statements which you can define using thef flag.
  • The end-of-statement termination character (the default character is ;), defined by thet flag.

 

delete database : 

                             db2 force applications all;
                             db2 terminate ;
                             db2 drop database databasename;

 

remove database后恢复:db2 catalog db yourdbname on E:

 无法creagte db :  db2  uncatalog db yourdbname

 

db2relocatedb

    

  • Changing a database name
  • Changing the path/drive that a database was created on
  • Changing one or more table space containers
  • Changing the log path associated with the database
  • Changing the instance associated with a database
  • Copying/moving a database to the same (or different) machine and making one or more of the above changes

     http://www.ibm.com/developerworks/data/library/techarticle/dm-0407schlamb/
     http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/core/r0004500.htm

 


Fast _delete _ all data

      EXPORT TO C:/TABLE.IXF OF IXF SELECT *FROM HOMEPAGE."SR_INDEX_DOCS" WHERE 1=2
      import from C:/TABLE.IXF of ixf replace into HOMEPAGE."SR_INDEX_DOCS"

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值