介绍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。
选择当时安装的Oracle的Software的路径名称,这里是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上的软件卸载出现了错误,而racnode2和racnode3卸载成功。
但是当前节点就是racnode1,而且通过操作系统上检查ORACLE_HOME,发现racnode1和racnode3上已经被成功卸载,而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被保留,而节点1和3被清除。
那么为什么当前节点racnode1被当作racnode2呢,这是由于当时创建RAC环境后,racnode1上的Oracle安装目录所在磁盘损坏,为了更快的恢复RAC环境,当时将racnode2的ORACLE_HOME目录整个打包,拷贝到racnode1上,当时改了一个CLUSTERWARE上的一个配置,使得RAC服务可以正常的启动,但是ORAINVENTORY等其他的配置并没有修改,因此Oracle的RAC可以正常运行,但是使用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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/4227/viewspace-669968/