1.所需文件

p6880880_122010_Linux-x86-64.zip
p32126842_190000_Linux-x86-64.zip

2.查看OPatch版本

  1. /u01/app/19.3.0.0/OPatch
  2. [root@rac1 OPatch]# ./opatchauto version
  3. Oracle OPatchAuto Version 13.9.4.2.0
  4. Copyright (c) 2016, Oracle Corporation. All rights reserved.
  5. 1. OPatchAuto version 13.9.4.2.0
  6. 2. OpatchautoDB version 12.2.0.1.17

3.保存并替换OPatch文件

  1. tar -zcvf /setup/u01_app.tar.gz /u01/app
  2. cp -r OPatch OPatch_BAk
  3. rm -rf /u01/app/19.3.0.0/OPatch
  4. cd /setup
  5. unzip p6880880_122010_Linux-x86-64.zip
  6. cp -r OPatch /u01/app/19.3.0.0
  7. chown grid:oinstall /u01/app/19.3.0.0/OPatch -R
  8. mv /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch_BAK
  9. cp -r /setup/OPatch /u01/app/oracle/product/19.3.0.0/dbhome_1/
  10. chown oracle:oinstall /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch -R
  11. 其他节点
  12. rm -rf /u01/app/19.3.0.0/OPatch
  13. rm -rf /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch
  14. cd /setup
  15. unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/19.3.0.0/
  16. unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/19.3.0.0/dbhome_1/
  17. chown grid:oinstall /u01/app/19.3.0.0/OPatch -R
  18. chown oracle:oinstall /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch -R

4.oracle inventory 验证

  1. su - grid
  2. ./opatch lspatches #查看验证现有补丁
  3. 或者使用
  4. ./opatch lsinventory -detail -oh /u01/app/19.3.0.0/

5.检查空间

image.png

  1. su - grid
  2. vi /tmp/patch_list_gihome.txt
  3. /setup/32126842/32226239/32218454
  4. /setup/32126842/32226239/32222571
  5. /setup/32126842/32226239/32218663
  6. /setup/32126842/32226239/29340594
  7. /setup/32126842/32226239/32240590
  8. $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
  9. [grid@rac1 32126842]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
  10. Oracle Interim Patch Installer version 12.2.0.1.24
  11. Copyright (c) 2021, Oracle Corporation. All rights reserved.
  12. PREREQ session
  13. Oracle Home : /u01/app/19.3.0.0
  14. Central Inventory : /u01/app/oraInventory
  15. from : /u01/app/19.3.0.0/oraInst.loc
  16. OPatch version : 12.2.0.1.24
  17. OUI version : 12.2.0.7.0
  18. Log file location : /u01/app/19.3.0.0/cfgtoollogs/opatch/opatch2021-08-27_02-28-09AM_1.log
  19. Invoking prereq "checksystemspace"
  20. Prereq "checkSystemSpace" passed.
  21. OPatch succeeded.
  22. su - oracle
  23. vi /tmp/patch_list_dbhome.txt
  24. /setup/32126842/32226239/32218454
  25. /setup/32126842/32226239/32222571
  26. $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
  27. Oracle Interim Patch Installer version 12.2.0.1.24
  28. Copyright (c) 2021, Oracle Corporation. All rights reserved.
  29. PREREQ session
  30. Oracle Home : /u01/app/oracle/product/19.3.0.0/dbhome_1
  31. Central Inventory : /u01/app/oraInventory
  32. from : /u01/app/oracle/product/19.3.0.0/dbhome_1/oraInst.loc
  33. OPatch version : 12.2.0.1.24
  34. OUI version : 12.2.0.7.0
  35. Log file location : /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-08-27_02-32-11AM_1.log
  36. Invoking prereq "checksystemspace"
  37. Prereq "checkSystemSpace" passed.
  38. OPatch succeeded.

6.冲突检测

image.png

  1. su - grid
  2. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218454
  3. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32222571
  4. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218663
  5. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/29340594
  6. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32240590
  7. su - oracle
  8. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218454
  9. $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32222571
  10. ##########确认所有执行都是返回OPatch succeeded###############################

image.png

7.检查各个节点oui-patch.xml文件

