例如:
export LANG=zh_CN.GB2312
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
$export LANG=zh_CN.GB2312
$date
2012年 11月 27日 星期二 16:20:35 CST
顯示是中文界面。
$export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
$sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Tue Nov 27 16:19:03 2012
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select sysdate from dual;
SYSDATE
------------
27-NOV-12
顯示的是英文環(huán)境,但只對(duì)ORACLE程序生效。
Linux系統(tǒng)中關(guān)于環(huán)境變量的LANG設(shè)置主要有下列項(xiàng)目:
[root@blliu tmp]# locale
LANG=zh_CN.gb2312
LC_CTYPE="zh_CN.gb2312"
LC_NUMERIC="zh_CN.gb2312"
LC_TIME="zh_CN.gb2312"
LC_COLLATE="zh_CN.gb2312"
LC_MONETARY="zh_CN.gb2312"
LC_MESSAGES="zh_CN.gb2312"
LC_PAPER="zh_CN.gb2312"
LC_NAME="zh_CN.gb2312"
LC_ADDRESS="zh_CN.gb2312"
LC_TELEPHONE="zh_CN.gb2312"
LC_MEASUREMENT="zh_CN.gb2312"
LC_IDENTIFICATION="zh_CN.gb2312"
LC_ALL=
這里L(fēng)C_ALL沒(méi)有設(shè)置,如果它設(shè)置了,上面所有的設(shè)置都無(wú)效的,系統(tǒng)會(huì)讀取LC_ALL。
locale -a 查看本地字符集
locale -m 查看所有支持的字符集
在Oracle數(shù)據(jù)庫(kù)中查NLS_LANG設(shè)置:
SQL> SELECT *
2 FROM DATABASE_PROPERTIES
3 WHERE PROPERTY_NAME IN
4 ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET');
PROPERTY_NAME PROPERTY_VALUE DESCRIPTION
------------------------------ ------------------------------ --------------------
NLS_LANGUAGE AMERICAN Language
NLS_TERRITORY AMERICA Territory