300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Linux下 Oracle SQLPlus 中文显示乱码处理

Linux下 Oracle SQLPlus 中文显示乱码处理

时间:2021-11-07 21:02:54

相关推荐

Linux下 Oracle SQLPlus 中文显示乱码处理

错误重现:

[oracle@oracle-db-19c ~]$ sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 6 15:57:44 Version 19.3.0.0.0Copyright (c) 1982, , Oracle. All rights reserved.Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0SQL> select userenv('language') from dual;USERENV('LANGUAGE')--------------------------------------------------------------------------------AMERICAN_AMERICA.AL32UTF8SQL> conn scott/tiger@PDB1;Connected.SQL> select userenv('language') from dual;USERENV('LANGUAGE')--------------------------------------------------------------------------------AMERICAN_AMERICA.AL32UTF8SQL> select * from scott.emp;SQL> select * from scott.emp;EMPNO ENAMEJOB MGR HIREDATESAL COMMDEPTNO---------- ------------------------------ --------------------------- ---------- --------------- ---------- ---------- ----------7935 ���7369 SMITHCLERK 7902 17-DEC-80 800207499 ALLENSALESMAN7698 20-FEB-81 1600 300 307521 WARD SALESMAN7698 22-FEB-81 1250 500 307566 JONESMANAGER 7839 02-APR-81 2975207654 MARTINSALESMAN7698 28-SEP-81 1250 1400 307698 BLAKEMANAGER 7839 01-MAY-81 2850307782 CLARKMANAGER 7839 09-JUN-81 2450107788 SCOTTANALYST 7566 24-JAN-87 3000207839 KING PRESIDENT17-NOV-81 5000107844 TURNERSALESMAN7698 08-SEP-81 15000 307876 ADAMSCLERK 7788 02-APR-87 1100207900 JAMESCLERK 7698 03-DEC-81 950307902 FORD ANALYST 7566 03-DEC-81 3000207934 MILLERCLERK 7782 23-JAN-82 13001015 rows selected.SQL>

修复问题:

su - root

echo 'export NLS_LANG="AMERICAN_AMERICA.UTF8"'>>/etc/profile

source /etc/profile

echo $NLS_LANG

[oracle@oracle-db-19c ~]$ su - rootPassword: [root@oracle-db-19c ~]# echo 'export NLS_LANG="AMERICAN_AMERICA.UTF8"'>>/etc/profile[root@oracle-db-19c ~]# source /etc/profile[root@oracle-db-19c ~]# echo $NLS_LANGAMERICAN_AMERICA.UTF8[root@oracle-db-19c ~]# [root@oracle-db-19c ~]# su - oracle[oracle@oracle-db-19c ~]$ [oracle@oracle-db-19c ~]$ sqlplus / as sysdbaSQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 6 16:47:08 Version 19.3.0.0.0Copyright (c) 1982, , Oracle. All rights reserved.Connected to:Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - ProductionVersion 19.3.0.0.0SQL> select userenv('language') from dual;USERENV('LANGUAGE')--------------------------------------------------------------------------------AMERICAN_AMERICA.AL32UTF8SQL> conn scott/tiger@PDB1;Connected.SQL> set pagesize 200SQL> set linesize 200SQL> insert into emp (empno,ename) values(7935, '潘 ');1 row created.SQL> commit;Commit complete.SQL> select * from scott.emp;EMPNO ENAMEJOB MGR HIREDATESAL COMMDEPTNO---------- ------------------------------ --------------------------- ---------- --------------- ---------- ---------- ----------7935 潘7369 SMITHCLERK 7902 17-DEC-80 800207499 ALLENSALESMAN7698 20-FEB-81 1600 300 307521 WARD SALESMAN7698 22-FEB-81 1250 500 307566 JONESMANAGER 7839 02-APR-81 2975207654 MARTINSALESMAN7698 28-SEP-81 1250 1400 307698 BLAKEMANAGER 7839 01-MAY-81 2850307782 CLARKMANAGER 7839 09-JUN-81 2450107788 SCOTTANALYST 7566 24-JAN-87 3000207839 KING PRESIDENT17-NOV-81 5000107844 TURNERSALESMAN7698 08-SEP-81 15000 307876 ADAMSCLERK 7788 02-APR-87 1100207900 JAMESCLERK 7698 03-DEC-81 950307902 FORD ANALYST 7566 03-DEC-81 3000207934 MILLERCLERK 7782 23-JAN-82 13001015 rows selected.SQL>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。