DB2 connect to database连接数据报错

来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 20:31 点击:

今天应用报错,尝试重启db2服务,报错了:
[db2inst1@localhost db2dump]$ db2stop
03/16/2012 14:13:04     0   0   SQL1025N  The database manager was not stopped because databases are still active.
SQL1025N  The database manager was not stopped because databases are still active.

之后执行强制关闭:
[db2inst1@localhost db2dump]$ db2stop force
03/16/2012 14:14:52     0   0   SQL1064N  DB2STOP processing was successful.
SQL1064N  DB2STOP processing was successful.
关闭成功了

再次启动数据库:
[db2inst1@localhost db2dump]$ db2start    
03/16/2012 14:15:00     0   0   SQL1063N  DB2START processing was successful.
SQL1063N  DB2START processing was successful.

然后连接数据库报错了:
[db2inst1@localhost db2dump]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.5

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => connect to newhis
SQL0752N  Connecting to a database is not permitted within a logical unit of
work when the CONNECT type 1 setting is in use.  SQLSTATE=0A001
类连接设置时,在逻辑工作单元内不允许连接数据库。
解释:
发出 COMMIT 或 ROLLBACK
语句之前,尝试连接另一个数据库或同一个数据库。在 CONNECT 1
类环境内不能处理该请求。
退出执行reset
重新执行就可以了,

[db2inst1@localhost ~]$ db2 connect reset
[db2inst1@localhost db2dump]$ db2 connect to newhis

 
   Database Connection Information

 Database server        = DB2/LINUX 9.7.5
 SQL authorization ID   = DB2INST1
 Local database alias   = NEWHIS

一切正常了
[db2inst1@localhost db2dump]$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.5

You can issue database manager commands and SQL statements from the command
prompt. For example:
    db2 => connect to sample
    db2 => bind sample.bnd

For general help, type: ?.
For command help, type: ? command, where command can be
the first few keywords of a database manager command. For example:
 ? CATALOG DATABASE for help on the CATALOG DATABASE command
 ? CATALOG          for help on all of the CATALOG commands.

To exit db2 interactive mode, type QUIT at the command prompt. Outside
interactive mode, all commands must be prefixed with 'db2'.
To list the current command option settings, type LIST COMMAND OPTIONS.

For more detailed help, refer to the Online Reference Manual.

db2 => connect to newhis

   Database Connection Information

 Database server        = DB2/LINUX 9.7.5
 SQL authorization ID   = DB2INST1
 Local database alias   = NEWHIS



作者 longqi

    相关新闻>>

      发表评论
      请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
      用户名: 验证码:点击我更换图片
      最新评论 更多>>

      推荐热点

      • db2管理工具小结
      • DB2数据库的导出与导入(Windows客户端)
      • db2 CLP中如何换行
      • DB2查看表结构及所用表语句
      • DB2 · CREATE TABLESPACE
      • 使用DB2对象:创建模式、表和视图
      • DB2数据库逻辑卷的复制
      网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
      Copyright © 2008-2015 计算机技术学习交流网. 版权所有

      豫ICP备11007008号-1