Oracle Product集群因OS需要打patch需要单独关闭节点进行维护,机器为个人测试Oracle 11g R2测试集群
操作步骤
--确认集群的db_unique_name,本初的db_unique_name为orcl
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string
db_name string orcl
db_unique_name string orcl
global_names boolean FALSE
instance_name string orcl2
lock_name_space string
log_file_name_convert string
processor_group_name string
service_names string orcl
--确认集群的instance_name
SQL> select instance_name,status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
orcl2 OPEN
orcl1 OPEN
#本处的两个实例名为orcl1 和 orcl2
--关闭node1监听,确保应用无法通过监听连接数据库
[grid@oranode1 ~]$ srvctl stop listener -n oranode1
#使用crs_stat -t -v命令或者使用srvctl status listener命令检查监听运行情况
[grid@oranode1 ~]$ srvctl status listener -n oranode1
Listener LISTENER is enabled on node(s): oranode1
Listener LISTENER is not running on node(s): oranode1
[grid@oranode2 ~]$ srvctl status listener -n oranode2
Listener LISTENER is enabled on node(s): oranode2
Listener LISTENER is running on node(s): oranode2
#确保关闭前实例上没有session在执行,如果有停机窗口的话建议杀一次local=no的会话
[oracle@oranode1 ~]$ ps -ef |grep -i local=no |wc -l
1
[oracle@oranode1 ~]$ ps -ef |grep -i local=no |cut -c 10-15|xargs kill -9
kill 7803: No such process
--关闭集群节点一上的数据库实例
[grid@oranode1 ~]$ srvctl stop instance -o immediate -d orcl -i orcl1
[oracle@oranode1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Apr 13 12:41:30 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
#确保数据库实例已经被关闭
[grid@oranode1 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....DISK.dg ora....up.type 0/5 0/ ONLINE ONLINE oranode1
ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE oranode1
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE oranode2
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE oranode2
ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE oranode1
ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE oranode2
ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE oranode1
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE oranode2
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE oranode1
ora....SM1.asm application 0/5 0/0 ONLINE ONLINE oranode1
ora....E1.lsnr application 0/5 0/0 OFFLINE OFFLINE
ora....de1.gsd application 0/5 0/0 OFFLINE OFFLINE
ora....de1.ons application 0/3 0/0 ONLINE ONLINE oranode1
ora....de1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE oranode1
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE oranode2
ora....E2.lsnr application 0/5 0/0 ONLINE ONLINE oranode2
ora....de2.gsd application 0/5 0/0 OFFLINE OFFLINE
ora....de2.ons application 0/3 0/0 ONLINE ONLINE oranode2
ora....de2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE oranode2
ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE oranode2
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE oranode1
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE oranode2
#可以看到,未关闭集群节点一上的实例前,ora.orcl.db的服务是在节点一上,关闭节点一的数据库实例后,ora.orcl.db已经飘在了节点二上了。
#或者使用srvctl status database 命令检查
[grid@oranode1 ~]$ srvctl status database -d orcl
Instance orcl1 is not running on node oranode1
Instance orcl2 is running on node oranode2
--关闭集群节点一的ASM服务
[grid@oranode1 ~]$ srvctl stop asm -n oranode1
PRCR-1014 : Failed to stop resource ora.asm
PRCR-1065 : Failed to stop resource ora.asm
CRS-2529: Unable to act on 'ora.asm' because that would require stopping or relocating 'ora.CLUSTER_DISK.dg', but the force option was not specified
#此处关闭asm实例在报错,由于ora.CLUSTER_DISK的存在,指明此需要强制指定参数-f才能关闭ASM.此处如果是执行-f参数的话将会已shutdown abort的方式强制关闭数据库,生产环境上执行此命令有风险
--#11Gr2下,ASM是cssd下管理的,需要把cssd关闭后,才能关闭ASM服务
--切换到root下执行crsctl stop crs的方式关闭整个集群节点一的CRS服务
[root@oranode1 ~]# find / -name crsctl
/u01/app/11.2.0/grid/bin/crsctl
[root@oranode1 ~]# /u01/app/11.2.0/grid/bin/crsctl stop crs
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'oranode1'
CRS-2673: Attempting to stop 'ora.crsd' on 'oranode1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'oranode1'
CRS-2673: Attempting to stop 'ora.CLUSTER_DISK.dg' on 'oranode1'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'oranode1'
CRS-2673: Attempting to stop 'ora.DATA.dg' on 'oranode1'
CRS-2673: Attempting to stop 'ora.oranode1.vip' on 'oranode1'
CRS-2677: Stop of 'ora.oranode1.vip' on 'oranode1' succeeded
CRS-2672: Attempting to start 'ora.oranode1.vip' on 'oranode2'
CRS-2677: Stop of 'ora.registry.acfs' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.DATA.dg' on 'oranode1' succeeded
CRS-2676: Start of 'ora.oranode1.vip' on 'oranode2' succeeded
CRS-2677: Stop of 'ora.CLUSTER_DISK.dg' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'oranode1'
CRS-2677: Stop of 'ora.asm' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.ons' on 'oranode1'
CRS-2677: Stop of 'ora.ons' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.net1.network' on 'oranode1'
CRS-2677: Stop of 'ora.net1.network' on 'oranode1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 'oranode1' has completed
CRS-2677: Stop of 'ora.crsd' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.crf' on 'oranode1'
CRS-2673: Attempting to stop 'ora.ctssd' on 'oranode1'
CRS-2673: Attempting to stop 'ora.evmd' on 'oranode1'
CRS-2673: Attempting to stop 'ora.asm' on 'oranode1'
CRS-2673: Attempting to stop 'ora.drivers.acfs' on 'oranode1'
CRS-2673: Attempting to stop 'ora.mdnsd' on 'oranode1'
CRS-2677: Stop of 'ora.crf' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.mdnsd' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.asm' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'oranode1'
CRS-2677: Stop of 'ora.drivers.acfs' on 'oranode1' succeeded
CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'oranode1'
CRS-2677: Stop of 'ora.cssd' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.gipcd' on 'oranode1'
CRS-2677: Stop of 'ora.gipcd' on 'oranode1' succeeded
CRS-2673: Attempting to stop 'ora.gpnpd' on 'oranode1'
CRS-2677: Stop of 'ora.gpnpd' on 'oranode1' succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'oranode1' has completed
CRS-4133: Oracle High Availability Services has been stopped.
#可以看到,CRS命令执行输出,节点一的cluster服务已经完全飘在了节点二上。
[grid@oranode2 ~]$ crs_stat -t -v
Name Type R/RA F/FT Target State Host
----------------------------------------------------------------------
ora....DISK.dg ora....up.type 0/5 0/ ONLINE ONLINE oranode2
ora.DATA.dg ora....up.type 0/5 0/ ONLINE ONLINE oranode2
ora....ER.lsnr ora....er.type 0/5 0/ ONLINE ONLINE oranode2
ora....N1.lsnr ora....er.type 0/5 0/0 ONLINE ONLINE oranode2
ora.asm ora.asm.type 0/5 0/ ONLINE ONLINE oranode2
ora.cvu ora.cvu.type 0/5 0/0 ONLINE ONLINE oranode2
ora.gsd ora.gsd.type 0/5 0/ OFFLINE OFFLINE
ora....network ora....rk.type 0/5 0/ ONLINE ONLINE oranode2
ora.oc4j ora.oc4j.type 0/1 0/2 ONLINE ONLINE oranode2
ora.ons ora.ons.type 0/3 0/ ONLINE ONLINE oranode2
ora....de1.vip ora....t1.type 0/0 0/0 ONLINE ONLINE oranode2
ora....SM2.asm application 0/5 0/0 ONLINE ONLINE oranode2
ora....E2.lsnr application 0/5 0/0 ONLINE ONLINE oranode2
ora....de2.gsd application 0/5 0/0 OFFLINE OFFLINE
ora....de2.ons application 0/3 0/0 ONLINE ONLINE oranode2
ora....de2.vip ora....t1.type 0/0 0/0 ONLINE ONLINE oranode2
ora.orcl.db ora....se.type 0/2 0/1 ONLINE ONLINE oranode2
ora....ry.acfs ora....fs.type 0/5 0/ ONLINE ONLINE oranode2
ora.scan1.vip ora....ip.type 0/0 0/0 ONLINE ONLINE oranode2
--确保ASM服务已经关闭
[grid@oranode2 ~]$ srvctl status asm -n oranode1
ASM is not running on oranode1
[grid@oranode2 ~]$ srvctl status asm -n oranode2
ASM is running on oranode2
--验证集群节点一的oracle相关服务已经完全关闭
[grid@oranode1 ~]$ ps -ef |grep -i ora
root 1555 1 0 12:03 ? 00:00:10 /u01/app/11.2.0/grid/jdk/jre/bin/java -Xms64m -Xmx256m -classpath /u01/app/11.2.0/grid/tfa/oranode1/tfa_home/jar/RATFA.jar:/u01/app/11.2.0/grid/tfa/oranode1/tfa_home/jar/je-4.0.103.jar:/u01/app/11.2.0/grid/tfa/oranode1/tfa_home/jar/ojdbc6.jar oracle.rat.tfa.TFAMain /u01/app/11.2.0/grid/tfa/oranode1/tfa_home
root 1775 1704 0 12:03 ? 00:00:01 hald-addon-storage: polling /dev/sr0 (every 2 sec)
grid 11980 11916 0 13:14 pts/0 00:00:00 grep -i ora
[grid@oranode1 ~]$ ps -ef |grep -i asm
grid 11988 11916 0 13:14 pts/0 00:00:00 grep -i asm
--确保集群节点二可以正常访问
SQL> select instance_name,status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
orcl2 OPEN
#在配合os补丁打完后需要开启节点一上ORACLE服务
开启步骤:
[root@oranode1 ~]# /u01/app/11.2.0/grid/bin/crsctl start crs
CRS-4123: Oracle High Availability Services has been started.
--确保节点一上CRS服务已经开启成功
[grid@oranode1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....DISK.dg ora....up.type ONLINE ONLINE oranode1
ora.DATA.dg ora....up.type ONLINE ONLINE oranode1
ora....ER.lsnr ora....er.type ONLINE ONLINE oranode2
ora....N1.lsnr ora....er.type ONLINE ONLINE oranode2
ora.asm ora.asm.type ONLINE ONLINE oranode1
ora.cvu ora.cvu.type ONLINE ONLINE oranode2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE oranode1
ora.oc4j ora.oc4j.type ONLINE ONLINE oranode2
ora.ons ora.ons.type ONLINE ONLINE oranode1
ora....SM1.asm application ONLINE ONLINE oranode1
ora....E1.lsnr application OFFLINE OFFLINE
ora....de1.gsd application OFFLINE OFFLINE
ora....de1.ons application ONLINE ONLINE oranode1
ora....de1.vip ora....t1.type ONLINE ONLINE oranode1
ora....SM2.asm application ONLINE ONLINE oranode2
ora....E2.lsnr application ONLINE ONLINE oranode2
ora....de2.gsd application OFFLINE OFFLINE
ora....de2.ons application ONLINE ONLINE oranode2
ora....de2.vip ora....t1.type ONLINE ONLINE oranode2
ora.orcl.db ora....se.type ONLINE ONLINE oranode2
ora....ry.acfs ora....fs.type ONLINE ONLINE oranode1
ora.scan1.vip ora....ip.type ONLINE ONLINE oranode2
--确保ASM服务已经运行在两个节点上
[grid@oranode1 ~]$ srvctl status asm
ASM is running on oranode2,oranode1
--开启集群节点一数据库实例
[grid@oranode1 ~]$ srvctl start instance -d orcl -i orcl1
--验证是否启动成功
[grid@oranode1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node oranode1
Instance orcl2 is running on node oranode2
--开启完成后集群服务校验,确保服务开启成功且各自运行在集群节点上
[grid@oranode1 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....DISK.dg ora....up.type ONLINE ONLINE oranode1
ora.DATA.dg ora....up.type ONLINE ONLINE oranode1
ora....ER.lsnr ora....er.type ONLINE ONLINE oranode1
ora....N1.lsnr ora....er.type ONLINE ONLINE oranode2
ora.asm ora.asm.type ONLINE ONLINE oranode1
ora.cvu ora.cvu.type ONLINE ONLINE oranode2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE oranode1
ora.oc4j ora.oc4j.type ONLINE ONLINE oranode2
ora.ons ora.ons.type ONLINE ONLINE oranode1
ora....SM1.asm application ONLINE ONLINE oranode1
ora....E1.lsnr application ONLINE ONLINE oranode1
ora....de1.gsd application OFFLINE OFFLINE
ora....de1.ons application ONLINE ONLINE oranode1
ora....de1.vip ora....t1.type ONLINE ONLINE oranode1
ora....SM2.asm application ONLINE ONLINE oranode2
ora....E2.lsnr application ONLINE ONLINE oranode2
ora....de2.gsd application OFFLINE OFFLINE
ora....de2.ons application ONLINE ONLINE oranode2
ora....de2.vip ora....t1.type ONLINE ONLINE oranode2
ora.orcl.db ora....se.type ONLINE ONLINE oranode1
ora....ry.acfs ora....fs.type ONLINE ONLINE oranode1
ora.scan1.vip ora....ip.type ONLINE ONLINE oranode2
[grid@oranode1 ~]$
--节点停机开启操作与节点一上操作顺序一致
阅读(2686) | 评论(0) | 转发(1) |