暂无图片
暂无图片
3
暂无图片
暂无图片
2
暂无图片

避坑指南|Oracle RAC 补丁安装踩坑实录,你中招几个?

原创 Lucifer三思而后行 4天前
131

大家好,这里是 DBA学习之路,专注于提升数据库运维效率。

目录

前言

上篇文章 《Oracle RAC 触发 BUG,crsd 无限重启!》 中提到通过安装补丁 Patch 34762026 解决集群故障,但由于篇幅限制未详细展开补丁安装过程。

不少读者留言咨询具体操作细节,恰巧我在实际安装过程中也踩了不少“坑”:从环境预检的隐藏雷区到 OPatch 的版本陷阱,补丁依赖的连环套问题。

本文将结合实战经验,手把手拆解补丁安装全流程,顺便给大家避避坑(点个关注不迷路~),希望大家后续遇到同样问题可以顺利解决!

下载补丁

下载 BUG 所需补丁 Patch 24396050: LNX64-12.2-CRS: CRSD.BIN FAILED SEVERAL TIMES WITH ERROR CRS-1019

本文所需补丁我已经整理上传百度网盘,如有需要可关注公众号:DBA学习之路,公众号聊天框发送 24396050 获取对应补丁。

安装过程

安装补丁第一步都建议大家查看补丁自带的 README 文件,其中会详细的告知你补丁安装的步骤以及前置准备等信息。

检查 OPatch

通过查看补丁 README:You must use the OPatch utility version 12.2.0.1.5 or later to apply this patch.,要求 OPatch 版本要大于 12.2.0.1.5,这里一上来我就踩了个坑。

检查当前 OPatch 补丁是否符合要求:

[grid@lucifer01 ~]$ cd $ORACLE_HOME/OPatch/ [grid@lucifer01 OPatch]$ ./opatch version OPatch Version: 12.2.0.1.6 OPatch succeeded.
复制

一看这里符合要求,我就没管了,然后我就踩坑了。

坑一

如果不更新 OPatch,直接应用补丁,报错内容如下:

Opatchauto in 12.2 requires the creation of a wallet file with password for owner of grid software on all nodes. Failure of specifying wallet would result into the below errors : OPATCHAUTO-68021: Missing required argument(s). OPATCHAUTO-68021: The following argument(s) are required: [-wallet] OPATCHAUTO-68021: Provide the required argument(s).
复制

只有更新 OPatch 到 12.2.0.1.8 之后才不会需要 -wallet 选项,否则强制需要,可参考 MOS 文档:

Creation of opatchauto wallet in 12.2 in 12.2.0.1.8 (Doc ID 2270185.1)

经验一:不管 README 要求最低版本是多少,都建议将 OPatch 都升级到最新版本。

更新 OPatch

下载最新的 OPatch 包并更新,所有节点均需执行:

## 需要使用 root 用户先授予补丁包 grid 用户权限 [root@lucifer01:/root]# chown -R grid:oinstall /soft/ ## grid 用户执行 [grid@lucifer02:/home/grid]$ unzip -qo /soft/p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME [grid@lucifer02:/home/grid]$ unzip -qo /soft/p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME
复制

更新后查看 opatch 版本:

[grid@lucifer01:/home/grid]$ opatch version OPatch Version: 12.2.0.1.45 OPatch succeeded. [grid@lucifer02:/home/grid]$ opatch version OPatch Version: 12.2.0.1.45 OPatch succeeded.
复制

确保 OPatch 已更新到最新版本,否则会遇到坑一。

解压 24396050 补丁包

下载后的补丁包上传到主机目录下,解压到指定目录:

## root 执行 [root@lucifer01:/root]# unzip -q /soft/p24396050_122010_Linux-x86-64.zip -d /soft/ [root@lucifer01:/root]# chown -R grid:oinstall /soft/
复制

解压后建议授权为 grid 用户,避免后续操作权限问题。

安装前检查

grid 补丁建议使用 opatchauto 进行安装,然而 opatchauto 需要使用 root 用户执行,所以需要提前指定环境变量:

