在做这个实验之前已经做了2个相关的实验,RAC的安装,RAC 添加节点。
Redhat 5.4 Oracle 10g RAC 添加节点
http://www.cndba.cn/Dave/article/1009
Redhat 5.4 + ASM + RAW+ Oracle 10g RAC 安装文档
http://www.cndba.cn/Dave/article/1010
现在的RAC环境是二个节点: RAC1,RAC2,RAC3。 这个实验就是删除节点RAC3。
服务器主机名 | rac1 | rac2 | rac3 |
公共IP地址(eth0) | 10.85.10.1 | 10.85.10.2 | 10.85.10.5 |
虚拟IP地址(eth0) | 10.85.10.3 | 10.85.10.4 | 10.85.10.6 |
私有IP地址(eth1) | 192.168.1.200 | 192.168.1.201 | 192.168.1.202 |
ORACLE RAC SID | rac1 | rac2 | Rac3 |
集群实例名称 | Rac | ||
OCR(oracle集群注册表) | /dev/raw/raw1 /dev/sdb1 200M /dev/raw/raw2 /dev/sdb2 200M | ||
表决磁盘(voting disk) | /dev/raw/raw3 /dev/sdc1 200M /dev/raw/raw4 /dev/sdc2 200M /dev/raw/raw5 /dev/sdc3 200M | ||
ASM | /dev/sdd1 10G VOL1 for Oracle Data /dev/sdd1 5G VOL2 for flash_recovery_area | ||
数据库备份 | /dev/sde1 10G (mkfs -t ext3 /dev/sde1) |
官网连接:
Adding and Deleting Oracle RAC from Nodes on Linux and UNIX Systems
http://download.oracle.com/docs/cd/E11882_01/rac.112/e16795/adddelunix.htm#RACAD0067
删除节点步骤如下:
1. 删除数据库实例
2. 删除ASM实例
3. 删除节点
在删除节点之前,要保证设置$ORA_CRS_HOME和$ORACLE_HOME环境变量是正确的。
一. DBCA删除DATABASE实例
1.1.1 先停掉rac 上的rac3实例的服务,然后用dbca删除实例。
[oracle@rac1 bin]$ crs_stop ora.rac.rac3.inst
1.1.2 用Xmanager 工具连上rac1,指定DISPLAY变量: export DISPLAY=10.85.10.80:0.0.
用Oracle 用户运行DBCA命令,在dbca的界面中选择:
Oracle Real Application Clusters database --> Instance Management
--> Delete an instance -->输入sys用户和密码 --> 选择要删除的实例 rac3 -- > servers: rac3 not use,TAF policy: none --> Finish 删除节点
1.1.3 执行完毕后查看服务情况:
[oracle@rac1 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac1
ora....oltp.cs application ONLINE ONLINE rac2
ora....ac1.srv application ONLINE ONLINE rac2
ora....ac2.srv application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac2
ora....c2.inst application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora....SM3.asm application ONLINE ONLINE rac3
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
这里面少了2个服务:ora.rac.oltp.rac3.srv 和 ora.rac.rac3.inst
关于命令具体参考我的Blog:
Oracle RAC 常用维护工具和命令
http://www.cndba.cn/Dave/article/1015
二 . 删除ASM 实例
这里需要删除该节点中的asm实例,以及注册到crs中的相关信息,操作如下:
2.1 停止并删除ASM实例,在任意节点操作都可以
[oracle@rac1 bin]$ pwd
/u01/app/oracle/product/crs/bin
[oracle@rac1 bin]$ srvctl stop asm -n rac3
[oracle@rac1 bin]$ srvctl remove asm -n rac3
上述两个命令行正确执行后,目标节点的asm实例就已经被删除了。
也可以加-f 参数,如:srvctl remove asm -n rac3 -f
清除OCR中的信息,可以使用crs_unregister 命令。
2.2 验证
[oracle@rac1 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac1
ora....oltp.cs application ONLINE ONLINE rac2
ora....ac1.srv application ONLINE ONLINE rac2
ora....ac2.srv application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac2
ora....c2.inst application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora....C3.lsnr application ONLINE ONLINE rac3
ora.rac3.gsd application ONLINE ONLINE rac3
ora.rac3.ons application ONLINE ONLINE rac3
ora.rac3.vip application ONLINE ONLINE rac3
这里少了 rac3 asm 实例的服务
2.3 删除相关目录
用目录删除asm实例后,但是asm相关目录没有删除,我们需要手动的删除相关目录,如果没有删除干净,下一次dbca 创建实例的时候会报错。
彻底删除ASM的步骤:
1,关闭掉使用asm 实例的oracle实例(请在所有的rac节点执行)
2,删除掉asm diskgroup并关闭asm实例
3,删除/etc/oratab文件对应的+ASM记录
4,删除$ORACLE_BASE/admin/+ASM[1-2]下面的a|b|c|u dump目录
5,删除$ORACLE_HOME/dbs下面与asm有关的文件
ASM 的相关信息参考blog:
Oracle ASM 详解
http://www.cndba.cn/Dave/article/1024
三. 删除节点
3.1删除目标节点监听服务
先通过netca删除目标节点中的监听服务,用xmanager随便连一个节点,如rac1,指定DISPLAY=10.85.10.80:0.0;然后运行netca命令,会出现一个可是话界面,都是下一步操作,删除rac3 这个节点上的监听即可。
删除之后,从crs_stat 看以少了一个服务:
[oracle@rac1 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac1
ora....oltp.cs application ONLINE ONLINE rac2
ora....ac1.srv application ONLINE ONLINE rac2
ora....ac2.srv application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac2
ora....c2.inst application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
ora.rac3.gsd application OFFLINE OFFLINE
ora.rac3.ons application OFFLINE OFFLINE
ora.rac3.vip application OFFLINE OFFLINE
3.2 删除目标结点数据库软件
3.2.1 在保留的任意一个结点上执行如下命令,更新Oracle Inventory
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=rac1,rac2"
如:
[oracle@rac1 ~]$ cd /u01/app/oracle/product/10.2.0/db_1/oui/bin/
[oracle@rac1 bin]$ runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=rac1,rac2"
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
'UpdateNodeList' was successful.
3.2.2 在要被删除的节点(rac3)上执行下列命令,同样是更新Oracle Inventory:
$ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=rac3" -local
如:
[oracle@rac3 dbs]$ $ORACLE_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORACLE_HOME "CLUSTER_NODES=rac3" -local
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
'UpdateNodeList' was successful.
3.2.3 删除rac3节点上的数据库软件
用Xmanager工具连接到rac3 节点,执行如下命令:
$ORACLE_HOME/oui/bin/runInstaller -deinstall
注意指定DISPLAY变量。
在弹出的窗口勾上ORACLE_HOME, 然后删除。
注意:
这里也可以在非图形界面执行删除操作,只要在执行runInstall命令时,附加-silent参数即可。该服务器如果不准备再安装ORACLE数据库的话,可以同时删除/etc/oratab文件。
使用非图形界面命令:
runInstaller -deinstall -silent "REMOVE_HOMES={ OraDb10g_home1 }"
3.3 停止目标节点NodeApps
停止目标节点中的应用,可以在任意节点上操作,执行命令如下:
[oracle@rac1 bin]$ srvctl stop nodeapps -n rac3
3.4 删除NodeApps
NodeApps包括GSD、ONS、VIP等应用,删除这些应用可以通过srvctl命令,在rac3节点上操作,注意要以root身份执行:
[root@rac3 ~]# cd /u01/app/oracle/product/crs/bin/
[root@rac3 bin]# ./srvctl remove nodeapps -n rac3
Please confirm that you intend to remove the node-level applications on node rac3 (y/[n]) y
[root@rac3 bin]#
执行完上述命令后,执行crs_stat查看当前应用的状态:
[oracle@rac2 bin]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac.db application ONLINE ONLINE rac3
ora....oltp.cs application ONLINE ONLINE rac2
ora....ac1.srv application ONLINE ONLINE rac2
ora....ac2.srv application ONLINE ONLINE rac1
ora....c1.inst application ONLINE ONLINE rac2
ora....c2.inst application ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
在结果中已经看不到rac3节点的信息了。
3.5删除ONS配置
在保留节点执行:
[oracle@rac2 bin]$ oifcfg delif -node rac3
在删除节点,查询目标节点的ONS端口号:
[oracle@rac3 bin]$ more $ORA_CRS_HOME/opmn/conf/ons.config
localport=6113
remoteport=6200
loglevel=3
useocr=on
在任意保留节点中执行racgons命令,删除ONS配置:
[oracle@rac2 bin]$ $ORA_CRS_HOME/bin/racgons remove_config rac3:6200
racgons: Existing key value on rac3 = 6200.
racgons: rac3:6200 removed from OCR.
3.6在删除节点rac3禁用Oracle集群应用:
要用root用户执行如下脚本:
$ORA_CRS_HOME/install/rootdelete.sh
[root@rac3 ~]# cd /u01/app/oracle/product/crs
[root@rac3 crs]# cd install
[root@rac3 install]# sh rootdelete.sh
CRS-0210: Could not find resource 'ora.rac3.LISTENER_RAC3.lsnr'.
CRS-0210: Could not find resource 'ora.rac3.ons'.
CRS-0210: Could not find resource 'ora.rac3.vip'.
CRS-0210: Could not find resource 'ora.rac3.gsd'.
Shutting down Oracle Cluster Ready Services (CRS):
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
Shutdown has begun. The daemons should exit soon.
Checking to see if Oracle CRS stack is down...
Oracle CRS stack is not running.
Oracle CRS stack is down now.
Removing script for Oracle Cluster Ready services
Updating ocr file for downgrade
Cleaning up SCR settings in '/etc/oracle/scls_scr'
3.7 从集群中删除节点并更新OCR
从集群中删除节点并更新OCR(保留节点运行)
$ORA_CRS_HOME/install/rootdeletenode.sh node1,node1-number,node2,node2-number,...
关于删除节点的ode-number可通过olsnodes -n获得:
[oracle@rac2 bin]$ ./olsnodes -n -i
rac2 1 rac2-vip
rac1 2 rac1-vip
rac3 3 <none>
我们这里要删除的是rac3,number 为3. 在保留节点,进入ORA_CRS_HOME,用root用户执行:
# ./rootdeletenode.sh rac3, 3
如:
[root@rac1 install]# pwd
/u01/app/oracle/product/crs/install
[root@rac1 install]# ./rootdeletenode.sh rac3 3
CRS nodeapps are deleted successfully
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Node deletion operation successful.
'rac3' deleted successfully
3.8 删除目标节点clusterware软件
先在任意保留的节点中操作:
[oracle@rac2 bin]$ $ORA_CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORA_CRS_HOME "CLUSTER_NODES=rac1,rac2" CRS=TRUE
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
'UpdateNodeList' was successful.
在删除节点,rac3执行更新Oracle Inventory的操作:
[oracle@rac3 install]$ $ORA_CRS_HOME/oui/bin/runInstaller -updateNodeList ORACLE_HOME=$ORA_CRS_HOME "CLUSTER_NODES=rac3" CRS=TRUE -local
Starting Oracle Universal Installer...
No pre-requisite checks found in oraparam.ini, no system pre-requisite checks will be executed.
'UpdateNodeList' was successful.
在删除节点rac3上,用Xmanager工具执行runInstaller -deinstall命令:
[oracle@rac3 ~]$ $ORA_CRS_HOME/oui/bin/runInstaller -deinstall
Starting Oracle Universal Installer...
弹出窗口如下,选中crs路径,然后点击remove即可。
操作完成后,点击close关闭窗口。集群件软件就被成功从目标节点删除了。
但是还有一些目录可以清除,包括:
删除$ORACLE_BASE/oraInventory目录
删除/etc/inittab文件
删除/var/tmp/.oracle目录
删除ORA相关的启动关闭脚本,比如/etc/init.d/init*,以及/etc/rc?.d/*init.crs等文件
删除/etc/oracle目录
清除crontab中关于ORACLE的相关任务;
清除oracle用户下profile中关于ORA的相关环境变量设置;
------------------------------------------------------------------------------
QQ: 492913789
Email: ahdba@qq.com
Blog: http://www.cndba.cn/dave
网上资源: http://tianlesoftware.download.csdn.net
相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx
DBA1 群:62697716(满); DBA2 群:62697977(满)
DBA3 群:63306533; 聊天 群:40132017
--加群需要在备注说明SGA的组成部分,否则拒绝申请