1. 程式人生 > >Oracle 11.2.0.4 RAC安裝資料庫軟體無法識別主機

Oracle 11.2.0.4 RAC安裝資料庫軟體無法識別主機

        下午同事發來微信說在裝Oracle 11.2.0.4的RAC時,GI已經正常安裝了。但在安裝資料庫軟體的時候,圖形介面不顯示兩臺主機的主機名,沒辦法繼續往下安裝。由於不在一起,於是百度相應的文章來看,但是相關的文章也不多。找到一篇https://blog.csdn.net/MFW333/article/details/71122990,說是inventory.xml檔案中缺少了CRS = TRUE。

        於是轉給同事去檢查,反饋的結果是配置檔案中是有這一項配置的:

image.png

        那問題出在哪裡了呢,看來不是百度一下就可以解決的。要來伺服器資訊,自己登入上去看。其實一開始我覺得是/etc/hosts或hostname配置有錯誤導致的,但是登入上去之後發現配置都沒有問題。於是自己執行./runInstaller實際看看,到了Grid Installation Options這一步時確是看不到主機的node name資訊。由於匆忙沒有截圖,同學們可以自己腦補一下就可以了。

        心想沒有node name資訊,看看日誌有沒有什麼報錯呢。但是很遺憾,沒有日誌。沒有日誌資訊,就看不到報錯;沒有報錯,問題就很難排查。那就想,我直接點選下一步看看會是什麼效果呢,結果出來了我想要的報錯資訊:[INS-08109] Unexpected error occurred while validating inputs at state 'nodeSelectionPage'.

image.png

        details里居然寫沒有多餘的資訊,讓聯絡support或查詢手冊。support是沒有的,那先去MOS上查查相關文件吧,還真有跟這個一模一樣的報錯資訊的文件。INS-08109 Unexpected error occurred While Validating Inputs At State 'nodeSelectionPage' (文件 ID 948382.1)。文件裡寫了7種原因會導致的這種問題,並給出瞭解決辦法

1. ORA_CRS_HOME environment variable is set

OUI calls $GRID_HOME/srvm/admin/getcrshome to get Grid Infrastructure home, if environment variable ORA_CRS_HOME is set to anything but GRID home, the error will be reported. In 11gR2, it's not supported to setup environment variable ORA_CRS_HOME.

The solution is to unset the environment variable and restart OUI.

unset ORA_CRS_HOME

 

2. Database user can not access olr.loc in /etc/oracle or /var/opt/oracle

OUI calls "crsctl query crs activersion" to get active version of clusterware. If it fails to read olr.loc (if grid and database are owned differently), the issue can happen. From strace/truss:

open("/etc/oracle/olr.loc", O_RDONLY) = -1 EACCES (Permission denied)

The solution is to ensure that 'oracle' user has read permission on olr.loc in /etc/oracle or /var/opt/oracle.

 

3. ORACLE_HOME environment variable not set to GRID_HOME

This problem will occur while installing 11.2.0.4 RAC RDBMS software in a 12c Grid Infrastructure environment.

The solution is to set ORACLE_HOME environment variable pointing to GRID_HOME before installing RDBMS software.

export ORACLE_HOME=<GRID_HOME>

4. Database user does not exist on all nodes

This problem will occur if database user does not exist on all nodes in the cluster. For example, 4-node cluster, trying to install a new RAC DB home on two nodes only so the new DB user is created on two nodes. The solution is to have the same DB user on all nodes.

 

5. NLS_LANG environment variable is set to Japanese_Japan.JA16SJIS etc

If NLS_LANG is set to "Japanese_Japan.JA16SJIS" etc, the issue will happen as output of "crsctl query crs activeversion" garbles.

The solution is to unset NLS_LANG.

 

 6. ORA_NLS10 environment variable is set

environment variable is not necessary for Oracle 11g/12c

 

7. Hostnames  in /etc/hosts are incorrect

This error is generated when trying to add new nodes into the cluster if the entries for the hostnames

in /etc/hosts is incorrect.


        看來看去,好像只有第二條比較符合我們當前遇到的問題,於是去機器看olr.loc的許可權情況

image.png

又執行了命令crsctl query crs activeversion,也是可以執行成功的。(這裡其實mos的文章裡寫錯了,activeversion寫成了activersion。)

image.png

再執行olsnode -n,也是可以識別到兩個節點

image.png

叢集也是正常狀態

image.png

        看起來也是有讀許可權的。那問題怎麼解決呢?又看了幾篇MOS上的文件,又百度了一些貼子,感覺一般別人遇到的問題就已經在上面7條裡已經列出來了。但我遇到的問題卻沒有列出來。難道又是BUG?想想應該不可能,這麼點小事就出BUG,那Oracle也不可能一下強大到現在。那問題到底出現在哪裡呢?

        其實這時我陷入到了思維定式裡了,把一些我認為不可能出問題的地方忽略掉了,恰恰這次出問題的,正是這個地方。

        其實還是許可權問題,只不過不只是olr.loc的許可權問題,而是整個oracle使用者的許可權問題。看了很多文章都說是許可權問題,我就想,那我看看oracle使用者配置的uid和所屬組吧,當我執行完id oracle命令看到結果時,瞬間明白了問題的根本原因,就是許可權問題。

image.png

        熟悉oracle的同學應該一眼就能看出來,這個oracle使用者配置的所屬組是完全錯的。這也就成了造成此次問題的關鍵。把oracle使用者刪掉重新建立,問題完美解決:

image.png

        寫這篇部落格,一個是給大家提供一個解決問題的思路,再一個就是提醒自己,不是“你以為的就是你以為的”,還是需要仔細的去驗證分析。