sitemap

RSS地图

收藏本站

设为首页

Oracle研究中心

当前位置:Oracle研究中心 > 产品DBA > Oracle RAC >

【学习笔记】Oracle RAC升级安装patch补丁的问题和解决办法

时间:2016-11-19 19:04   来源:Oracle研究中心   作者:网络   点击:

天萃荷净 Oracle研究中心学习笔记:分享一篇关于Oracle数据库RAC环境中安装升级patch补丁的案例,在安装升级过程遇到one-off patch错误。

本站文章除注明转载外,均为本站原创: 转载自love wife & love life —Roger 的Oracle技术博客
本文链接地址: 比较BT的一个one-off patch

今天给某客户(买票难的问题,你们懂的)打一个one-off patch(11814167),遇到几个小问题,其中有件怪事,跟熊哥讨论了一下,他也感觉确实有点奇怪,按理说不应该啊。

首先来看下install patch(11814167)的基本步骤(大家可以参考readme):

1. 首先检查环境,使用了哪种存储方式?opatch 版本,当前集群状态?文件系统空间?

2. 解压patch以及update opatch(readme提到需要11.2.0.1.5以上版本的opatch);
unzip p11814167_112010_AIX64-5L.zip
unzip p6880880_112000_AIX64-5L.zip -d /grid/11.2
unzip p6880880_112000_AIX64-5L.zip -d /oracle/app/11.2
cluster中所有节点都需要更新.

3. 检查当前opatch信息并保存;

./opatch lsinventory -detail -oh /grid/11.2
./opatch lsinventory -detail -oh /oracle/app/11.2

4. 停止所有资源(包括crs,db以及em等等)

/oracle/app/11.2/bin/srvctl stop home -o /oracle/app/11.2 -s /tmp/morapp1.log -n morapp1-19
/oracle/app/11.2/bin/srvctl stop home -o /oracle/app/11.2 -s /tmp/morapp2.log -n morapp1-19

5. 以root用户执行如下脚本:

# /crs/install/rootcrs.pl -unlock --用法

node1: /grid/11.2/crs/install/rootcrs.pl -unlock
node2: /grid/11.2/crs/install/rootcrs.pl -unlock


6. patch for GI home

user by GI home owner:
node1: /grid/11.2/OPatch/opatch napply -oh /grid/11.2 -local /oradata1/patch/11814167
node2: /grid/11.2/OPatch/opatch napply -oh /grid/11.2 -local /oradata1/patch/11814167

7. Run the pre script for DB component of the patch

user by ORACLE_HOME owner
node1: /oradata1/patch/11814167/custom/server/11814167/custom/scripts/prepatch.sh -dbhome /oracle/app/11.2
node2: /oradata1/patch/11814167/custom/server/11814167/custom/scripts/prepatch.sh -dbhome /oracle/app/11.2

8. Apply the patch to DB Home :

As the database home owner execute:

node1: /oracle/app/11.2/OPatch/opatch napply -oh /oracle/app/11.2 -local /oradata1/patch/11814167/custom/server/11814167
node2: /oracle/app/11.2/OPatch/opatch napply -oh /oracle/app/11.2 -local /oradata1/patch/11814167/custom/server/11814167

9. Run the post script for DB component of the patch

As the database home owner execute
node1: /oradata1/patch/11814167/custom/server/11814167/custom/scripts/postpatch.sh -dbhome /oracle/app/11.2
node2: /oradata1/patch/11814167/custom/server/11814167/custom/scripts/postpatch.sh -dbhome /oracle/app/11.2


10. Run the post script by root.

/grid/11.2/rdbms/install/rootadd_rdbms.sh
/grid/11.2/crs/install/rootcrs.pl -patch
cluster中所有节点顺序执行。

11. Start the GI managed resources that were earlier running from DB homes

user by oracle_home owner.
node1: /oracle/app/11.2/bin/srvctl start home -o /oracle/app/11.2 -s /tmp/morapp1.log -n morapp1-19
node2: /oracle/app/11.2/bin/srvctl start home -o /oracle/app/11.2 -s /tmp/morapp1.log -n morapp2-19

