linux DB2 文件乱码,db2在Linux下字符集问题

在红帽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=

受文章的启发,我进行了以下实验:

export LANG=zh_CN

export LANG=zh_CN.GB2312

export LANG=zh_CN.UTF-8

以上字符集设置以及前面的en_US均能正常启动实例,就设置为zh_CN.GB18030不能启动

APAR statusClosed as program error.

Error descriptionIf 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. *

****************************************************************

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值