oracle中文亂碼的解決方法(linux)

亂碼:

[oracle@orcl12c ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Fri Dec 6 10:45:56 2019

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


???:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> startup
ORA-01081: ????????? ORACLE - ??????
SQL> exit

解決辦法:
修改oracle用戶的環境變量 文件。加入NLS_LANG="SIMPLIFIED CHINESE_CHINA.al32utf8"; export NLS_LANG

實例在startup狀態下,查詢

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.AL32UTF8

配置用戶環境變量:

[oracle@orcl12c ~]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

export ORACLE_SID=orcl
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export DISPLAY=:0
export UMASK=022
NLS_LANG="SIMPLIFIED CHINESE_CHINA.al32utf8"; export NLS_LANG
PATH=$PATH:$HOME/.local/bin:$HOME/bin

export PATH

如圖: 

ok,命令行中文顯示正常了。

[oracle@orcl12c ~]$ lsnrctl status

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 06-12月-2019 11:41:39

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

正在連接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=orcl12c)(PORT=1521)))
LISTENER 的 STATUS
------------------------
別名                      LISTENER
版本                      TNSLSNR for Linux: Version 12.2.0.1.0 - Production
啓動日期                  06-12月-2019 11:41:35
正常運行時間              0 天 0 小時 0 分 3 秒
跟蹤級別                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
監聽程序參數文件          /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
監聽程序日誌文件          /u01/app/oracle/diag/tnslsnr/orcl12c/listener/alert/log.xml
監聽端點概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=orcl12c)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
監聽程序不支持服務
命令執行成功

 

發佈了161 篇原創文章 · 獲贊 50 · 訪問量 60萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章