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

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

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

目录

前言

下载补丁

安装过程

检查 OPatch

坑一

更新 OPatch

解压 24396050 补丁包

安装前检查

坑二

坑三

安装补丁

写在最后

前言上篇文章 《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 补丁是否符合要求:

12345[grid@lucifer01 ~]$ cd $ORACLE_HOME/OPatch/[grid@lucifer01 OPatch]$ ./opatch versionOPatch Version: 12.2.0.1.6OPatch succeeded.

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

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

1234567Opatchauto 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 包并更新,所有节点均需执行:

12345## 需要使用 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 版本:

123456789[grid@lucifer01:/home/grid]$ opatch versionOPatch Version: 12.2.0.1.45OPatch succeeded.[grid@lucifer02:/home/grid]$ opatch versionOPatch Version: 12.2.0.1.45OPatch succeeded.

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

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

123## 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 用户执行,所以需要提前指定环境变量:

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

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

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

12345[root@lucifer01:/root]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyzeInvalid 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

建议在补丁目录下执行:

12[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,否则会执行报错:

12345Shared 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

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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869## 节点一[root@lucifer01:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8[root@lucifer01:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOME -analyzeOPatchauto session is initiated at Tue Mar 25 14:32:12 2025System 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.logThe id for this session is PPD4Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/gridPatch applicability verified successfully on home /u01/app/12.2.0/gridExecuting patch validation checks on home /u01/app/12.2.0/gridPatch validation checks successfully completed on home /u01/app/12.2.0/gridOPatchAuto successful.--------------------------------Summary--------------------------------Analysis for applying patches has completed successfully:Host:lucifer01CRS Home:/u01/app/12.2.0/gridVersion:12.2.0.1.0==Following patches were SUCCESSFULLY analyzed to be applied:Patch: /soft/24396050/24396050Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-32-25PM_1.logOPatchauto session completed at Tue Mar 25 14:32:28 2025Time 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 -analyzeOPatchauto session is initiated at Tue Mar 25 14:42:25 2025System 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.logThe id for this session is HPWCExecuting OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/gridPatch applicability verified successfully on home /u01/app/12.2.0/gridExecuting patch validation checks on home /u01/app/12.2.0/gridPatch validation checks successfully completed on home /u01/app/12.2.0/gridOPatchAuto successful.--------------------------------Summary--------------------------------Analysis for applying patches has completed successfully:Host:lucifer02CRS Home:/u01/app/12.2.0/gridVersion:12.2.0.1.0==Following patches were SUCCESSFULLY analyzed to be applied:Patch: /soft/24396050/24396050Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-42-39PM_1.logOPatchauto session completed at Tue Mar 25 14:42:41 2025Time taken to complete the session 0 minute, 17 seconds

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

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

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

然后执行安装补丁:

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899## 节点一[root@lucifer01:/soft/24396050]# export CV_ASSUME_DISTID=OEL7.8[root@lucifer01:/soft/24396050]# $GI_HOME/OPatch/opatchauto apply /soft/24396050 -oh $GI_HOMEOPatchauto session is initiated at Tue Mar 25 14:35:47 2025System 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.logThe id for this session is 1V5SExecuting OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/gridPatch applicability verified successfully on home /u01/app/12.2.0/gridExecuting patch validation checks on home /u01/app/12.2.0/gridPatch validation checks successfully completed on home /u01/app/12.2.0/gridPerforming prepatch operations on CRS - bringing down CRS service on home /u01/app/12.2.0/gridPrepatch operation log file location: /u01/app/grid/crsdata/lucifer01/crsconfig/crspatch_lucifer01_2025-03-25_02-36-05PM.logCRS service brought down successfully on home /u01/app/12.2.0/gridStart applying binary patch on home /u01/app/12.2.0/gridBinary patch applied successfully on home /u01/app/12.2.0/gridRunning rootadd_rdbms.sh on home /u01/app/12.2.0/gridSuccessfully executed rootadd_rdbms.sh on home /u01/app/12.2.0/gridPerforming postpatch operations on CRS - starting CRS service on home /u01/app/12.2.0/gridPostpatch operation log file location: /u01/app/grid/crsdata/lucifer01/crsconfig/crspatch_lucifer01_2025-03-25_02-38-35PM.logCRS service started successfully on home /u01/app/12.2.0/gridOPatchAuto successful.--------------------------------Summary--------------------------------Patching is completed successfully. Please find the summary as follows:Host:lucifer01CRS Home:/u01/app/12.2.0/gridVersion:12.2.0.1.0Summary:==Following patches were SUCCESSFULLY applied:Patch: /soft/24396050/24396050Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-38-02PM_1.logOPatchauto session completed at Tue Mar 25 14:40:57 2025Time 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_HOMEOPatchauto session is initiated at Tue Mar 25 14:43:47 2025System 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.logThe id for this session is PWURExecuting OPatch prereq operations to verify patch applicability on home /u01/app/12.2.0/gridPatch applicability verified successfully on home /u01/app/12.2.0/gridExecuting patch validation checks on home /u01/app/12.2.0/gridPatch validation checks successfully completed on home /u01/app/12.2.0/gridPerforming prepatch operations on CRS - bringing down CRS service on home /u01/app/12.2.0/gridPrepatch operation log file location: /u01/app/grid/crsdata/lucifer02/crsconfig/crspatch_lucifer02_2025-03-25_02-44-04PM.logCRS service brought down successfully on home /u01/app/12.2.0/gridStart applying binary patch on home /u01/app/12.2.0/gridBinary patch applied successfully on home /u01/app/12.2.0/gridRunning rootadd_rdbms.sh on home /u01/app/12.2.0/gridSuccessfully executed rootadd_rdbms.sh on home /u01/app/12.2.0/gridPerforming postpatch operations on CRS - starting CRS service on home /u01/app/12.2.0/gridPostpatch operation log file location: /u01/app/grid/crsdata/lucifer02/crsconfig/crspatch_lucifer02_2025-03-25_02-45-49PM.logCRS service started successfully on home /u01/app/12.2.0/gridOPatchAuto successful.--------------------------------Summary--------------------------------Patching is completed successfully. Please find the summary as follows:Host:lucifer02CRS Home:/u01/app/12.2.0/gridVersion:12.2.0.1.0Summary:==Following patches were SUCCESSFULLY applied:Patch: /soft/24396050/24396050Log: /u01/app/12.2.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2025-03-25_14-45-18PM_1.logOPatchauto session completed at Tue Mar 25 14:47:23 2025Time taken to complete the session 3 minutes, 36 seconds

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

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

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

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

相关推荐

【老母鸡如何选购】老母鸡如何辨别好坏
365bet足球官方开户网

【老母鸡如何选购】老母鸡如何辨别好坏

🗓️ 06-28 👁️ 3374
会员五折天
365bet外围

会员五折天

🗓️ 11-13 👁️ 7569
韩国队在2026年FIFA北中美世界杯决赛阶段比赛中,与墨西哥、南非共和国(以下简称南非)、欧洲季后赛D组(丹麦、捷克、爱尔兰、北马其顿胜利者)同组。6日(韩国时间),在美国华盛顿特区肯尼迪中心举行的..

友情链接