Oracle RAC 10g for Solaris環境解除安裝(一)

yangtingkun發表於2010-08-01

介紹RAC環境的安裝的文章很多,但是介紹RAC環境解除安裝的並不多見,如果RAC環境解除安裝的不徹底,很可能會影響RAC環境的再次搭建。

這一篇介紹資料庫的刪除和資料庫軟體的解除安裝。

 

 

這是一個三節點的RAC環境,資料庫版本是10.2.0.3

SQL> SELECT * FROM V$VERSION;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bi
PL/SQL Release 10.2.0.3.0 - Production
CORE    10.2.0.3.0      Production
TNS for Solaris: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production

SQL> SELECT INSTANCE_NUMBER, INSTANCE_NAME, HOST_NAME, STATUS
  2  FROM GV$INSTANCE;

INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME  STATUS
--------------- ---------------- ---------- ------------
              1 testrac1         racnode1   OPEN
              3 testrac3         racnode3   OPEN
              2 testrac2         racnode2   OPEN

SQL> SELECT NAME FROM V$DATABASE;

NAME
---------
TESTRAC

首先關閉資料庫和監聽:

bash-2.03$ srvctl stop db -d testrac
bash-2.03$ srvctl stop listener -n racnode1
bash-2.03$ srvctl stop listener -n racnode2
bash-2.03$ srvctl stop listener -n racnode3

確認沒有資料庫服務啟動:

bash-2.03$ srvctl status service -d testrac
Service PRE_TESTRAC is not running.
Service mytest is not running.

根據需要,可以選擇是否使用DBCA刪除資料庫。使用圖形方式刪除Oracle資料庫非常簡單。

下面關閉ASM例項:

bash-2.03$ srvctl stop asm -n racnode1
bash-2.03$ srvctl stop asm -n racnode2
bash-2.03$ srvctl stop asm -n racnode3

然後可以利用runInstaller來解除安裝Oracle資料庫軟體:

$ cd $ORACLE_HOME/oui/bin
$ ./runInstaller
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2010-04-22_05-00-41PM. Please wait ...$ Oracle Universal Installer, Version 10.2.0.3.0 Production
Copyright (C) 1999, 2006, Oracle. All rights reserved.

在圖形介面上選擇Deinstall Products

選擇當時安裝的OracleSoftware的路徑名稱,這裡是OraDb10g_home1,然後點選Remove

Oracle會彈出所有解除安裝的元件,點選確認後開始刪除。

Oracle軟體的刪除過程出了一個錯誤,似乎是刪除遠端節點的軟體時的報錯,檢查$ORACLE_BASE/oraInventory/log目錄,找到對應的trace檔案,發現了下面的資訊:

INFO: Running command '/tmp/OraInstall2010-04-22_05-00-41PM/oui/bin/runInstaller -jreLoc ../../jre -paramFile /tmp/OraInstall2010-04
-22_05-00-41PM/oui/clusterparam.ini  -silent -ignoreSysPrereqs -removeHome -noClusterEnabled ORACLE_HOME=/data/oracle/product/10.2/d
atabase LOCAL_NODE=racnode3 -remoteInvocation -invokingNodeName racnode2 -logFilePath "/data/oracle/oraInventory/logs" -timestamp 20
10-04-22_05-00-41PM' on the nodes 'racnode3'.
INFO: Invoking OUI on cluster nodes racnode3
INFO: /tmp/OraInstall2010-04-22_05-00-41PM/oui/bin/runInstaller -jreLoc ../../jre -paramFile /tmp/OraInstall2010-04-22_05-00-41PM/ou
i/clusterparam.ini  -silent -ignoreSysPrereqs -removeHome -noClusterEnabled ORACLE_HOME=/data/oracle/product/10.2/database LOCAL_NOD
E=racnode3 -remoteInvocation -invokingNodeName racnode2 -logFilePath "/data/oracle/oraInventory/logs" -timestamp 2010-04-22_05-00-41
PM
SEVERE: Remote 'RemoveHome' failed on nodes: 'racnode1'. Refer to '/data/oracle/oraInventory/logs/installActions2010-04-22_05-00-41P
M.log' for details.
You can manually re-run the following command on the failed nodes after the installation:
 /data/oracle/product/10.2/database/oui/bin/solaris/runInstaller -removeHome -noClusterEnabled ORACLE_HOME=/data/oracle/product/10.2
