首页 » ORACLE 9i-23c » oracle 模拟字符集乱码中文显示’靠’的问题(原创)

oracle 模拟字符集乱码中文显示’靠’的问题(原创)

以前遇到过朋友说数据库里都是‘靠靠’,这也是一个经典的字符集问题,今天 想还原那个问题,操作如下

———-begin———-

环境:oracle 安装服务器为192.168.3.229 (以下称server)linux

客户端操作192.168.3.243(以下称client)linux

先在server制造数据

SQL> create table test (id int,name varchar(20));

Table created.
SQL> insert into test values(1,’我是谁’);

1 row created.
SQL> commit;

Commit complete.

SQL> exit

好了下面全在client上操作

[oracle@orazhang ~]$ sqlplus sys/oracle@192.168.3.229:1528/orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Fri Mar 11 09:41:40 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> set linesize 200
SQL> set wrap off
SQL> select * from nls_database_parameters;

PARAMETER                      VALUE
—————————— ——————————————————————————–
NLS_LANGUAGE                   AMERICAN
NLS_TERRITORY                  AMERICA
NLS_CURRENCY                   $
NLS_ISO_CURRENCY               AMERICA
NLS_NUMERIC_CHARACTERS         .,
NLS_CHARACTERSET               ZHS16GBK

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

[oracle@orazhang ~]$ export LANG=’Simplified Chinese_china.ZHS16GBK’

—修改OS字符集

[oracle@orazhang ~]$ echo $LANG
Simplified Chinese_china.ZHS16GBK

[oracle@orazhang ~]$ export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1

–修改客户端字符集

[oracle@orazhang ~]$ sqlplus sys/oracle@192.168.3.229:1528/orcl as sysdba

SQL*Plus: Release 10.2.0.1.0 – Production on Fri Mar 11 09:41:40 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select * from test;

ID NAME
———- ——————–
1 靠?

–显示成功

————–END—————-

放心nls_lang\lang 值操作系统重启后就会还原,也可以手动修改回原来显示正常

转载请写名出处:网址

打赏

目前这篇文章有1条评论(Rss)评论关闭。

  1. Phil Finnefrock | #1
    2011-12-21 at 03:02

    You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complex and extremely broad for me. I’m looking forward for your next post, I’ll try to get the hang of it!