db2需要注意的问题

1. db2新建数据库为什么没写密码却可以输入密码连接

    因为新建数据库默认以系统名为数据库用户名,系统密码为自己的用户名密码

2. 报错信息:

    SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a

    query is an empty table. SQLSTATE=02000

    DB20000I The SQL command completed successfully.

解决办法:带有SQL0100W的仅仅是一个警告,并不是报错,它只是告诉你没有结果返回给你,或者返回结果是个空表。

3. 经典例子:查找ESBTLOG表中msg_id,tran_date都相同的记录。

db2 "select msg_id, tran_date, count(*) from ESBTLOG order by msg_id, tran_date having count(*)>1"

4. 报错信息:

    DB21034E The command was processed as an SQL statement because it was not a

     valid Command Line Processor command. During SQL processing it returned:

     SQL0911N The current transaction has been rolled back because of a deadlock

     or timeout. Reason code "2". SQLSTATE=40001

    解决方法:db2 reorg table ESBTLOG(table name)

5. 表空间异常,状态码:0x0020

    解决方案:db2 backup db ixpdb tablespace USERSPACE1 online include logs(在当前目录下备份表空间)

    查看表空间:db2 list tablespaces show detail

6. 强行关闭数据库

    a. db2 connect reset

    b. 

        1). 查看是否有活动的连接

              命令:db2 list applications for db db_name

         2). 关闭连接

              命令:db2 force application all

    c. db2stop (db2stop force)

你可能感兴趣的:(db2需要注意的问题)