RAC和ASM环境下打patch

在RAC环境下打patch与单节点类似,不过在RAC环境下Oracle提供了rolling patch方式,降低打patch对数据库的影响。

以下是基于RAC + ASM环境的patch步骤,简单记录。

[@more@] 1. 首先解压文件
[oracle@dwdb01 tmp]$ unzip p10017048_10205_Linux-x86-64.zip
Archive: p10017048_10205_Linux-x86-64.zip
creating: 10017048/
creating: 10017048/files/
creating: 10017048/files/lib/
creating: 10017048/files/lib/libserver10.a/
inflating: 10017048/files/lib/libserver10.a/kkfd.o
creating: 10017048/etc/
creating: 10017048/etc/config/
inflating: 10017048/etc/config/inventory
inflating: 10017048/etc/config/actions
creating: 10017048/etc/xml/
inflating: 10017048/etc/xml/GenericActions.xml
inflating: 10017048/etc/xml/ShiphomeDirectoryStructure.xml
inflating: 10017048/README.txt

2. 停止服务

这里要分几种情况:
1) 如果是rolling patch方式打补丁,则只需要先停止第一个需要patch的节点;为了简单起见,你也可以停止所有的节点实例,不过这样的话停机时间会增加。
2) 如果ASM和Oracle实例运行在同一个ORACLE_HOME下,则需要把ASM和数据库实例都关闭,否则只需要管理数据库实例即可。

这里的环境是ASM和Oracle实例在同一个ORACLE_HOME下,也因为这还不是生产库,因此可以简单地把相关服务都停掉。
[oracle@dwdb01 10017048]$ srvctl stop database -d dwrac
[oracle@dwdb01 10017048]$ srvctl stop asm -n dwdb01
[oracle@dwdb01 10017048]$ srvctl stop asm -n dwdb02
[oracle@dwdb01 10017048]$ srvctl stop asm -n dwdb03
[oracle@dwdb01 10017048]$ srvctl stop asm -n dwdb04
可以通过crs_stat检查一下状态。

3. 打补丁
[oracle@dwdb01 ]$ cd 10017048
[oracle@dwdb01 10017048]$ export ORACLE_SID=dwrac1
[oracle@dwdb01 10017048]$ /oracle/product/10.2.0/db/OPatch/opatch apply
Invoking OPatch 10.2.0.4.9

Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.


Oracle Home : /oracle/product/10.2.0/db
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /oracle/product/10.2.0/db/oui
Log file location : /oracle/product/10.2.0/db/cfgtoollogs/opatch/opatch2011-02-23_19-13-23PM.log

Patch history file: /oracle/product/10.2.0/db/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '10017048' to OH '/oracle/product/10.2.0/db'

Running prerequisite checks...

OPatch detected the node list and the local node from the inventory. OPatch will patch the local system then propagate the patch to the remote nodes.


This node is part of an Oracle Real Application Cluster.
Remote nodes: 'dwdb02' 'dwdb03' 'dwdb04'
Local node: 'dwdb01'
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/product/10.2.0/db')


Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '10017048' for restore. This might take a while...
Backing up files affected by the patch '10017048' for rollback. This might take a while...

Patching component oracle.rdbms, 10.2.0.5.0...
Updating archive file "/oracle/product/10.2.0/db/lib/libserver10.a" with "lib/libserver10.a/kkfd.o"
Running make for target ioracle
ApplySession adding interim patch '10017048' to inventory

Verifying the update...
Inventory check OK: Patch ID 10017048 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 10017048 are present in Oracle Home.

The local system has been patched. You can restart Oracle instances on it.


Patching in rolling mode.

Remaining nodes to be patched:
'dwdb02' 'dwdb03' 'dwdb04'
What is the next node to be patched?
dwdb02
You have selected 'dwdb02' from 'dwdb02' 'dwdb03' 'dwdb04'

The node 'dwdb02' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'dwdb02'.
(Oracle Home = '/oracle/product/10.2.0/db')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'dwdb02'
Apply-related files are:
FP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_files.txt"
DP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_dirs.txt"
MP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt"
RC = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/remote_cmds.txt"