12. 检查clsuter是否正常正常,可以使用crs_stat -t查询当前cluster资源使用情况。

如果大家看过readme就知道,oracle其实推荐的方式不是这种,是采取opatch auto的方式,但是我今天在开始使用这种方式的时候,发现了这种其实不好好,所谓auto的目的其实是将一系列的操作集成到一起了,虽然这样大大的简化了patch的工作量,但是这整个过程确显得跟黑匣子一样,不可控。

最开始我尝试了一下,发现不太好使,其中遇到了一个小错误,如下:

[Aug 12, 2011 10:40:45 AM] OPatch continues with these patches: 11814167
[Aug 12, 2011 10:40:45 AM] Do you want to proceed  [y|n]
[Aug 12, 2011 10:40:45 AM] Start to wait for user-input at Fri Aug 12 10:40:45 CST 2011
[Aug 12, 2011 10:40:57 AM] Finish waiting for user-input at Fri Aug 12 10:40:57 CST 2011
[Aug 12, 2011 10:40:57 AM] User Responded with: Y
[Aug 12, 2011 10:40:57 AM] Running prerequisite checks...
[Aug 12, 2011 10:40:57 AM] Space Needed : 22327897636
[Aug 12, 2011 10:40:57 AM] Required amount of space(22327897636) is not available.
[Aug 12, 2011 10:40:57 AM] Prerequisite check "CheckSystemSpace" failed.
The details are:
Required amount of space(22327897636) is not available.
[Aug 12, 2011 10:40:57 AM] OUI-67073:UtilSession failed: Prerequisite check "CheckSystemSpace" failed.
[Aug 12, 2011 10:40:57 AM] Finishing UtilSession at Fri Aug 12 10:40:57 CST 2011

很明显,从上面的意思来看是说当前的/grid目录太小了,剩余空间不足,大家注意这里的空间需求大小。

22327897636/1024/1024/1024=20.79G,很大的一个数字吧,当时客户也难以理解,怎么打个one-off patch还需要这么大的空间呢,确实有点让人费解。

这里简单的说明一下,该patch虽然说是one-off patch,其实可以看出一个bundle了,基本上把11.2.0.1的crs组件都更新了,所以变动非常大,以至于下载这个patch需要993m大小。

说到这里,我觉得这里就是readme的一个失误,因为里面没有提到关于空间的要求。

最后我没有使用patch auto的方式,而是采用了传统的方式,该readme文档中也有详细的过程说明,下面是在对2节点GI home patch的时候遇到的错误,当时这其实是我的失误,没有认真的看readme文档。

morapp2-19:/grid/11.2/bin$ /grid/11.2/OPatch/opatch napply -oh /grid/11.2 -local /oradata1/patch/11814167
Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6
Copyright (c) 2011, Oracle Corporation. All rights reserved.

UTIL session

Oracle Home : /grid/11.2
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.6
OUI version : 11.2.0.1.0
Log file location : /grid/11.2/cfgtoollogs/opatch/opatch2011-08-12_11-24-50AM.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 11814167

Do you want to proceed  [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]: yes

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/grid/11.2')

