oracle中文資料顯示亂碼--字符集修改方法
阿新 • • 發佈:2019-02-20
問題描述:
安裝了oracle資料庫以後, 表中的中文資料顯示為亂碼;
網上查了資料, 原因是oracle字符集沒有設定對.SQL> select userenv('language') from dual; USERENV('LANGUAGE') AMERICAN_AMERICA.WE8MSWIN1252
執行上述SQL語句查到當前oracle語言環境變數為:AMERICAN_AMERICA.WE8MSWIN1252
如果要支援中文, 應該為:AMERICAN_AMERICA.ZHS16GBK問題原因:
安裝oracle時在配置/home/oracle/.bash_profile時, 語言變數沒設定, 導致了這個問題, 應在該配置檔案中加入以下行:
NLS_LANG=”american_america.zhs16gbk”解決辦法:
問題是,我oracle已經裝好了, 怎麼更改呢?
查了下oracle 8g 以上都可以改的,以下是操作步驟:
<1>.首先 sqlplus登入後,關閉oracle資料庫:shutdown immediate
<2>.startup mount
<3>.alter system enable restricted session
<4>.alter system set JOB_QUEUE_PROCESSES=0
<5>.alter system set AQ_TM_PROCESSES=0
<6>.alter database open
<7>.alter database character set INTERNAL_USE ZHS16GBK
<8>.shutdown immediate
<9>.startup