/database LOCAL_NODE=.
INFO: User Selected: Yes/OK

INFO: The flags set for this home (/data/oracle/product/10.2/crs) are:clean
INFO: Home:/data/oracle/product/10.2/crs oraclehomeproperties.xml is not saved because the flags indicate no changes to this file.
INFO: The flags set for this home (/data/oracle/product/10.2/database) are:localnode|nodelist|removed
INFO: Home:/data/oracle/product/10.2/database oraclehomeproperties.xml is not saved because the flags indicate no changes to this fi
le.
INFO: Saving serialized component list for /data/oracle/product/10.2/database
INFO: Updating XML inventory.
INFO: Current Inventory:
        Oracle Home: OraCrs10g_home1
                This Oracle Home has not been changed in this session.

INFO: This deinstallation was successful

根據錯誤資訊,節點racnode1上的軟體解除安裝出現了錯誤,而racnode2racnode3解除安裝成功。

但是當前節點就是racnode1,而且透過作業系統上檢查ORACLE_HOME,發現racnode1racnode3上已經被成功解除安裝,而racnode2上沒有被解除安裝。

再次檢查log資訊,發現:

Configuration assistant "Oracle Net Configuration Assistant - Deinstall Script" succeeded
INFO: All the tools have been executed Successfully
INFO: Beginning deinstalls
INFO: Setting variable 'ORACLE_HOME' to '/data/oracle/product/10.2/database'. Received the value from a code block.
INFO: Setting variable 'CLUSTER_NODES' to 'racnode1,racnode2,racnode3'. Received the value from a code block.
INFO: Local node 'racnode2' is derived from the Oracle home properties.
INFO: Setting variable 'LOCAL_NODE' to 'racnode2'. Received the value from a code block.
INFO: Setting variable 'REMOTE_NODES' to 'racnode1,racnode3'. Received the value from a code block.
m_asNodeArray:racnode2,racnode1,racnode3
m_sLocalNode:racnode2
INFO: Deinstalling  Oracle Database 10g Patch 10.2.0.3.0
INFO: Setting variable 'ORACLE_HOME' to '/data/oracle/product/10.2/database'. Received the value from a code block.
INFO: Deinstalling  Oracle Database 10g 10.2.0.1.0
INFO: Calling Action fileActions10.2.0.0.0  createDirRecurse
        destination = /data/oracle/product/10.2/database/oc4j/opmn/lib
        selectedNodes = null
        permissions = null
        wner = null
        group = null

發現Oracle認為當前節點是racnode2,因此當前節點和racnode3被清除。這就解釋了為什麼節點2被保留,而節點13被清除。

那麼為什麼當前節點racnode1被當作racnode2呢,這是由於當時建立RAC環境後,racnode1上的Oracle安裝目錄所在磁碟損壞,為了更快的恢復RAC環境,當時將racnode2ORACLE_HOME目錄整個打包,複製到racnode1上,當時改了一個CLUSTERWARE上的一個配置,使得RAC服務可以正常的啟動,但是ORAINVENTORY等其他的配置並沒有修改,因此OracleRAC可以正常執行,但是使用DBCA解除安裝軟體的時候,當前節點被錯誤的認為是racnode2

根據Oracle提供的命令,在racnode2上執行:

bash-2.03$ /data/oracle/product/10.2/database/oui/bin/solaris/runInstaller -removeHome -noClusterEnabled ORACLE_HOME=/data/oracle/product/10.2/database LOCAL_NODE=racnode2
bash: /data/oracle/product/10.2/database/oui/bin/solaris/runInstaller: No such file or directory
bash-2.03$ /data/oracle/product/10.2/database/oui/bin/runInstaller -removeHome -noClusterEnabled ORACLE_HOME=/data/oracle/product/10.2/database LOCAL_NODE=racnode2
Starting Oracle Universal Installer...

No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
The inventory pointer is located at /var/opt/oracle/oraInst.loc
The inventory is located at /data/oracle/oraInventory
'RemoveHome' was successful.

這樣,Oracle的軟體就被成功的解除安裝。

 

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

相關文章