修改PL/ORACLE字符编码集

时间:2021-01-20 03:46:42

一、pl/sql developer 中文字段显示乱码 
原因:因为数据库的编号格式和pl /sql developer的编码格式不统一造成的。

二、查看和修改oracle数据库字符集:

select userenv('language') from dual;

查询结果:

SIMPLIFIED CHINESE_CHINA.AL32UTF8

--修改oracle数据库字符集:(在SQL Plus中)

修改sqlnet.ora文件

SQLNET.AUTHENTICATION_SERVICES= (NTS)

sqlplus /nolog;

sql> conn / as sysdba;

sql> shutdown immediate;

database closed.

database dismounted.

oracle instance shut down.

sql> startup mount;

oracle instance started.

total system global area  135337420 bytes

fixed size                          452044 bytes

variable size                     109051904 bytes

database buffers              25165824 bytes

redo buffers                      667648 bytes

database mounted.

sql> alter system enable restricted session;

system altered.

sql> alter system set job_queue_processes=0;

system altered.

sql> alter system set aq_tm_processes=0;

system altered.

sql> alter database open;

database altered.

sql> alter database character set internal_use JA16SJIS;

sql> shutdown immediate;

sql> startup;

三、修改pl/sql developer 的编码格式:

在windows中创 建一个名为“NLS_LANG”的系统环境变量,设置其值为“SIMPLIFIED CHINESE_CHINA.ZHS16GBK”,

然后重新启动 pl/sql developer,这样检索出来的中文内容就不会是乱码了。如果想转换为UTF8字符集,可以赋予“NLS_LANG”为 “AMERICAN_AMERICA.UTF8”,然后重新启动 pl/sql developer。其它字符集设置同上