使用sqlplus显示中文为乱码的解决办法

公司现在还在使用oracle数据库,有时候,只能使用sqlplus来登录数据库。参考网上的资料,解决用sqlplus来显示中文为乱码的问题。
1、使用sqlplus登录oracle数据库,查看字符集
SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

2、查看登录操作系统的会话的字符集
[user@host1 ~]$ echo $NLS_LANG
AMERICAN_AMERICA.ZHS16GBK

3、修改本次会话的字符集
export NLS_LANG=AMERICAN_AMERICA.UTF8

4、再次登录数据库即可

posted @ 2022-07-11 08:25  聚沙成塔  阅读(1726)  评论(0编辑  收藏  举报