没有则复制其他节点文件过去

  1. cd /u01/app/oraInventory/ContentsXML
  2. [root@olrac1 ContentsXML]# ll
  3. total 16
  4. -rwxrwxrwx 1 grid oinstall 300 Mar 18 2020 comps.xml
  5. -rwxrwxrwx 1 grid oinstall 623 Aug 22 2020 inventory.xml
  6. -rwxrwxrwx 1 grid oinstall 292 Mar 18 2020 libs.xml
  7. -rwxrwxrwx 1 grid oinstall 174 Mar 18 2020 oui-patch.xml
  8. scp oui-patch.xml grid@192.168.5.132:/u01/app/oraInventory/ContentsXML/
  9. chmod 660 oui-patch.xml

8.补丁分析

  1. su - root
  2. /u01/app/19.3.0.0/grid/OPatch/opatchauto apply /setup/32126842/32226239 -analyze

9.执行补丁安装

  1. [root@olrac1 ~]# /u01/app/19.3.0.0/grid/OPatch/opatchauto apply /setup/32126842/32226239
  2. OPatchauto session is initiated at Sat Aug 28 03:20:34 2021
  3. System initialization log file is /u01/app/19.3.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-08-28_03-20-42AM.log.
  4. Session log file is /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-08-28_03-22-20AM.log
  5. The id for this session is 25G2
  6. Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  7. Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.3.0.0/grid
  8. Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  9. Patch applicability verified successfully on home /u01/app/19.3.0.0/grid
  10. Executing patch validation checks on home /u01/app/19.3.0.0/grid
  11. Patch validation checks successfully completed on home /u01/app/19.3.0.0/grid
  12. Executing patch validation checks on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  13. Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  14. Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  15. SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  16. Preparing to bring down database service on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  17. Successfully prepared home /u01/app/oracle/product/19.3.0.0/dbhome_1 to bring down database service
  18. Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19.3.0.0/grid
  19. Prepatch operation log file location: /u01/app/grid/crsdata/olrac1/crsconfig/crs_prepatch_apply_inplace_olrac1_2021-08-28_03-25-00AM.log
  20. CRS service brought down successfully on home /u01/app/19.3.0.0/grid
  21. Performing prepatch operation on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  22. Perpatch operation completed successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  23. Start applying binary patch on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  24. Binary patch applied successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  25. Performing postpatch operation on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  26. Postpatch operation completed successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  27. Start applying binary patch on home /u01/app/19.3.0.0/grid
  28. Binary patch applied successfully on home /u01/app/19.3.0.0/grid
  29. Performing postpatch operations on CRS - starting CRS service on home /u01/app/19.3.0.0/grid
  30. Postpatch operation log file location: /u01/app/grid/crsdata/olrac1/crsconfig/crs_postpatch_apply_inplace_olrac1_2021-08-28_03-55-00AM.log
  31. CRS service started successfully on home /u01/app/19.3.0.0/grid
  32. Preparing home /u01/app/oracle/product/19.3.0.0/dbhome_1 after database service restarted
  33. No step execution required.........
  34. Trying to apply SQL patch on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  35. SQL patch applied successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
  36. OPatchAuto successful.
  37. --------------------------------Summary--------------------------------
  38. Patching is completed successfully. Please find the summary as follows:
  39. Host:olrac1
  40. RAC Home:/u01/app/oracle/product/19.3.0.0/dbhome_1
  41. Version:19.0.0.0.0
  42. Summary:
  43. ==Following patches were SKIPPED:
  44. Patch: /setup/32126842/32226239/32218663
  45. Reason: This patch is not applicable to this specified target type - "rac_database"
  46. Patch: /setup/32126842/32226239/29340594
  47. Reason: This patch is not applicable to this specified target type - "rac_database"
  48. Patch: /setup/32126842/32226239/32240590
  49. Reason: This patch is not applicable to this specified target type - "rac_database"
  50. ==Following patches were SUCCESSFULLY applied:
  51. Patch: /setup/32126842/32226239/32218454
  52. Log: /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-31-29AM_1.log
  53. Patch: /setup/32126842/32226239/32222571
  54. Log: /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-31-29AM_1.log
  55. Host:olrac1
  56. CRS Home:/u01/app/19.3.0.0/grid
  57. Version:19.0.0.0.0
  58. Summary:
  59. ==Following patches were SUCCESSFULLY applied:
  60. Patch: /setup/32126842/32226239/29340594
  61. Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
  62. Patch: /setup/32126842/32226239/32218454
  63. Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
  64. Patch: /setup/32126842/32226239/32218663
  65. Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
  66. Patch: /setup/32126842/32226239/32222571
  67. Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
  68. Patch: /setup/32126842/32226239/32240590
  69. Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
  70. OPatchauto session completed at Sat Aug 28 04:08:48 2021
  71. Time taken to complete the session 48 minutes, 15 seconds
  1. /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch/opatchauto apply /setup/32126842/32226239 -oh /u01/app/oracle/product/19.3.0.0/dbhome_1/
  2. /u01/app/19.3.0.0/OPatch/opatchauto rollback /setup/32126842/32226239
  3. rollback
  4. /u01/app/19.3.0.0/OPatch/opatchauto rollback /setup/32126842/32226239 -oh /u01/app/19.3.0.0/