Instantiating the file "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...
Instantiating the file "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_dirs.txt.instantiated" by replacing $ORACLE_HOME in "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_dirs.txt" with actual path.
Propagating directories to remote nodes...
Instantiating the file "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt" with actual path.
Running command on remote node 'dwdb02':
cd /oracle/product/10.2.0/db/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/oracle/product/10.2.0/db || echo REMOTE_MAKE_FAILED::>&2


The node 'dwdb02' has been patched. You can restart Oracle instances on it.

Remaining nodes to be patched:
'dwdb03' 'dwdb04'
What is the next node to be patched?
dwdb03
You have selected 'dwdb03' from 'dwdb03' 'dwdb04'

The node 'dwdb03' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'dwdb03'.
(Oracle Home = '/oracle/product/10.2.0/db')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'dwdb03'
Apply-related files are:
FP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_files.txt"
DP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_dirs.txt"
MP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt"
RC = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/remote_cmds.txt"

Propagating files to remote nodes...
Propagating directories to remote nodes...
Instantiating the file "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt" with actual path.
Running command on remote node 'dwdb03':
cd /oracle/product/10.2.0/db/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/oracle/product/10.2.0/db || echo REMOTE_MAKE_FAILED::>&2


The node 'dwdb03' has been patched. You can restart Oracle instances on it.


The node 'dwdb04' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'dwdb04'.
(Oracle Home = '/oracle/product/10.2.0/db')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'dwdb04'
Apply-related files are:
FP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_files.txt"
DP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/copy_dirs.txt"
MP = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt"
RC = "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/remote_cmds.txt"

Propagating files to remote nodes...
Propagating directories to remote nodes...
Instantiating the file "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt.instantiated" by replacing $ORACLE_HOME in "/oracle/product/10.2.0/db/.patch_storage/10017048_Sep_15_2010_06_14_25/rac/make_cmds.txt" with actual path.
Running command on remote node 'dwdb04':
cd /oracle/product/10.2.0/db/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/oracle/product/10.2.0/db || echo REMOTE_MAKE_FAILED::>&2


The node 'dwdb04' has been patched. You can restart Oracle instances on it.

There were relinks on remote nodes. Remember to check the binary size and timestamp on the nodes 'dwdb02' 'dwdb03' 'dwdb04' .
The following make commands were invoked on remote nodes:
'cd /oracle/product/10.2.0/db/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/oracle/product/10.2.0/db
'


OPatch succeeded.

整个打补丁的过程,Oracle会询问是否需要在其他节点打,直到所有节点都打上补丁。注意,要用到这一特性,需要配置ssh互信。

4. 最后启动asm和数据库实例
[oracle@dwdb01 bin]$ srvctl start asm -n dwdb01
[oracle@dwdb01 bin]$ srvctl start asm -n dwdb02
[oracle@dwdb01 bin]$ srvctl start asm -n dwdb03
[oracle@dwdb01 bin]$ srvctl start asm -n dwdb04
[oracle@dwdb01 bin]$ srvctl start database -d dwrac
[oracle@dwdb01 bin]$ srvctl start service -d dwrac



如果严格使用rolling patch的方式的话,则步骤是:
1. 在第一个节点停止ASM和Oracle instance(ASM和Oracle共用一个ORACLE_HOME)

srvctl stop instance -d dwrac -i dwrac1
srvctl stop asm -n dwdb01

2. 在第一个节点打补丁

opatch apply
打完第一个补丁后,Oracle会询问下一个需要打patch是那个。

3. 另开窗口,启动第一个节点的资源,并关闭下一个需要打patch的资源

srvctl start instance -d dwrac -i dwrac1
srvctl start asm -n dwdb01
srvctl stop instance -d dwrac -i dwrac2
srvctl stop asm -n dwdb02

4. 依此类推,直到所有节点打完patch为止


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/231499/viewspace-1046629/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/231499/viewspace-1046629/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值