## root 执行 [root@lucifer01:/root]# export GI_HOME=/u01/app/12.2.0/grid
复制

建议在正式安装前执行检查(所有节点都需执行),避免安装过程中出现问题,这一步又遇到两个坑,先坑为敬。

坑二

这个坑是因为在 /root 目录下执行 opatchauto 命令报错:

[root@lucifer01:/root]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyze Invalid current directory. Please run opatchauto from other than '/root' and '/' directory. And check if the home owner user has write permission set for the current directory. opatchauto returns with error code = 2
复制

建议在补丁目录下执行:

[root@lucifer01:/root]# cd /soft/24396050 [root@lucifer02:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyze
复制

经验二:执行补丁安装时,建议在补丁解压所在目录执行。

坑三

因为数据库主机系统版本是 rhel8.10,而 Oracle 12CR2 刚发布时不支持 rhel8.10,所以打这个补丁需要设置 CV_ASSUME_DISTID=OEL7.8,否则会执行报错:

Shared home /u01/app/12.2.0/grid can only be patched in nonrolling mode. OPATCHAUTO-72030: Execution mode invalid. OPATCHAUTO-72030: Cannot execute in rolling mode, as CRS home is shared. OPATCHAUTO-72030: Execute in non-rolling mode.
复制

设置之后即可执行成功,具体可参考 MOS 文档:

Prepare for and Top Issues of RU Patching via “opatchauto apply” and “opatchauto resume” in Different User Environment (Doc ID 2840546.1)

  • Issue #7 OPATCHAUTO-72030: Cannot execute in rolling mode, as CRS home is shared

解决完以上两个坑之后,顺利执行预检查过程:

## 节点一 [root@lucifer01:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8 [root@lucifer01:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyze OPatchauto session is initiated at Tue Mar 25 14:32:12 2025 System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2025-03-25_02-32-14PM.log. Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2025-03-25_02-32-21PM.log The id for this session is PPD4 Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid Patch applicability verified successfully on home /u01/app/12.2.0/grid Executing patch validation checks on home /u01/app/12.2.0/grid Patch validation checks successfully completed on home /u01/app/12.2.0/grid OPatchAuto successful. --------------------------------Summary-------------------------------- Analysis for applying patches has completed successfully: Host:lucifer01 CRS Home:/u01/app/12.2.0/grid Version:12.2.0.1.0 ==Following patches were SUCCESSFULLY analyzed to be applied: Patch: /soft/24396050/24396050 Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-32-25PM_1.log OPatchauto session completed at Tue Mar 25 14:32:28 2025 Time taken to complete the session 0 minute, 16 seconds ## 节点二 [root@lucifer02:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8 [root@lucifer02:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyze OPatchauto session is initiated at Tue Mar 25 14:42:25 2025 System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2025-03-25_02-42-26PM.log. Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2025-03-25_02-42-34PM.log The id for this session is HPWC Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid Patch applicability verified successfully on home /u01/app/12.2.0/grid Executing patch validation checks on home /u01/app/12.2.0/grid Patch validation checks successfully completed on home /u01/app/12.2.0/grid OPatchAuto successful. --------------------------------Summary-------------------------------- Analysis for applying patches has completed successfully: Host:lucifer02 CRS Home:/u01/app/12.2.0/grid Version:12.2.0.1.0 ==Following patches were SUCCESSFULLY analyzed to be applied: Patch: /soft/24396050/24396050 Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-42-39PM_1.log OPatchauto session completed at Tue Mar 25 14:42:41 2025 Time taken to complete the session 0 minute, 17 seconds
复制

检查没有问题,正式进行补丁安装。

安装补丁

安装补丁时需要 root 用户执行,所以需要提前指定环境变量:

## root 执行 [root@lucifer01:/root]# export GI_HOME=/u01/app/12.2.0/grid
复制

然后执行安装补丁:

