Monday, December 10, 2012

DB2命令执行异常(32bit和64bit问题)


问题描述:
登陆服务器,执行db2:
$ db2
exec(): 0509-036 Cannot load program db2 because of the following errors:
0509-022 Cannot load module /usr/opt/db2_08_01/lib64/libdb2.a(shr_64.o).
0509-150 Dependent module /home/db2inst1/sqllib/lib32/libdb2trcapi.a(shr_64.o) could not be loaded.
0509-152 Member shr_64.o is not found in archive
0509-022 Cannot load module db2.
0509-150 Dependent module /usr/opt/db2_08_01/lib64/libdb2.a(shr_64.o) could not be loaded.
0509-022 Cannot load module .

根据错误提示可以看出load modulelib64下的文件错误。询问服务器的负责人了解到先前因为需要在该64位服务器上32位程序所以修改过lib

问题分析:
查询本机lib的配置情况(切换至数据库账号下):
$ echo $LIBPATH
/usr/lib:/lib:/home/db2inst1/sqllib/lib32:/home/db2inst1/sqllib/lib
上面的结果可以看出LIBPATH只指定了lib32
查询另外一台正常的64位服务器(切换至数据库账号下):
$ echo $LIBPATH
LIBPATH=/usr/lib:/lib:/home/db2inst1/sqllib/lib64
从两次结果可以确认是因为lib路径的问题导致db2clp无法启动。

解决方法:
修改lib路径:
$ export LIBPATH=/usr/lib:/lib:/home/db2inst1/sqllib/lib64:/home/db2inst1/sqllib/lib32
修改完后执行db2:
$ db2
(c) Copyright IBM Corporation 1993,2007
Command Line Processor for DB2 Client 9.7.6

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 =>

自此问题得到解决,让服务器负责人开启本机上的32位应用,确认可以正常运行。

总结:
修改LIBPATH指定到lib32lib64可以让操作系统同时支持32bit64bit的应用程序。

No comments:

Post a Comment