linux下安装的oracle,不能正常显示中文
初次遇到,耗费了挺长时间
在此记录下,下次做参考
查看编码
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.WE8MSWIN1252
最开始设置为GBK,后面测试还是不行,
后面设置为UTF8,问题解决了
服务器系统设置
[root@localhost oracle]# vim /etc/locale.conf
LANG="zh_CN.utf8"
[root@localhost oracle]# source /etc/locale.conf
[root@localhost oracle]# vim /etc/profile
export LC_ALL="zh_CN.utf8"
export LANG="zh_CN.urf8"
[root@localhost oracle]# source /etc/profile
[oracle@localhost ~]$ vim .bash_profile
export NLS_LANG=AMERICAN_AMERICA.UTF8
[oracle@localhost ~]$ source .bash_profile
oracle server端设置
[oracle@localhost ~]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount;
SQL> alter system enable restricted session;
SQL> alter system set job_queue_processes=0;
SQL> alter database open;
SQL> alter database character set utf8;
或者
SQL> alter database character set internal_use utf8;
SQL> shutdown immediate;
SQL> startup;
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
---------------------
AMERICAN_AMERICA.UTF8
客户端设置
配置环境变量
NLS_LANG
AMERICAN_AMERICA.UTF8