删除Oracle 10gR2 RAC节点(原创)

一.关闭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

也可以采用手工方式删除OCR信息

# ./srvctl remove  nodeapps -n rac3
++++ 将信息crs中3节点的资源信息从ocr中清除 ++++
# ./crs_unregister ora.rac3.LISTENER_CALLRAC2.lsnr
# ./crs_unregister ora.rac3.ASM2.asm
# ./crs_unregister ora.rac3.gsd
# ./crs_unregister ora.rac3.ons
# ./crs_unregister ora.rac3.vip

七:在节点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
也可以采用dbca图形界面的方式进行删除

$ dbca &
Screen Name Response
Welcome Screen Select Oracle Real Application Clusters database.
Operations Select Instance Management.
Instance Management Select Delete an instance.
List of cluster databases Provides a list of clustered databases running on the node. For the purpose of this example, the clustered database running on node linux1 is orcl. Select this clustered database.

At the bottom of this screen, the DBCA requests you to "Specify a user with SYSDBA system privileges":

    Username: sys
    Password: <sys_password>

Click Next to continue.

List of cluster
database instances
This screen provides a list of all instances currently available on the cluster, their status, and which node they reside on.

Select the node:instance to delete (linux3:orcl3) and Click Next to continue.

Database Services If the current clustered database has any database services defined, the next screen allows the DBA to re-configure those database services to account for the instance being removed. In this example, the existing clustered database has one service defined named orcl_taf. With the "orcl_taf" database service selected, change the details to Not used for the instance to be removed (orcl3) and leave the "TAF Policy" set to Basic.

Click Finish to remove the instance.

Database Configuration
Assistant: Summary
After verifying the instance removal options in the summary dialog, Click OK to begin the instance management process.
Database Configuration Assistant A second dialog box is presented which includes the warning:

"The Database Configuration Assistance will delete the Oracle instance and its associated OFA directory structure. All information about this instance will be deleted. Do you want to proceed?"

Click OK to acknowledge this dialog.

Database Configuration Assistant
Progress Screen
A progress bar is display while the instance is being deleted. Once the instance management process is complete, the DBCA prompts the user with a dialog and the message "Do you want to perform another operation?" Click No to end and exit the DBCA utility.

参考至:http://ylw6006.blog.51cto.com/470441/731563

             http://www.idevelopment.info/data/Oracle/DBA_tips/Oracle10gRAC/CLUSTER_23.shtml

             http://www.killdb.com/2011/09/27/linux-rac-delete-node%E5%B0%8F%E8%AE%B0.html

 本文原创,转载请注明出处、作者

如有错误,欢迎指正

邮箱:[email protected]

猜你喜欢

转载自czmmiao.iteye.com/blog/2059092