异常处理:

缺失命令fuser
Patch: /u01/app/install/32126842/32226239/32218454
Log: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-06-24_11-04-45上午_1.log
Reason: Failed during Analysis: CheckSystemCommandsAvailable Failed, [ Prerequisite Status: FAILED, Prerequisite output:
The details are:
Missing command :fuser]

  1. yum install -y psmisc

升级失败进程被占用
查看升级日志
[2022-6-24 11:25:00] [INFO] Following active executables are not used by opatch process :


Following active executables are used by opatch process :
/u01/app/19c/grid/lib/libclntsh.so.19.1
[2022-6-24 11:25:00] [INFO] Prerequisite check “CheckActiveFilesAndExecutables” failed.
The details are:


Following active executables are not used by opatch process :


Following active executables are used by opatch process :
/u01/app/19c/grid/lib/libclntsh.so.19.1

  1. 安装lsof 命令
  2. yum install lsof -y
  3. lsof /u01/app/19c/grid/lib/libclntsh.so.19.1
  4. [root@cesmon01 install]# lsof /u01/app/19c/grid/lib/libclntsh.so.19.1
  5. COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
  6. java 22303 grid mem REG 8,33 79942576 3019450 /u01/app/19c/grid/lib/libclntsh.so.19.1
  7. [root@cesmon01 install]# kill -9 22303
  8. 重新运行升级脚本发现集群未启动不能升级
  9. 手动逐个升级
  10. su - grid
  11. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/29340594 -oh /u01/app/19c/grid
  12. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32218454 -oh /u01/app/19c/grid
  13. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32218663 -oh /u01/app/19c/grid
  14. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32222571 -oh /u01/app/19c/grid
  15. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32240590 -oh /u01/app/19c/grid
  16. /u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32067171 -oh /u01/app/19c/grid
  17. 升级完启动集群报错
  18. [root@cesmon01 install]# /u01/app/19c/grid/bin/crsctl start has
  19. CRS-6706: Oracle Clusterware Release patch level ('1944883066') does not match Software patch level ('724960844'). Oracle Clusterware cannot be started.
  20. CRS-4000: Command Start failed, or completed with errors.
  21. /u01/app/19c/grid/bin/clscfg -localpatch
  22. /u01/app/19c/grid/crs/install/rootcrs.sh -lock
  23. [root@cesmon01 install]# /u01/app/19c/grid/bin/clscfg -localpatch
  24. clscfg: EXISTING configuration version 0 detected.
  25. Creating OCR keys for user 'root', privgrp 'root'..
  26. Operation successful.
  27. [root@cesmon01 install]# /u01/app/19c/grid/crs/install/rootcrs.sh -lock
  28. Using configuration parameter file: /u01/app/19c/grid/crs/install/crsconfig_params
  29. The log of current session can be found at:
  30. /u01/app/grid/crsdata/cesmon01/crsconfig/crslock_cesmon01_2022-06-24_12-34-11AM.log
  31. 2022/06/24 12:34:14 CLSRSC-329: Replacing Clusterware entries in file 'oracle-ohasd.service'
  32. [root@cesmon01 install]# /u01/app/19c/grid/bin/crsctl start has
  33. CRS-4123: Oracle High Availability Services has been started.
  34. 升级数据库
  35. /u01/app/oracle/product/19c/db_1/OPatch/opatchauto apply /u01/app/install/32126842/32226239 -oh /u01/app/oracle/product/19c/db_1