Is the local system ready for patching  [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '11814167' to OH '/grid/11.2'

Patching component oracle.crs, 11.2.0.1.0...

Copy failed from '/oradata1/patch/11814167/files/lib/libclsra11.so' to '/grid/11.2/lib/libclsra11.so'...
Please verify all applications associated with the Oracle Home '/grid/11.2' are shut down. If this is AIX, please perform solution documented in Note 739963.1 on https://myoraclesupport.oracle.com.

Do you want to retry copying the file  [y|n]
y
User Responded with: Y

Retry copying the file to '/grid/11.2/lib/libclsra11.so'.

Copy failed from '/oradata1/patch/11814167/files/lib/libdbcfg11.so' to '/grid/11.2/lib/libdbcfg11.so'...
Please verify all applications associated with the Oracle Home '/grid/11.2' are shut down. If this is AIX, please perform solution documented in Note 739963.1 on https://myoraclesupport.oracle.com.

Do you want to retry copying the file  [y|n]
y
User Responded with: Y

Retry copying the file to '/grid/11.2/lib/libdbcfg11.so'.

The following actions have failed:
Copy failed from '/oradata1/patch/11814167/files/lib/libclsra11.so' to '/grid/11.2/lib/libclsra11.so'...

Do you want to proceed  [y|n]
n
User Responded with: N
ApplySession failed in system modification phase... 'ApplySession::apply failed: Copy failed from '/oradata1/patch/11814167/files/lib/libclsra11.so' to '/grid/11.2/lib/libclsra11.so'...
'

Restoring "/grid/11.2" to the state prior to running NApply...
OPatch failed to restore the files from backup area. Not running "make".

NApply was not able to restore the home. Please invoke the following scripts:
- restore.[sh,bat]
- make.txt (Unix only)
to restore the ORACLE_HOME. They are located under
"/grid/11.2/.patch_storage/NApply/2011-08-12_11-24-50AM"

UtilSession failed: ApplySession failed in system modification phase... 'ApplySession::apply failed: Copy failed from '/oradata1/patch/11814167/files/lib/libclsra11.so' to '/grid/11.2/lib/libclsra11.so'...
'
Log file location: /grid/11.2/cfgtoollogs/opatch/opatch2011-08-12_11-24-50AM.log

OPatch failed with error code 73
morapp2-19:/grid/11.2/bin$

在该readme的最后明确提到了Special Instruction for AIX,遇到上诉错误的时候,可以先使用下面的方式来避免。

genld -l | grep /grid/11.2
genkld | grep /grid/11.2

executed by root: slibclean

这个属于失误,不多说了,下面来看在对$ORACLE_HOME patch的时候遇到的一件怪事.

morapp1-19:/oracle$ /oracle/app/11.2/OPatch/opatch napply -oh /oracle/app/11.2 -local /oradata1/patch/11814167/custom/server/11814167
Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6
Copyright (c) 2011, Oracle Corporation. All rights reserved.

UTIL session

Oracle Home : /oracle/app/11.2
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.6
OUI version : 11.2.0.1.0
Log file location : /oracle/app/11.2/cfgtoollogs/opatch/opatch2011-08-12_12-34-32PM.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 11814167

Do you want to proceed  [y|n]
y
User Responded with: Y
Prerequisite check "CheckApplicable" failed.
The details are:

Patch 11814167:
Copy Action: Source File "/oradata1/patch/11814167/custom/server/11814167/files/bin/rawutl" does not exists or is not readable
'oracle.rdbms, 11.2.0.1.0': to '/oracle/app/11.2/bin/rawutl'
Copy Action: Source File "/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/clsrwrap" does not exists or is not readable
'oracle.rdbms, 11.2.0.1.0': Cannot copy file from 'clsrwrap' to '/oracle/app/11.2/crs/sbs/clsrwrap'
Copy Action: Source File "/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/diagcollection.sh" does not exists or is not readable
'oracle.rdbms, 11.2.0.1.0': Cannot copy file from 'diagcollection.sh' to '/oracle/app/11.2/crs/sbs/diagcollection.sh'
Copy Action: Source File "/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/localconfig" does not exists or is not readable
'oracle.rdbms, 11.2.0.1.0': Cannot copy file from 'localconfig' to '/oracle/app/11.2/crs/sbs/localconfig'
Copy Action: Source File "/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/srvctl" does not exists or is not readable
'oracle.rdbms, 11.2.0.1.0': Cannot copy file from 'srvctl' to '/oracle/app/11.2/crs/sbs/srvctl'

UtilSession failed: Prerequisite check "CheckApplicable" failed.
Log file location: /oracle/app/11.2/cfgtoollogs/opatch/opatch2011-08-12_12-34-32PM.log

OPatch failed with error code 73

怎么会包这个patch中文件需要的文件不存在呢?难道说客户下载的patch不全吗?
我解压开自己笔记本上下载的patch,到该目录下看了一下,发现居然也不存在,如下是今天的情况:

morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/diagcollection.sh
/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/diagcollection.sh not found
morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/diagcollection.sh*
-rw-r--r--    1 oracle   dba             486 May 06 23:28 /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/diagcollection.sh.sbs
morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/localconfig*
-rwxr-xr-x    1 oracle   dba           23825 May 06 23:28 /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/localconfig.sbs
morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/srvctl*
-rwxr-xr-x    1 oracle   dba            8073 May 06 23:28 /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs/srvctl.sbs
morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs*

morapp1-19:/oradata1$ ls -ltr /oradata1/patch/11814167/custom/server/11814167/files/crs/sbs*
total 70
-rwxr-xr-x    1 oracle   dba            8073 May 06 23:28 srvctl.sbs
-rwxr-xr-x    1 oracle   dba           23825 May 06 23:28 localconfig.sbs
-rw-r--r--    1 oracle   dba             486 May 06 23:28 diagcollection.sh.sbs
-rwxr-xr-x    1 oracle   dba            1498 May 06 23:28 clsrwrap.sbs
morapp1-19:/oradata1$

上面我们可以清楚的看到,所需要的rawutl文件不存在,其他4个文件的文件名不对,patch里面的文件多了一个文件后缀。

这是怎么回事呢 怪哉了,首先我将该如上4个文件进行重命名,如下操作:

morapp1-19:/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs# mv srvctl.sbs srvctl
morapp1-19:/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs# mv localconfig.sbs localconfig
morapp1-19:/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs# mv diagcollection.sh.sbs diagcollection.sh
morapp1-19:/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs# mv clsrwrap.sbs clsrwrap
morapp1-19:/oradata1/patch/11814167/custom/server/11814167/files/crs/sbs# ls -ltr
total 70
-rwxr-xr-x 1 oracle dba 8073 May 06 23:28 srvctl
-rwxr-xr-x 1 oracle dba 23825 May 06 23:28 localconfig
-rw-r--r-- 1 oracle dba 486 May 06 23:28 diagcollection.sh
-rwxr-xr-x 1 oracle dba 1498 May 06 23:28 clsrwrap

由于这是在patch for oracle home时遇到的问题,于是进行如下查找:
morapp1-19:/$ find ./oracle/app -name rawutl
./oracle/app/11.2/bin/rawutl

发现$ORACLE_HOME下是有这个文件的,我于是将该文件cp到patch目录中。
morapp1-19:/$ cp /oracle/app/11.2/bin/rawutl /oradata1/patch/11814167/custom/server/11814167/files/bin/rawutl
morapp1-19:/$

最后再次尝试进行patch for $ORACLE_HOME,发现一切正常。
morapp1-19:/oradata1$ /oracle/app/11.2/OPatch/opatch napply -oh /oracle/app/11.2 -local /oradata1/patch/11814167/custom/server/11814167
Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6
Copyright (c) 2011, Oracle Corporation. All rights reserved.

UTIL session

Oracle Home : /oracle/app/11.2
Central Inventory : /oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.6
OUI version : 11.2.0.1.0
Log file location : /oracle/app/11.2/cfgtoollogs/opatch/opatch2011-08-12_12-58-27PM.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 11814167

Do you want to proceed  [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]: y

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/oracle/app/11.2')

Is the local system ready for patching  [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '11814167' to OH '/oracle/app/11.2'

Patching component oracle.rdbms, 11.2.0.1.0...
Patches 11814167 successfully applied.
Log file location: /oracle/app/11.2/cfgtoollogs/opatch/opatch2011-08-12_12-58-27PM.log

OPatch succeeded.
morapp1-19:/oradata1$

前面提到的怪事,其实就是为啥patch中的文件少了,而且名称不对?

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【学习笔记】Oracle RAC升级安装patch补丁的问题和解决办法

本文由大师惜分飞原创分享,网址:http://www.oracleplus.net/arch/1296.html

Oracle研究中心

关键词:

Oracle RAC安装patch补丁的详细步骤

Oracle RAC升级patch遇到one-off patch问题