How to resolve setlocale warning in OEL6

on

默认安装的Oracle Enterprise Linux 6,在用户登录以后,通常会有以下警告:

Last login: Tue Jun 19 16:52:19 2012 from 192.168.2.1
-bash: warning: setlocale: LC_CTYPE: cannot change locale (UTF-8)

并且在执行oerr等命令的时候,也会先产生警告,比如:

$ oerr ora 10046
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LC_CTYPE = "UTF-8",
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
10046, 00000, "enable SQL statement timing"
// *Cause:
// *Action:

其实也并不太影响使用,但是比较烦躁。

解决方法:

vi /etc/sysconfig/i18n

默认的内容可能是:

LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

需要添加一行LC_ALL的设置,如下:

LANG="en_US.UTF-8"
LC_ALL="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"

再重新登录,就一切OK了。

备注:为什么会有i18n这样古怪名字的配置文件,实际上i18n是internationalization的所写,表示从i到n之间有18个字母。

One Comment Add yours

  1. Liang Guo says:

    个人认为,这应该是一个bug, 默认情况下,应该设置LANG就足够了。
    默认情况下,运行locale,结果是什么?

Leave a Reply

Your email address will not be published. Required fields are marked *