## 节点一 [root@lucifer01:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8 [root@lucifer01:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME OPatchauto session is initiated at Tue Mar 25 14:35:47 2025 System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2025-03-25_02-35-49PM.log. Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2025-03-25_02-35-56PM.log The id for this session is 1V5S Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid Patch applicability verified successfully on home /u01/app/12.2.0/grid Executing patch validation checks on home /u01/app/12.2.0/grid Patch validation checks successfully completed on home /u01/app/12.2.0/grid Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/12.2.0/grid Prepatch operation log file location: /u01/app/grid/crsdata/lucifer01/crsconfig/crspatch_lucifer01_2025-03-25_02-36-05PM.log CRS service brought down successfully on home /u01/app/12.2.0/grid Start applying binary patch on home /u01/app/12.2.0/grid Binary patch applied successfully on home /u01/app/12.2.0/grid Running rootadd_rdbms.sh on home /u01/app/12.2.0/grid Successfully executed rootadd_rdbms.sh on home /u01/app/12.2.0/grid Performing postpatch operations on CRS - starting CRS service on home /u01/app/12.2.0/grid Postpatch operation log file location: /u01/app/grid/crsdata/lucifer01/crsconfig/crspatch_lucifer01_2025-03-25_02-38-35PM.log CRS service started successfully on home /u01/app/12.2.0/grid OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:lucifer01 CRS Home:/u01/app/12.2.0/grid Version:12.2.0.1.0 Summary: ==Following patches were SUCCESSFULLY applied: Patch: /soft/24396050/24396050 Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-38-02PM_1.log OPatchauto session completed at Tue Mar 25 14:40:57 2025 Time taken to complete the session 5 minutes, 10 seconds ## 节点二 [root@lucifer02:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8 [root@lucifer02:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME OPatchauto session is initiated at Tue Mar 25 14:43:47 2025 System initialization log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchautodb/systemconfig2025-03-25_02-43-49PM.log. Session log file is /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/opatchauto2025-03-25_02-43-56PM.log The id for this session is PWUR Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/grid Patch applicability verified successfully on home /u01/app/12.2.0/grid Executing patch validation checks on home /u01/app/12.2.0/grid Patch validation checks successfully completed on home /u01/app/12.2.0/grid Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/12.2.0/grid Prepatch operation log file location: /u01/app/grid/crsdata/lucifer02/crsconfig/crspatch_lucifer02_2025-03-25_02-44-04PM.log CRS service brought down successfully on home /u01/app/12.2.0/grid Start applying binary patch on home /u01/app/12.2.0/grid Binary patch applied successfully on home /u01/app/12.2.0/grid Running rootadd_rdbms.sh on home /u01/app/12.2.0/grid Successfully executed rootadd_rdbms.sh on home /u01/app/12.2.0/grid Performing postpatch operations on CRS - starting CRS service on home /u01/app/12.2.0/grid Postpatch operation log file location: /u01/app/grid/crsdata/lucifer02/crsconfig/crspatch_lucifer02_2025-03-25_02-45-49PM.log CRS service started successfully on home /u01/app/12.2.0/grid OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:lucifer02 CRS Home:/u01/app/12.2.0/grid Version:12.2.0.1.0 Summary: ==Following patches were SUCCESSFULLY applied: Patch: /soft/24396050/24396050 Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-45-18PM_1.log OPatchauto session completed at Tue Mar 25 14:47:23 2025 Time taken to complete the session 3 minutes, 36 seconds
复制

执行完成后查看补丁是否安装完成:

[grid@lucifer01:/home/grid]$ opatch lspatches 24396050;OCW Interim patch for 24396050 OPatch succeeded. [grid@lucifer02:/home/grid]$ opatch lspatches 24396050;OCW Interim patch for 24396050 OPatch succeeded.
复制

安装补丁后重启系统验证集群恢复正常。

写在最后

避坑重点:90% 的安装失败源于准备工作不充分!你在打补丁时还遇到过哪些“神坑”?欢迎评论区分享!

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

R
reddey
暂无图片
3天前
评论
暂无图片 0
这个补丁,我看提示是不支持滚动升级,要提前关闭集群和数据库是吧?
3天前
暂无图片 点赞
1
Lucifer三思而后行
暂无图片 暂无图片
3天前
回复
暂无图片 0
@reddey: 是的
3天前
暂无图片 点赞
回复