Oracle10g EM亂碼之快速解決

lurou發表於2012-12-05

有關em的亂碼問題,網上眾說紛紜,最後發現最靠譜的還是eygle的文章,要不人家怎麼就是大師呢,這個沒的說。我轉載一下,記錄備用。

轉載地址:

[@more@]

一直沒怎麼用10g的EM工具,今天開啟來看看,發現也有相傳已久的問題.網上也流傳著N種解決方案,仔細看一下,其實這個問題很好解決.

如果安裝時,我們系統環境變數設定的是中文環境,那麼就不會有這個問題.這個問題根本原因在於安裝時,JDK/JRE字符集的自動選擇.

$ORACLE_HOME/jdk/jre/lib$ORACLE_HOME/jre/1.4.2/lib/ 目錄下都有多種字符集字型配置檔案:

[oracle@danaly ~]$ cd $ORACLE_HOME/jdk/jre/lib
[oracle@danaly lib]$ ls font*zh_CN*
font.properties.zh_CN.Redhat font.properties.zh_CN.Redhat2.1
font.properties.zh_CN.Sun font.properties.zh_CN_UTF8.Sun
[oracle@danaly lib]$ cd $ORACLE_HOME/jre/1.4.2/lib/
[oracle@danaly lib]$ ls font*zh_CN*
font.properties.zh_CN.Redhat font.properties.zh_CN.Redhat2.1
font.properties.zh_CN.Sun font.properties.zh_CN_UTF8.Sun

我們只要用合適的中文字符集檔案替換預設檔案即可,我選擇使用font.properties.zh_CN.Redhat來替換預設字型定義檔案:

[oracle@danaly lib]$ cp font.properties.zh_CN.Redhat font.properties 

替換之後需要清理一下Cache,重啟EM即可.

Cache路徑通常位於:

$ORACLE_HOME/oc4j/j2ee/oc4j_applications/applications/em/em/cabo/images/cache/zhs 

清除所有gif檔案即可.然後重新啟動EM:

[oracle@danaly zhs]$ emctl stop dbconsole
TZ set to PRC
oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 oracle Corporation. All rights reserved.

Stopping oracle Enterprise Manager 10g Database Control ...
... Stopped.
[oracle@danaly zhs]$ emctl start dbconsole
TZ set to PRC
oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 oracle Corporation. All rights reserved.

Starting oracle Enterprise Manager 10g Database Control .............. started.
------------------------------------------------------------------
Logs are generated in directory
/opt/oracle/product/10.2.0/danaly.hurrray.com.cn_danaly/sysman/log

現在登陸Web頁面,EM顯示就可以正常顯示中文了.

注意:如果經過以上處理仍然不能正確顯示中文,請參考以下說明:

開啟剛替換好的font.properties,或者檢視原有的中文字型檔案:

[oracle@smsdbrac1 lib]$ tail -2 font.properties.zh_CN.Redhat
filename.-misc-zysong18030-medium-r-normal--*-%d-*-*-c-*-iso10646-1=/usr/share/fonts/zh_CN/TrueType/zysong.ttf

注意其中包含了filename指向中文字型檔案,請確認該檔案在你的伺服器上是否存在,如果不存在,改換一個存在的中文字型檔案即可,也可以自行下載安裝新的字型檔案:

[oracle@smsdbrac1 lib]$ ls -al /usr/share/fonts/zh_CN/TrueType/zysong.ttf
-rw-r--r-- 1 root root 9249332 Mar 29 2002 /usr/share/fonts/zh_CN/TrueType/zysong.ttf

這個問題在Redhat中,被作為Bug在後續版本中被修正:

Bug 445297 - Add fonts-chinese-zysong package for zysong font from fonts-chinese.


zysong.ttf字型下載

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26006637/viewspace-1059860/,如需轉載,請註明出處,否則將追究法律責任。

相關文章