在红帽Linux系统装db2 v9.5,安装很顺利(装两次,一次用db2_install命令,一次用db2setup命令),但无论是图形安装时创建实例还是在字符界面安装好后创建实例,实例都无法启动,执行db2start命令没任何反应。最后在CU搜到一个帖子,执行命令:
export LANG=en.US 后解决问题
当时字符集设置为:LANG=zh_CN.GB18030
export LANG=zh_CN.GB18030
echo $LANG
zh_CN.GB18030
启动实例,没任何反应
把字符集改为en.US后启动正常:
echo $LANG
en.US
$ db2start
SQL1063N DB2START processing was successful
因为我没有设定LC_ALL或LC_*的值,所以执行export LANG=zh_CN.GB18030后,locale的结果LC_XX的值都是zh_CN.GB18030,如下:
$ locale
LANG=zh_CN.GB18030
LC_CTYPE="zh_CN.GB18030"
LC_NUMERIC="zh_CN.GB18030"
LC_TIME="zh_CN.GB18030"
LC_COLLATE="zh_CN.GB18030"
LC_MONETARY="zh_CN.GB18030"
LC_MESSAGES="zh_CN.GB18030"
LC_PAPER="zh_CN.GB18030"
LC_NAME="zh_CN.GB18030"
LC_ADDRESS="zh_CN.GB18030"
LC_TELEPHONE="zh_CN.GB18030"
LC_MEASUREMENT="zh_CN.GB18030"
LC_IDENTIFICATION="zh_CN.GB18030"
LC_ALL=
受http://publib.boulder.ibm.com/in ... c/doc/c0052657.html文章的启发,我进行了以下实验:
export LANG=zh_CN
export LANG=zh_CN.GB2312
export LANG=zh_CN.UTF-8
以上字符集设置以及前面的en_US均能正常启动实例,就设置为zh_CN.GB18030不能启动
APAR status
Closed as program error.
Error description
If a non-supported codeset is specified for the server instance, for example (on a Linuxamd64 machine): export LC_ALL=zh_CN.gb18030 db2start will fail. Function sqlonlsmapcp will fail with a SQLO_BADCP error, which is then mapped to SQLO_NLS_INIT_FAILED in sqloNLSOneTimeInit. We end up aborting the operation well before we'd ever create the data file in ~/sqllib/tmp. Nothing is logged in db2diag.log or on the console about the db2start failure. The trace shows that DB2 eventually aborts with a -1042. Based on the output of 'locale -a', the zh_CN.gb18030 locale is valid on this system.
Local fix
Problem summary
**************************************************************** * USERS AFFECTED: * * ALL * **************************************************************** * PROBLEM DESCRIPTION: * * If a non-supported codeset is specified for the server * * * * instance, for example (on a Linuxamd64 machine): * * * * export LC_ALL=zh_CN.gb18030 * * * * db2start will fail. * * Nothing is logged in db2diag.log or on the console about the * * * * db2start failure. The trace shows that DB2 eventually aborts * * * * with sqlcode -1042. * **************************************************************** * RECOMMENDATION: * * Upgrade server to V95 FP4 or higher. * ****************************************************************