RH+Oracle安裝過程中碰到的一些值得總結的問題,rhoracle
昨天大半夜裝一個RH5+Oracle版本,期間碰到了幾件事情,陳述如下,以此為據。
1. 安裝前需要配置核心參數,可參考Oracle官方文檔推薦的最低值來設定,但往往機器自身有些參數值已有了,例如kernel.shmmax、kernel.shmall,也參考過網上不少文章,設定的值有所差別,此時官方文檔中的一句話值得我們注意:
“Note: If the current value of any parameter is higher than the value listed in this table, then do not change the value of that parameter.”
也就是說如果已有的參數值大於文檔中推薦的最低值,那麼可以不做改動。
2. 包括官方文檔,還有網上一些實戰貼,都提到了可以修改Shell Limits限制以提高效率。那這是為什麼呢?
一般我們需要新增設定的是oracle安裝賬戶對應的nproc和nofile取值,通常還有hard和soft之分,那他們究竟代表什麼呢?
其實從/etc/security/limits.conf檔案的注釋資訊就可以得出一些答案:
(1) 格式<domain> <type> <item> <value>,
其中<domain>可以是使用者名稱、組名,萬用字元*表示預設所有,萬用字元%表示模糊比對的選項。
<type>有soft和hard之分,soft表示當前系統生效的設定值,hard表示系統最大可接受的設定值。
<item>則有很多項,例如core、stack、nofile、nproc等,nofile表示最大可開啟的檔案數量,nproc表示最大進程數量。
3. 配置賬戶環境變數時,有些文章寫的非常多,即使是PATH、LD_LIBRARY_PATH,可能不同人安裝時都載入的不同,確實比較有迷惑性。但實際上,就我個人看來,比較重要的有:ORACLE_HOME、ORACLE_SID、ORACLE_BASE,如果用到一些sqlplus這些命令列工具,那麼PATH中添加對應的工具bin路徑也是必不可少的,LD_LIBRARY_PATH、CLASSPATH等變數中會有一些庫的路徑,另外,NLS_LANG則表示了當前的語言環境,其他選項可能未必是必選,我列出了我添加的部分profile內容:
4. 啟動Oracle安裝圖形介面時,有些安裝文章往往說需要DISPLAY參數等,但至少應該用的是“xhost +”,xhost用來控制X Server存取權限的,通常用hostA登入到hostB執行應用程式時,對應用程式來說,hostA是client,但此時安裝圖形介面,是在hostB上顯示,因此需要hostA上先運行xhost +,允許任何其他使用者能訪問hostA的X Server,或者使用xhost +ip,指定ip上的使用者才可以訪問。當然,以上操作都是建立在使用root賬戶切換到oracle安裝賬戶的情境,例如:
root賬戶執行xhost +
su - oracle
oracle賬戶執行./runInstaller
如果直接使用oracle賬戶登入執行安裝,則可能不用如上操作。
5. 我開始使用的是MOS上面提供的11.2.0.4安裝包安裝,但執行./runInstaller後,沒有提示任何錯誤,包括日誌,但就是沒顯示圖形介面,等半天,於是換回了原來的11.2.0.1,搜了一下,有人和我的經曆比較相像,他的原因是安裝介質損壞,這可能需要再下載一次11.2.0.4的安裝介質,比較一下大小才能確定了,但早期版本可以使用,至少說明平台不是問題,也許就出在安裝介質中,這個暫時存疑。
6. 安裝資料庫時,會提示配置EM,但前提是需要有一個監聽,我用netca配置了LISTENER預設監聽後,無論start、status、stop,都提示:
以及Linux Error: 104: Connection reset by peer。
查了很多地方都沒有找到原因,後來根據網上的一篇文章,介紹了一篇MOS的文章(343295.1),指出類似“Linux Error: 104: Connection reset by peer”的錯誤,往往發生在新安裝的過程中,並且提出了三種可能的原因:
1. There is possibly an incorrect IP Address specified for the host in the /etc/hosts file.
For example:
192.168.101.101 prod1.us.oracle.com prod1
Whereas the actual ip address for the host "prod1.us.oracle.com" is 192.168.101.110
2. Also, the localhost reference may be incorrect or missing from the /etc/hosts file.
3. Oracle may not have read access to /etc/nsswitch.conf file.
對應的方法有:
1. Correct the mapping in the /etc/hosts file by adding/correcting the IP address and/or hostname reference for the Unix/Linux Server (both long and short host names).
For example:
# Add or edit the /etc/hosts file to include a valid entry for the Server:
192.168.101.110 prod1.us.oracle.com prod1
2. Check that the localhost loopback name and address are correct (both long and short host names).
An example of a correct localhost entry would be as follows:
127.0.0.1 localhost.localdomain localhost
3. Remember to save the /etc/hosts file and then start the listener.
4. Check permissions on /etc/nsswitch.conf file to ensure group and other have read access.
- If necessary change permisions on /etc/nsswitch.conf as follows:
chmod 644 /etc/nsswitch.conf
在我的安裝中,原先listener.ora使用的是HOST=hostname,後來改為實際IP,也是報錯,根據上面提到的第一、二點,查看/etc/hosts,存在ip和hostname的對應,但沒有127.0.0.1 localhost的這行,被注釋了。
#127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.27.19.56 dcsopenNode1.localdomain dcsopenNode1
於是,開啟注釋,重啟監聽,一切正常。
至於第三點,沒做過研究。
總結:
以上主要說明了本次安裝過程中碰到的一些問題點,包括核心參數設定值、limits.conf檔案、環境變數、監聽啟動失敗等。