电脑技术学习

DB2数据库部分日常实用操作

dn001

  1、Load 方法装入数据:

  export to tempfile of del select * from TABLENAME where not 清理条件;

  load from tempfile of del modified by delprioritychar replace into TABLENAME nonrecoverable;

  说明:

  在不相关的数据表export数据时,可以采取并发的形式,以提高效率;

  TABLENAME指待清理table的名称;

  modified by delprioritychar防止数据库记录中存在换行符,导致数据无法装入的情况;

  replace into对现数据库中的内容进行替换,即将现行的数据记录清理,替换为数据文件内容;

  nonrecoverable无日志方式装入;

  2、查找当前的应用:DB2 list application |grep BTPDBS;

  3、删除当前正在使用的application:

  db2 "force application (Id1,Id2,Id3)"

  Id1,Id2,Id3 是List显示的应用号;

  4、查看当前应用号的执行状态:

  db2 get snapshot for application agentid 299 |grep Row

  5、查看数据库参数:

  db2 get db cfg for //当前数据库可以省略

  6、修改数据库的Log数据:

  db2 update db cfg using <参数名> <参数值>

  7、Db2Stop Force的用法:

  在进行Bind的时候出现如下错误:

  SQL0082CAn error has occurred which has terminated processing.

  SQL0092NNo package was created because of previous errors.

  SQL0091NBinding was ended with "3" errors and "0" warnings.

  主要是表文件被加锁,不能继续使用;

  在进行stop的时候报错:db2stop

  8/03/2005 21:46:530 0 SQL1025NThe database manager was not stopped because databases are still active.

  SQL1025NThe database manager was not stopped because databases are still active.

  需要使用如下命令可以解决这个问题: db2stop force

  08/03/2005 21:47:49 0 0 SQL1064NDB2STOP processing was successful.

  SQL1064NDB2STOP processing was successful.

  然后启动数据库db2start,连接数据库db2s后,重新进行bind即可。