修改Oracle客户端字符集方法:
1:可以通过修改注册表键值永久设置,类似于这样的键值:
HKEY_LOCAL_MACHINE/SOFTWARE/Oracle/HOME0下,
如一般的简体中文
nls_lang=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
2:查看数据库当前字符集参数设置
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
3:打开CMD窗口,乱码情况
C:/Documents and Settings/Administrator>set NLS_LANG=american_america.AL32UTF8
C:/Documents and Settings/Administrator>sqlplus
SQL*Plus: Release 9.2.0.1.0 - Production on 星期六 4月 10 10:59:53 2010
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
请输入用户名: scott
请输入口令:
连接到:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.1.0 - Production
SQL> select empno,ename,sal from emp where empno=7779;
EMPNO ENAME SAL
---------- ------------------------------ ----------
7779 鏉ㄥ钩 6080
4:打开另外个CMD窗口,正常情况
C:/Documents and Settings/Administrator>set NLS_LANG=SIMPLIFIED CHINESE_CHINA.ZHS16GBK
C:/Documents and Settings/Administrator>sqlplus
SQL> select empno,ename,sal from emp where empno=7779;
EMPNO ENAME SAL
---------- ---------- ----------
7779 杨平 6080