在前面的两篇文章中,演示了如何向rac环境中添加一个新的节点,集群除了兼备负载均衡,故障转移的特点外,更应该有易于扩展和收缩的属性;本文中讲演示如何将之前添加的节点3彻底删除,使用的数据库版本和操作系统版本均和前面添加节点所使用的环境一致!如何添加节点,请参考下面两篇文章:
http://ylw6006.blog.51cto.com/470441/730519
http://ylw6006.blog.51cto.com/470441/730564
一:关闭rac3节点的数据库实例和ASM实例
[oracle@rac1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
ora....SM3.asm application 0/5 0/0 ONLINE ONLINE rac3
ora....C3.lsnr application 0/5 0/0 ONLINE ONLINE rac3
ora.rac3.gsd application 0/5 0/0 ONLINE ONLINE rac3
ora.rac3.ons application 0/3 0/0 ONLINE ONLINE rac3
ora.rac3.vip application 0/0 0/0 ONLINE ONLINE rac3
ora.racdb.db application 0/1 0/1 ONLINE ONLINE rac1
ora....b1.inst application 0/5 0/0 ONLINE ONLINE rac1
ora....b2.inst application 0/5 0/0 ONLINE ONLINE rac2
ora....b3.inst application 0/5 0/0 ONLINE ONLINE rac3
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2
Instance racdb3 is running on node rac3
[oracle@rac1 ~]$ srvctl stop instance -d racdb -i racdb3 -o immediate
[oracle@rac1 ~]$ srvctl status asm -n rac3
ASM instance +ASM3 is running on node rac3.
[oracle@rac1 ~]$ srvctl stop asm -n rac3
|
二:修改spfile文件的相关参数
[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Dec 1 19:06:58 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> show parameter spfile;
NAME TYPE VALUE
--------- ------- -----------------------
spfile string +DATA/racdb/spfileracdb.ora
SQL> select name,value from v$spparameter where sid='racdb3';
NAME VALUE
-------------------- --------------------
thread 3
instance_number 3
undo_tablespace UNDOTBS3
SQL> alter system reset thread scope=spfile sid='racdb3';
System altered.
SQL> alter system reset instance_number scope=spfile sid='racdb3';
System altered.
SQL> alter system reset undo_tablespace scope=spfile sid='racdb3';
System altered.
SQL> alter system reset service_names scope=spfile sid='racdb3';
alter system reset service_names scope=spfile sid='racdb3'
*
ERROR at line 1:
ORA-32010: cannot find entry to delete in SPFILE
SQL> alter system reset local_listener scope=spfile sid='racdb3';
alter system reset local_listener scope=spfile sid='racdb3'
*
ERROR at line 1:
ORA-32010: cannot find entry to delete in SPFILE
SQL> select sid,name,value from v$spparameter where name='cluster_database_instances';
SID NAME VALUE
---------- ---------------------------------------- --------------------
* cluster_database_instances 2
|
三:关闭rac3节点的监听器并验证
[oracle@rac1 ~]$ srvctl stop listener -n rac3
[oracle@rac1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
ora....SM3.asm application 0/5 0/0 OFFLINE OFFLINE
ora....C3.lsnr application 0/5 0/0 OFFLINE OFFLINE
ora.rac3.gsd application 0/5 0/0 ONLINE ONLINE rac3
ora.rac3.ons application 0/3 0/0 ONLINE ONLINE rac3
ora.rac3.vip application 0/0 0/0 ONLINE ONLINE rac3
ora.racdb.db application 0/1 0/1 ONLINE ONLINE rac1
ora....b1.inst application 0/5 0/0 ONLINE ONLINE rac1
ora....b2.inst application 0/5 0/0 ONLINE ONLINE rac2
ora....b3.inst application 0/5 0/0 OFFLINE OFFLINE
|
四:使用srvctl工具删除rac3节点上的数据库实例和ASM实例
[oracle@rac1 ~]$ srvctl status database -d racdb
Instance racdb1 is running on node rac1
Instance racdb2 is running on node rac2
Instance racdb3 is not running on node rac3
[oracle@rac1 ~]$ srvctl remove instance -d racdb -i racdb3
Remove instance racdb3 from the database racdb? (y/[n]) y
[oracle@rac1 ~]$ srvctl status asm -n rac3
ASM instance +ASM3 is not running on node rac3.
[oracle@rac1 ~]$ srvctl remove asm -n rac3
[oracle@rac1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
ora....C3.lsnr application 0/5 0/0 OFFLINE OFFLINE
ora.rac3.gsd application 0/5 0/0 ONLINE ONLINE rac3
ora.rac3.ons application 0/3 0/0 ONLINE ONLINE rac3
ora.rac3.vip application 0/0 0/0 ONLINE ONLINE rac3
ora.racdb.db application 0/1 0/1 ONLINE ONLINE rac1
ora....b1.inst application 0/5 0/0 ONLINE ONLINE rac1
ora....b2.inst application 0/5 0/0 ONLINE ONLINE rac2
|
五:使用netca命令删除rac3节点上的监听器配置
[oracle@rac1 ~]$ netca
后台日志信息如下
Oracle Net Services Configuration:
rac3...
Deleted listener: LISTENER_RAC3
Oracle Net Services configuration successful. The exit code is 0
验证:
[oracle@rac1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
ora.rac3.gsd application 0/5 0/0 ONLINE ONLINE rac3
ora.rac3.ons application 0/3 0/0 ONLINE ONLINE rac3
ora.rac3.vip application 0/0 0/0 ONLINE ONLINE rac3
ora.racdb.db application 0/1 0/1 ONLINE ONLINE rac1
ora....b1.inst application 0/5 0/0 ONLINE ONLINE rac1
ora....b2.inst application 0/5 0/0 ONLINE ONLINE rac2
清除rac配置信息
[oracle@rac3 ~]$ cat $ORA_CRS_HOME/opmn/conf/ons.config
localport=6100
remoteport=6200
loglevel=3
useocr=on
[oracle@rac1 ~]$ racgons remove_config rac3:6200
|
六:在rac3节点上以root用户身份运行删除节点脚本
[root@rac3 ~]# cd /u01/app/oracle/product/10.2.0/crs_1/install
[root@rac3 install]# ./rootdelete.sh
CRS-0210: Could not find resource 'ora.rac3.LISTENER_RAC3.lsnr'.
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...
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'
|
备注:在清除rac节点前,需要利用netca来删除监听,否则会报错如下!
CRS resources for listeners are still configured. You must remove the CRS listener resources before deconfiging CRS stack. Use NETCA to remove them.
1
七:在节点1上更新OCR信息
[root@rac1 ~]# cd /u01/app/oracle/product/10.2.0/crs_1/install
[root@rac1 install]# ./rootdeletenode.sh rac3,3
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'.
CRS-0210: Could not find resource ora.rac3.vip.
CRS nodeapps are deleted successfully
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully deleted 14 values from OCR.
Key SYSTEM.css.interfaces.noderac3 marked for deletion is not there. Ignoring.
Successfully deleted 5 keys from OCR.
Node deletion operation successful.
'rac3,3' deleted successfully |
更新CRS:
[oracle@rac1 ~]$ cd $ORA_CRS_HOME/oui/bin
[oracle@rac1 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.
|
八:验证
[oracle@rac1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE rac1
ora....C1.lsnr application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.gsd application 0/5 0/0 ONLINE ONLINE rac1
ora.rac1.ons application 0/3 0/0 ONLINE ONLINE rac1
ora.rac1.vip application 0/0 0/0 ONLINE ONLINE rac1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE rac2
ora....C2.lsnr application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.gsd application 0/5 0/0 ONLINE ONLINE rac2
ora.rac2.ons application 0/3 0/0 ONLINE ONLINE rac2
ora.rac2.vip application 0/0 0/0 ONLINE ONLINE rac2
ora.racdb.db application 0/1 0/1 ONLINE ONLINE rac1
ora....b1.inst application 0/5 0/0 ONLINE ONLINE rac1
ora....b2.inst application 0/5 0/0 ONLINE ONLINE rac2
[oracle@rac1 ~]$ olsnodes -n
rac1 1
rac2 2
|
参考文章:
http://yangtingkun.itpub.net/post/468/495334
http://yangtingkun.itpub.net/post/468/495377
本文转自斩月博客51CTO博客,原文链接http://blog.51cto.com/ylw6006/731563如需转载请自行联系原作者
ylw6006