Friday, May 10, 2013

SQL0805N 找不到程序包 "NULLID.SQLUFG13 0X4141414141594758"。SQLSTATE=51002 解决


开发使用Quest Central 进行 import 操作,语句如下:

import from "d:\A_MOBILEAREA.txt" of del insert into A_MOBILEAREA(MOBILE,AREACODE)

操作报错:

SQL0805N 找不到程序包 "NULLID.SQLUFG13 0X4141414141594758"SQLSTATE=51002

查询帮助文档:

SQL0805N  Package "<package-name>" was not found.

………省略…………..

User response:

Specify the correct package name or bind the program. If the application
being run is not bound to the database, contact the database
administrator to do the necessary binding. Ensure that the application
or object module being executed is the compiled and linked modified
source code associated with the precompile and bind that generated the
package.

If the CURRENT PACKAGE PATH is set, ensure that the schema that includes
the package is specified in the CURRENT PACKAGE PATH.

The following SQL statements can be used to query the catalog to
determine if there are different versions of the package.

SELECT PKGSCHEMA, PKGNAME,
       PKGVERSION, UNIQUE_ID
FROM SYSCAT.PACKAGES
WHERE PKGSCHEMA = 'pkgschema'
      and PKGNAME='pkgname'.

Note that the UNIQUE_ID column corresponds to the consistency token.

If the DB2 utility programs need to be rebound to the database, the
database administrator can accomplish this by issuing one of the
following CLP command from the bnd subdirectory of the instance, while
connected to the database:

*  "db2 bind @db2ubind.lst blocking all grant public" for the DB2
   utilities.
*  "db2 bind @db2cli.lst blocking all grant public" for CLI.

Federated system users: ensure that the packages required for the
federated server are bound at the applicable data sources. Refer to the
Federated Systems Guide for more information about binding packages to
data sources.

sqlcode: -805

sqlstate: 51002

SQL0805N帮助已经告知如果是utilityimport操作属于utility 需要重新绑定可以执行 db2 bind @db2ubind.lst blocking all grant public

于是乎登录到服务器上执行sqllib/bnd下执行bind命令,执行结果虽然有些警告但是执行正常,没有任何错误。详见:

[db2inst1@localhost94:/home/db2inst1]$ db2 bind /home/db2inst1/sqllib/bnd/@db2ubind.lst blocking all

LINE    MESSAGES FOR db2ubind.lst
------  --------------------------------------------------------------------
        SQL0061W  The binder is in progress.

LINE    MESSAGES FOR db2clpnc.bnd
------  --------------------------------------------------------------------
        SQL0595W  Isolation level "NC" has been escalated to "UR". 
                  SQLSTATE=01526

LINE    MESSAGES FOR db2arxnc.bnd
------  --------------------------------------------------------------------
        SQL0595W  Isolation level "NC" has been escalated to "UR". 
                  SQLSTATE=01526

LINE    MESSAGES FOR db2ats_sps.bnd
------  --------------------------------------------------------------------
 1173   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1203   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1234   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1482   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1499   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1517   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1555   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1679   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1696   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1715   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1732   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name.  
                  SQLSTATE=01532
 1895   SQL0204N  "SYSTOOLS.ADMINTASKSTATUS" is an undefined name. 
                  SQLSTATE=01532
 1950   SQL0204N  "SYSTOOLS.ADMINTASKSTATUS" is an undefined name. 
                  SQLSTATE=01532
 1962   SQL0204N  "SYSTOOLS.ADMINTASKS" is an undefined name. 
                  SQLSTATE=01532
 1979   SQL0204N  "SYSTOOLS.ADMINTASKSTATUS" is an undefined name. 
                  SQLSTATE=01532

LINE    MESSAGES FOR db2_adminotm.bnd
------  --------------------------------------------------------------------
  342   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  371   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  455   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  536   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  570   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  590   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  671   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  767   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532
  903   SQL0204N  "SYSTOOLS.ADMIN_MOVE_TABLE" is an undefined name. 
                  SQLSTATE=01532

LINE    MESSAGES FOR db2ubind.lst
------  --------------------------------------------------------------------
        SQL0091N  Binding was ended with "0" errors and "26"
                  warnings.

这两个警告可以忽略,因为我们目前用不到。
执行完bind后依然没有找到SQLUFG13包,命令:

db2 "SELECT PKGSCHEMA, PKGNAME, PKGVERSION, UNIQUE_ID FROM SYSCAT.PACKAGES WHERE PKGNAME = 'SQLUFG13'"

反复检查所做过的操作并没有什么错误。于是上网查询得到的解决方法:

解决步骤:
 开始-》运行: db2cmd

1db2 connect to sample user XXX using password 

2
db2 bind 'C:\Program Files\IBM\SQLLIB\bnd\@db2ubind.lst' blocking all

3
db2 bind 'C:\Program Files\IBM\SQLLIB\bnd\@db2cli.lst' blocking all


说明:

1XXX 为数据库用户名,password 为密码 
2C:\Program Files\IBM\SQLLIB    db2按照目录,换成自己的


初看网上找到的解决办法和我的操作时一样的,差别是我的环境是aix而它是windows环境。在反复核思考和核对操作时突然意识到开发使用的Quest Central不也是在windows上嘛,难道SQLUFG13包只在windows环境中有?

改变操作方式,通过Quest Central的所在windows上使用db2cmd连接到服务器上的数据库,然后在本地的db2安装目录上找到bnd目录执行bind,执行完后再次查看服务器的包列表终于出现SQLUFG13了。再次执行import操作正常完成!

解决这个问题后让我又再次想到一句经典的话:网络上的坑真的很多啊。
另外想抱怨的是:IBM,你把信息中心做得那么好为什么不介绍下系统自带的那些包呢?因为IBM的包还是很特别的,在其他数据库上并没有这样的东东,然后这方面的资料又很少。