opatch打补丁,RAC19C

oracle打补丁,适合新手,按照官方文档   我这里是19c rac

********做好备份**********

安装补丁前(节点2一样此处略)

[oracle@bms-10 ~]$ opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.
[oracle@bms-10 ~]$ opatch lspatches
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
29517242;Database Release Update : 19.3.0.0.190416 (29517242)
OPatch succeeded.
[oracle@bms-10 ~]$  opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.17
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.17
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_11-51-51AM_1.log
Lsinventory Output file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/lsinv/lsinventory2022-01-19_11-51-51AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: bms-10
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):
Oracle Database 19c                                                  19.0.0.0.0
There are 1 products installed in this Oracle Home.
Interim patches (2) :
Patch  29585399     : applied on Thu Apr 18 15:21:33 CST 2019
Unique Patch ID:  22840393
Patch description:  "OCW RELEASE UPDATE 19.3.0.0.0 (29585399)"
   Created on 9 Apr 2019, 19:12:47 hrs PST8PDT
   Bugs fixed:
     27222128, 27572040, 27604329, 27760043, 27877830, 28302580, 28470673
     28621543, 28642469, 28699321, 28710663, 28755846, 28772816, 28785321
     28800508, 28808652, 28815557, 28847541, 28847572, 28870496, 28871040
     28874416, 28877252, 28881191, 28881848, 28888083, 28911140, 28925250
     28925460, 28935956, 28940472, 3, 28942694, 28951332, 28963036, 28968779
     28980448, 28995287, 29003207, 29003617, 29016294, 29018680, 29024876
     29026154, 29027933, 29047127, 29052850, 29058476, 29111631, 29112455
     29117337, 29123444, 29125708, 29125786, 29129476, 29131772, 29132456
     29139727, 29146157, 29147849, 29149170, 29152603, 29152752, 29154631
     29154636, 29154829, 29159216, 29159661, 29160462, 29161923, 29169540
     29169739, 29170717, 29173618, 29181568, 29182920, 29183298, 29186091
     29191827, 29201143, 29201695, 29209545, 29210577, 29210610, 29210624
     29210683, 29213641, 29219627, 29224294, 29225861, 29229839, 29235934
     29242906, 29243749, 29244495, 29244766, 29244968, 29248723, 29249583
     29251564, 29255616, 29260224, 29261695, 29271019, 29273360, 29282090
     29282666, 29285453, 29285621, 29290235, 29292232, 29293806, 29294753
     29299830, 29307090, 29307109, 29311336, 29329675, 29330791, 29339299
     29357821, 29360467, 29360775, 29367971, 29368725, 29379299, 29379381
     29380527, 29381000, 29382296, 29391301, 29393649, 29402110, 29411931
     29413360, 29457319, 29465047
Patch  29517242     : applied on Thu Apr 18 15:21:17 CST 2019
Unique Patch ID:  22862832
Patch description:  "Database Release Update : 19.3.0.0.190416 (29517242)"
   Created on 17 Apr 2019, 23:27:10 hrs PST8PDT
   Bugs fixed:
     29515240, 14735102, 19697993, 20313356, 21965541, 25806201, 25883179
     25986062, 26476244, 26611353, 26872233, 27369515, 27423500, 27666312
     27710072, 27846298, 27957203, 28064977, 28072567, 28129791, 28181021
     28210681, 28279456, 28313275, 28350595, 28371123, 28379065, 28431445
     28463226, 28489419, 28502773, 28513333, 28534475, 28561704, 28569897
     28572533, 28572544, 28587723, 28593682, 28594086, 28597221, 28601957
     28605066, 28606598, 28625862, 28627033, 28636532, 28643718, 28644549
     28645570, 28646200, 28646939, 28649388, 28655209, 28663782, 28673945
     28692275, 28694872, 28696373, 28705231, 28710385, 28710734, 28714461
     28718469, 28730079, 28740708, 28760206, 28772390, 28774416, 28777214
     28789531, 28791852, 28795551, 28802734, 28804517, 28810381, 28811560
     28815123, 28815355, 28819640, 28824482, 28833912, 28835937, 28862532
     28863432, 28873575, 28876253, 28876639, 28884931, 28888327, 28892794
     28897512, 28899663, 28901126, 28905457, 28907196, 28912691, 28915561
     28917080, 28918429, 28919145, 28922227, 28922532, 28922608, 28925634
     28925880, 28933158, 28936114, 28937717, 28938698, 28940179, 28940281
     28941901, 28942455, 28945421, 28945994, 28951533, 28952168, 28954762
     28955606, 28957292, 28957723, 28962775, 28965231, 28966444, 28974083
     28977322, 28983095, 28983486, 28986326, 28986481, 28988482, 28989306
     28993295, 28994307, 28996376, 29000000, 29001888, 29002927, 29003738
     29006318, 29006621, 29007321, 29007775, 29008035, 29011936, 29013475
     29014076, 29015118, 29017265, 29018655, 29019121, 29021063, 29021352
     29024552, 29026582, 29026606, 29027456, 29027694, 29027940, 29031575
     29031600, 29032234, 29032457, 29032607, 29033052, 29033145, 29033200
     29033280, 29034587, 29037290, 29038528, 29039089, 29039510, 29043554
     29043651, 29043725, 29044763, 29044954, 29047850, 29048289, 29048498
     29048605, 29050560, 29050765, 29051702, 29052726, 29053783, 29056024
     29056270, 29056560, 29059011, 29061959, 29062692, 29062848, 29062860
     29062868, 29110526, 29110783, 29110790, 29110797, 29110802, 29110805
     29111598, 29113282, 29113305, 29117526, 29117642, 29119077, 29120223
     29122224, 29122254, 29123297, 29123432, 29123482, 29124368, 29125380
     29126345, 29127957, 29128935, 29129450, 29129497, 29129712, 29130219
     29131539, 29132938, 29134447, 29136111, 29138641, 29141316, 29141341
     29141685, 29142667, 29144995, 29145214, 29145730, 29149829, 29150338
     29151520, 29152357, 29155099, 29157389, 29158680, 29158899, 29159909
     29159936, 29160174, 29162095, 29163415, 29163437, 29163524, 29163567
     29167111, 29167342, 29167374, 29167940, 29168219, 29168433, 29169073
     29169215, 29171942, 29172618, 29172826, 29173140, 29173373, 29173817
     29174004, 29176318, 29177466, 29177543, 29177886, 29178385, 29180313
     29180455, 29180559, 29180893, 29181153, 29181231, 29181620, 29181743
     29181923, 29182019, 29183912, 29184297, 29184666, 29185193, 29186456
     29189302, 29189307, 29189889, 29190235, 29190474, 29190740, 29191541
     29192419, 29192468, 29192685, 29193207, 29194205, 29194367, 29194493
     29194827, 29195279, 29195337, 29195758, 29196725, 29199635, 29199733
     29200316, 29200700, 29201494, 29201539, 29202104, 29202850, 29203122
     29203166, 29203425, 29203443, 29203604, 29205281, 29205323, 29205419
     29205463, 29205767, 29205918, 29206109, 29206605, 29207073, 29208260
     29208732, 29211457, 29211724, 29212012, 29212433, 29212611, 29213351
     29213775, 29213850, 29213879, 29214561, 29214960, 29216746, 29216984
     29217294, 29217472, 29217828, 29217848, 29218570, 29219205, 29219273
     29220079, 29221248, 29221891, 29222031, 29222784, 29223833, 29223859
     29223967, 29224065, 29224605, 29225076, 29227602, 29228869, 29229164
     29229754, 29229844, 29229955, 29230252, 29230565, 29231133, 29232117
     29232154, 29234123, 29237538, 29240307, 29241345, 29242017, 29242884
     29243958, 29245137, 29245160, 29246163, 29247415, 29247712, 29247906
     29248552, 29248835, 29248858, 29249991, 29250059, 29251259, 29253184
     29253871, 29254031, 29254930, 29255178, 29255273, 29255431, 29255435
     29256426, 29259119, 29259320, 29261906, 29262512, 29262887, 29265448
     29266248, 29266899, 29267292, 29268412, 29269171, 29270585, 29273539
     29273735, 29273847, 29274428, 29274564, 29274627, 29275461, 29278218
     29279658, 29279751, 29279854, 29282898, 29285503, 29285788, 29285956
     29286037, 29287130, 29287705, 29292837, 29293072, 29297863, 29297915
     29298220, 29299049, 29299082, 29299844, 29301566, 29302963, 29303918
     29304781, 29311588, 29312310, 29312734, 29312753, 29313347, 29313417
     29313525, 29314539, 29318410, 29319441, 29321489, 29323946, 29324568
     29325087, 29325105, 29325257, 29325993, 29327044, 29329087, 29331209
     29331380, 29331493, 29332771, 29333500, 29337310, 29338315, 29338453
     29338780, 29338913, 29339155, 29341209, 29343086, 29346943, 29347620
     29348176, 29350052, 29351386, 29351716, 29351749, 29352867, 29353271
     29355654, 29356547, 29356752, 29358828, 29360672, 29361801, 29363151
     29364171, 29364177, 29367019, 29367561, 29368253, 29373418, 29373588
     29374179, 29377986, 29378029, 29379978, 29382784, 29385652, 29386502
     29386635, 29386660, 29387274, 29388094, 29388524, 29388830, 29389889
     29390435, 29394140, 29394749, 29397954, 29398863, 29399100, 29399121
     29405012, 29405651, 29412066, 29412269, 29417884, 29423826, 29429264
     29429566, 29431485, 29435652, 29438736, 29439522, 29450421, 29451386
     29452576, 29452953, 29457807, 29460252, 29462957, 29486181, 29507616
     29521748, 29530812, 29531654, 29557336, 29558975, 29601461
--------------------------------------------------------------------------------
OPatch succeeded.
[oracle@bms-10 ~]$


所以安装前,有2个补丁。

[oracle@bms-10 ~]$ opatch lspatches

29585399 ;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)

29517242 ;Database Release Update : 19.3.0.0.190416 (29517242)


OPatch succeeded.


######################################################

我这里下载的是这个补丁集 p32126842_190000_Linux-x86-64.zip解压,根据里面的readme.html来操作


[root@bms-10 32126842]# ls
32067171  32226239  PatchSearch.xml  README.html
[root@bms-10 32126842]# pwd
/root/32126842

进入解压后的文件夹,浏览器打开README.html

Patch 32126842 - Combo of OJVM Component Release Update 19.10.0.0.210119 + Grid Infrastructure Jan 2021 Release Update 19.10.0.0.210119

1.1 About the Combo Patch

Patch   32226239   - Database Grid Infrastructure Jan 2021 Release Update   19.10.0.0.210119

Patch  32067171  - Oracle JavaVM Component Release Update  19.10.0.0.210119  

1.2 Installing the Combo Patch

根据子目录中的对应readme文件安装对应的补丁


安装补丁Patch 32226239 - GI Release Update 19.10.0.0.210119        看对应的readme.html

1.1 Patch            Information


我们这里都需要打上。

1.2 Patch            Installation and Deinstallation

1.2.1 Patch            Installation Prerequisites

1.2.1.1 OPatch            Utility Information 

You must use the OPatch utility version 12.2.0.1.23 or later to apply this patch for all platforms.

这里最低需要23版本,我这里不满足,需要升级。

To update Opatch, use the following instructions:

  1. Download the OPatch utility to a temporary directory.

  2. For each Oracle RAC database home and the GI home that are                  being patched, run the following commands as the home owner to                  extract the OPatch utility.

    $ unzip  -d /OPatch/opatch version

所以我这里需要升级4个地方,两节点  grid 和oracle目录的opatch版本

a、先备份4处的原来版本

[root@bms-10 32126842]# mv /u01/app/oracle/product/19c/db_1/OPatch/ /u01/app/oracle/product/19c/db_1/OPatch.BAK17
[root@bms-10 32126842]# mv /u01/app/19c/grid/OPatch/ /u01/app/19c/grid/OPatch.BAK17
[root@bms-9 ~]# mv /u01/app/oracle/product/19c/db_1/OPatch/ /u01/app/oracle/product/19c/db_1/OPatch.BAK17
[root@bms-9 ~]# mv /u01/app/19c/grid/OPatch/ /u01/app/19c/grid/OPatch.BAK17

b、解压新的版本到相应目录

[root@bms-10 ~]# unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/19c/db_1/
[root@bms-10 ~]# unzip p6880880_122010_Linux-x86-64.zip -d  /u01/app/19c/grid/
[root@bms-9 ~]# unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/19c/db_1/
[root@bms-9 ~]# unzip p6880880_122010_Linux-x86-64.zip -d  /u01/app/19c/grid/

c、更改权限

[root@bms-9 ~]#   chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1/OPatch/
[root@bms-9 ~]#   chown -R grid:oinstall   /u01/app/19c/grid/OPatch/
[root@bms-10 ~]#  chown -R oracle:oinstall /u01/app/oracle/product/19c/db_1/OPatch/
[root@bms-10 ~]# chown -R grid:oinstall   /u01/app/19c/grid/OPatch/

测试grid  oracle两节点opatch version  均为24 就ok了

[oracle@bms-10 ~]$ opatch version
OPatch Version: 12.2.0.1.24
OPatch succeeded.


1.2.1.2 Validation            of Oracle Inventory

Before beginning patch application, check the consistency of              inventory information for GI home and each database home to be              patched. Run the following command as respective Oracle home owner              to check the consistency.

/OPatch/opatch lsinventory -detail -oh 
[oracle@bms-10 ~]$ opatch lsinventory -detail -oh $ORACLE_HOME
俩节点,oracle 和grid都执行一下没有报错即可。


1.2.1.3 Download            and Unzip the Patch

按文档,创建一个空的文件夹,给读的权限给oinstall组,谁需要打补丁,用哪个账户解压。

[root@bms-10 ~]# mkdir /soft
[root@bms-10 ~]# unzip p32126842_190000_Linux-x86-64.zip -d /soft
[root@bms-10 ~]# chmod 777 /soft
[root@bms-10 ~]# chown -R grid:oinstall /soft

同理节点2也这样操作

1.2.1.4 Run            OPatch Conflict Check

Determine whether any currently installed one-off patches              conflict with this patch 32226239 as              follows:

  • For Grid Infrastructure Home, as home user:

    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32218454
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32222571
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32218663
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/29340594
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32240590
  • For Database home, as home user:

    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32218454
    % $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /32226239/32222571
grid
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218454
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32222571
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218663
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/29340594
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32240590
oracle
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218454
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32222571


1.2.1.5 Run            OPatch SystemSpace Check   空间确认(2节点)

  • For Grid Infrastructure Home, as home user:

    1. Create file /tmp/patch_list_gihome.txt                      with the following content:

      % cat /tmp/patch_list_gihome.txt
      /soft/32126842/32226239/32218454
      /soft/32126842/32226239/32222571
      /soft/32126842/32226239/32218663
      /soft/32126842/32226239/29340594
      /soft/32126842/32226239/32240590
    2. Run the opatch command to check if enough free space is                      available in the Grid Infrastructure Home:

      % $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
  • For Database home, as home user:

    1. Create file /tmp/patch_list_dbhome.txt                      with the following content:

      % cat /tmp/patch_list_dbhome.txt
      /soft/32126842/32226239/32218454
      /soft/32126842/32226239/32222571
    2. Run opatch command to check if enough free space is                      available in the Database Home:

      % $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
[grid@bms-10 ~]$ opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /u01/app/19c/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/19c/grid/oraInst.loc
OPatch version    : 12.2.0.1.24
OUI version       : 12.2.0.7.0
Log file location : /u01/app/19c/grid/cfgtoollogs/opatch/opatch2022-01-19_14-19-15PM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
[oracle@bms-10 ~]$ opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.24
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_14-19-44PM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.



1.2.2 One-off            Patch Conflict Detection and Resolution

1.2.3 opatchauto

The Opatch utility has automated the patch application for the              Oracle Grid Infrastructure (GI) home and the Oracle RAC database              homes

The utility must be executed by an operating system (OS) user              with root privileges, and it must be              executed on each node in the cluster if the GI home or Oracle RAC              database home is in non-shared storage. The utility should not be              run in parallel on the cluster nodes.


根据上面的我们知道我们使用这个,且需要用root账户,但是不能同时打补丁,需要一个节点一个节点来。

Add the directory containing the opatchauto to the $PATH              environment variable. For example:

# export PATH=$PATH:/OPatch

To patch the GI home and all Oracle RAC database homes of the              same version:

# opatchauto apply /32226239


我这里直接将opatch添加到root账户的环境变量里去。(俩节点)

[root@bms-10 ~]# cat .bash_profile

# .bash_profile


# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

# User specific environment and startup programs

PATH=/u01/app/19c/grid/bin:$PATH: /u01/app/19c/grid/OPatch:$HOME/bin

export PATH


1.2.4 Patch            Installation

Patching Oracle RAC Database Homes and GI                Together

  • Case 1: Oracle RAC, where the GI Home and                    the Database Homes are not shared and ACFS file system is                    not configured.

    As root user, execute the following command on each node of                  the cluster:

    /OPatch/opatchauto apply /32226239

我们属于case1.

节点1先打

[root@bms-10 ~]# opatchauto apply /soft/32126842/32226239/
OPatchauto session is initiated at Wed Jan 19 14:56:48 2022
System initialization log file is /u01/app/19c/grid/cfgtoollogs/opatchautodb/systemconfig2022-01-19_02-56-51PM.log.
Session log file is /u01/app/19c/grid/cfgtoollogs/opatchauto/opatchauto2022-01-19_02-57-49PM.log
The id for this session is CR51
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19c/db_1
Executing OPatch prereq operations to verify patch applicability on home /u01/app/19c/grid
Patch applicability verified successfully on home /u01/app/oracle/product/19c/db_1
Patch applicability verified successfully on home /u01/app/19c/grid
Executing patch validation checks on home /u01/app/19c/grid
Patch validation checks successfully completed on home /u01/app/19c/grid
Executing patch validation checks on home /u01/app/oracle/product/19c/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19c/db_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19c/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19c/db_1
Preparing to bring down database service on home /u01/app/oracle/product/19c/db_1
Successfully prepared home /u01/app/oracle/product/19c/db_1 to bring down database service
Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19c/grid
Prepatch operation log file location: /u01/app/grid/crsdata/bms-10/crsconfig/crs_prepatch_apply_inplace_bms-10_2022-01-19_02-59-19PM.log
CRS service brought down successfully on home /u01/app/19c/grid
Performing prepatch operation on home /u01/app/oracle/product/19c/db_1
Perpatch operation completed successfully on home /u01/app/oracle/product/19c/db_1
Start applying binary patch on home /u01/app/oracle/product/19c/db_1
Binary patch applied successfully on home /u01/app/oracle/product/19c/db_1
Performing postpatch operation on home /u01/app/oracle/product/19c/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19c/db_1
Start applying binary patch on home /u01/app/19c/grid
Binary patch applied successfully on home /u01/app/19c/grid
Performing postpatch operations on CRS - starting CRS service on home /u01/app/19c/grid
Postpatch operation log file location: /u01/app/grid/crsdata/bms-10/crsconfig/crs_postpatch_apply_inplace_bms-10_2022-01-19_03-12-04PM.log
CRS service started successfully on home /u01/app/19c/grid
Preparing home /u01/app/oracle/product/19c/db_1 after database service restarted
No step execution required.........
 
Trying to apply SQL patch on home /u01/app/oracle/product/19c/db_1
SQL patch applied successfully on home /u01/app/oracle/product/19c/db_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:bms-10
RAC Home:/u01/app/oracle/product/19c/db_1
Version:19.0.0.0.0
Summary:
==Following patches were SKIPPED:
Patch: /soft/32126842/32226239/32218663
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /soft/32126842/32226239/29340594
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /soft/32126842/32226239/32240590
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:
Patch: /soft/32126842/32226239/32218454
Log: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-03-01PM_1.log
Patch: /soft/32126842/32226239/32222571
Log: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-03-01PM_1.log
Host:bms-10
CRS Home:/u01/app/19c/grid
Version:19.0.0.0.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /soft/32126842/32226239/29340594
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-06-18PM_1.log
Patch: /soft/32126842/32226239/32218454
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-06-18PM_1.log
Patch: /soft/32126842/32226239/32218663
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-06-18PM_1.log
Patch: /soft/32126842/32226239/32222571
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-06-18PM_1.log
Patch: /soft/32126842/32226239/32240590
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-06-18PM_1.log
OPatchauto session completed at Wed Jan 19 15:17:00 2022
Time taken to complete the session 20 minutes, 12 seconds
[root@bms-10 ~]#

打rac第二节点,确认之前的那些操作在第二节点也做了


[root@bms-9 ~]# opatchauto apply /soft/32126842/32226239/
OPatchauto session is initiated at Wed Jan 19 15:30:18 2022
System initialization log file is /u01/app/19c/grid/cfgtoollogs/opatchautodb/systemconfig2022-01-19_03-30-20PM.log.
Session log file is /u01/app/19c/grid/cfgtoollogs/opatchauto/opatchauto2022-01-19_03-30-49PM.log
The id for this session is 632Y
Executing OPatch prereq operations to verify patch applicability on home /u01/app/19c/grid
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19c/db_1
Patch applicability verified successfully on home /u01/app/oracle/product/19c/db_1
Patch applicability verified successfully on home /u01/app/19c/grid
Executing patch validation checks on home /u01/app/19c/grid
Patch validation checks successfully completed on home /u01/app/19c/grid
Executing patch validation checks on home /u01/app/oracle/product/19c/db_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19c/db_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19c/db_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19c/db_1
Preparing to bring down database service on home /u01/app/oracle/product/19c/db_1
Successfully prepared home /u01/app/oracle/product/19c/db_1 to bring down database service
Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19c/grid
Prepatch operation log file location: /u01/app/grid/crsdata/bms-9/crsconfig/crs_prepatch_apply_inplace_bms-9_2022-01-19_03-32-20PM.log
CRS service brought down successfully on home /u01/app/19c/grid
Performing prepatch operation on home /u01/app/oracle/product/19c/db_1
Perpatch operation completed successfully on home /u01/app/oracle/product/19c/db_1
Start applying binary patch on home /u01/app/oracle/product/19c/db_1
Binary patch applied successfully on home /u01/app/oracle/product/19c/db_1
Performing postpatch operation on home /u01/app/oracle/product/19c/db_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19c/db_1
Start applying binary patch on home /u01/app/19c/grid
Failed while applying binary patches on home /u01/app/19c/grid
Execution of [OPatchAutoBinaryAction] patch action failed, check log for more details. Failures:
Patch Target : bms-9->/u01/app/19c/grid Type[crs]
Details: [
---------------------------Patching Failed---------------------------------
Command execution failed during patching in home: /u01/app/19c/grid, host: bms-9.
Command failed:  /u01/app/19c/grid/OPatch/opatchauto  apply /soft/32126842/32226239/ -oh /u01/app/19c/grid -target_type cluster -binary -invPtrLoc /u01/app/19c/grid/oraInst.loc -jre /u01/app/19c/grid/OPatch/jre -persistresult /u01/app/19c/grid/opatchautocfg/db/sessioninfo/sessionresult_bms-9_crs_1.ser -analyzedresult /u01/app/19c/grid/opatchautocfg/db/sessioninfo/sessionresult_analyze_bms-9_crs_1.ser
Command failure output: 
==Following patches FAILED in apply:
Patch: /soft/32126842/32226239/29340594
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-39-10PM_1.log
Reason: Failed during Patching: oracle.opatch.opatchsdk.OPatchException: ApplySession failed in system modification phase... 'ApplySession::apply failed: java.io.IOException: oracle.sysman.oui.patch.PatchException: java.io.FileNotFoundException: /u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)' 
After fixing the cause of failure Run opatchauto resume
]
OPATCHAUTO-68061: The orchestration engine failed.
OPATCHAUTO-68061: The orchestration engine failed with return code 1
OPATCHAUTO-68061: Check the log for more details.
OPatchAuto failed.
OPatchauto session completed at Wed Jan 19 15:39:48 2022
Time taken to complete the session 9 minutes, 31 seconds
 opatchauto failed with error code 42
[root@bms-9 ~]# ^C

报错了################################

/u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)'

对比第一个节点看是否权限问题

节点1
[root@bms-10 ~]# cd /u01/app/oraInventory/ContentsXML/
[root@bms-10 ContentsXML]# ll
total 16
-rw-rw---- 1 grid oinstall 300 Jan 19 15:11 comps.xml
-rw-rw---- 1 grid oinstall 551 Jan  4 11:42 inventory.xml
-rw-rw---- 1 grid oinstall 292 Jan 19 15:11 libs.xml
-rw-rw---- 1 grid oinstall 174 Jan 19 15:11 oui-patch.xml
[root@bms-10 ContentsXML]#
节点2
[root@bms-9 ContentsXML]# ll
total 20
-rw-rw---- 1 grid   oinstall 300 Jan 19 15:39 comps.xml
-rw-rw---- 1 grid   oinstall 551 Jan  4 11:43 inventory.xml
-rw-rw---- 1 grid   oinstall 292 Jan 19 15:39 libs.xml
-rw-r--r-- 1 grid     oinstall 174 Jan 19 15:39 oui-patch.xml
-rw-r--r-- 1 grid   oinstall 174 Jan 19 15:39 oui-patch.xml.back

所以节点2上操作

[root@bms-9 ContentsXML]# chmod 660 oui-patch.xml


根据提示继续节点二继续执行

[root@bms-9 ~]# opatchauto resume
OPatchauto session is initiated at Wed Jan 19 15:50:13 2022
Session log file is /u01/app/19c/grid/cfgtoollogs/opatchauto/opatchauto2022-01-19_03-50-13PM.log
Resuming existing session with id 632Y
Start applying binary patch on home /u01/app/19c/grid
Failed while applying binary patches on home /u01/app/19c/grid
Execution of [OPatchAutoBinaryAction] patch action failed, check log for more details. Failures:
Patch Target : bms-9->/u01/app/19c/grid Type[crs]
Details: [
---------------------------Patching Failed---------------------------------
Command execution failed during patching in home: /u01/app/19c/grid, host: bms-9.
Command failed:  /u01/app/19c/grid/OPatch/opatchauto  apply /soft/32126842/32226239/ -oh /u01/app/19c/grid -target_type cluster -binary -invPtrLoc /u01/app/19c/grid/oraInst.loc -jre /u01/app/19c/grid/OPatch/jre -persistresult /u01/app/19c/grid/opatchautocfg/db/sessioninfo/sessionresult_bms-9_crs_1.ser -analyzedresult /u01/app/19c/grid/opatchautocfg/db/sessioninfo/sessionresult_analyze_bms-9_crs_1.ser
Command failure output: 
==Following patches FAILED in apply:
Patch: /soft/32126842/32226239/29340594
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-50-41PM_1.log
Reason: Failed during Analysis: CheckNApplyReport Failed, [ Prerequisite Status: FAILED, Prerequisite output: 
The details are:
Unable to create patchObject
Possible causes are:
   ORACLE_HOME/inventory/oneoffs/29340594 is corrupted. PatchObject constructor: Input file "/u01/app/19c/grid/inventory/oneoffs/29340594/etc/config/actions" or "/u01/app/19c/grid/inventory/oneoffs/29340594/etc/config/inventory" does not exist.
] 
After fixing the cause of failure Run opatchauto resume
]
OPATCHAUTO-68061: The orchestration engine failed.
OPATCHAUTO-68061: The orchestration engine failed with return code 1
OPATCHAUTO-68061: Check the log for more details.
OPatchAuto failed.
OPatchauto session completed at Wed Jan 19 15:50:44 2022
Time taken to complete the session 0 minute, 31 seconds
 opatchauto failed with error code 42
[root@bms-9 ~]#

又报错

/u01/app/19c/grid/inventory/oneoffs/29340594/etc/config/inventory" does not exist.

对比节点1和2

节点1
[root@bms-10 ContentsXML]# cd /u01/app/19c/grid/inventory/oneoffs
[root@bms-10 oneoffs]# ll
total 0
drwxr-xr-x 4 grid oinstall 29 Jan 19 15:06 29340594
drwxr-x--- 4 grid oinstall 29 Apr 18  2019 29401763
drwxr-x--- 4 grid oinstall 29 Apr 18  2019 29517242
drwxr-x--- 4 grid oinstall 29 Apr 18  2019 29517247
drwxr-x--- 4 grid oinstall 29 Apr 18  2019 29585399
drwxr-xr-x 4 grid oinstall 29 Jan 19 15:09 32218454
drwxr-xr-x 4 grid oinstall 29 Jan 19 15:10 32218663
drwxr-xr-x 4 grid oinstall 29 Jan 19 15:11 32222571
drwxr-xr-x 4 grid oinstall 29 Jan 19 15:11 32240590
节点2
[root@bms-9 ContentsXML]# cd /u01/app/19c/grid/inventory/oneoffs
[root@bms-9 oneoffs]# ll
total 0
drwxr-x--- 4 grid oinstall 29 Jan  4 10:18 29401763
drwxr-x--- 4 grid oinstall 29 Jan  4 10:18 29517242
drwxr-x--- 4 grid oinstall 29 Jan  4 10:18 29517247
drwxr-x--- 4 grid oinstall 29 Jan  4 10:18 29585399

手动拷贝1节点到2,注意要用grid用户,保证拷贝过去的权限

[grid@bms-10 oneoffs]$ scp -r 29340594 32218454 32218663 32222571 32240590 bms-9:/u01/app/19c/grid/inventory/oneoffs/
inventory.xml                                                                                                                                         100% 1956     2.7MB/s   00:00
actions.xml                                                                                                                                           100% 2081     3.6MB/s   00:00
inventory.xml                                                                                                                                         100%  425KB  52.3MB/s   00:00
actions.xml                                                                                                                                           100% 2606KB  84.1MB/s   00:00
inventory.xml                                                                                                                                         100%   24KB  28.7MB/s   00:00
actions.xml                                                                                                                                           100%   79KB  43.4MB/s   00:00
inventory.xml                                                                                                                                         100%  108KB  73.3MB/s   00:00
actions.xml                                                                                                                                           100%  230KB  65.2MB/s   00:00
inventory.xml                                                                                                                                         100% 2060     4.8MB/s   00:00
actions.xml                                                                                                                                           100% 2651     6.3MB/s   00:00
[grid@bms-10 oneoffs]$

节点2继续执行

[root@bms-9 ~]# opatchauto resume
OPatchauto session is initiated at Wed Jan 19 16:01:17 2022
Session log file is /u01/app/19c/grid/cfgtoollogs/opatchauto/opatchauto2022-01-19_04-01-17PM.log
Resuming existing session with id 632Y
Start applying binary patch on home /u01/app/19c/grid
Binary patch applied successfully on home /u01/app/19c/grid
Checking shared status of home.....
Performing postpatch operations on CRS - starting CRS service on home /u01/app/19c/grid
Postpatch operation log file location: /u01/app/grid/crsdata/bms-9/crsconfig/crs_postpatch_apply_inplace_bms-9_2022-01-19_04-07-55PM.log
CRS service started successfully on home /u01/app/19c/grid
Preparing home /u01/app/oracle/product/19c/db_1 after database service restarted
No step execution required.........
 
Trying to apply SQL patch on home /u01/app/oracle/product/19c/db_1
SQL patch applied successfully on home /u01/app/oracle/product/19c/db_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:bms-9
RAC Home:/u01/app/oracle/product/19c/db_1
Version:19.0.0.0.0
Summary:
==Following patches were SKIPPED:
Patch: /soft/32126842/32226239/32218663
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /soft/32126842/32226239/29340594
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /soft/32126842/32226239/32240590
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:
Patch: /soft/32126842/32226239/32218454
Log: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-35-53PM_1.log
Patch: /soft/32126842/32226239/32222571
Log: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_15-35-53PM_1.log
Host:bms-9
CRS Home:/u01/app/19c/grid
Version:19.0.0.0.0
Summary:
==Following patches were SKIPPED:
Patch: /soft/32126842/32226239/29340594
Reason: This patch is not applicable to this specified target type - "cluster"
==Following patches were SUCCESSFULLY applied:
Patch: /soft/32126842/32226239/32218454
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_16-01-45PM_1.log
Patch: /soft/32126842/32226239/32218663
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_16-01-45PM_1.log
Patch: /soft/32126842/32226239/32222571
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_16-01-45PM_1.log
Patch: /soft/32126842/32226239/32240590
Log: /u01/app/19c/grid/cfgtoollogs/opatchauto/core/opatch/opatch2022-01-19_16-01-45PM_1.log
OPatchauto session completed at Wed Jan 19 16:35:18 2022
Time taken to complete the session 34 minutes, 1 second
[root@bms-9 ~]#

终于俩节点补丁安装成功



1.2.5 Installing            patch in Standby-First Mode  此处不是 略

1.2.6 Patch            Post-Installation Instructions

1.2.6.1 Applying            Conflict Resolution Patches

1.2.6.2 Loading            Modified SQL Files into the Database

For a RAC environment, perform these steps on only                one node.



1、rac只需要在一个节点执行。按照上面右侧步骤执行。

[oracle@bms-10 ~]$ cd $ORACLE_HOME/OPatch
[oracle@bms-10 OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.10.0.0.0 Production on Wed Jan 19 16:47:49 2022
Copyright (c) 2012, 2020, Oracle.  All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_310403_2022_01_19_16_47_49/sqlpatch_invocation.log
Connecting to database...OK
Gathering database info...done
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of interim SQL patches:
  No interim patches found
Current state of release update SQL patches:
  Binary registry:
    19.10.0.0.0 Release_Update 210108185017: Installed
  PDB CDB$ROOT:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 19-JAN-22 04.35.07.339185 PM
  PDB PDB$SEED:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 19-JAN-22 04.35.11.217905 PM
  PDB PROD_PDB1:
    Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 04-JAN-22 04.34.31.963959 PM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    No interim patches need to be rolled back
    No release update patches need to be installed
    No interim patches need to be applied
  For the following PDBs: PROD_PDB1
    No interim patches need to be rolled back
    Patch 32218454 (Database Release Update : 19.10.0.0.210119 (32218454)):
      Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.10.0.0.0 Release_Update 210108185017
    No interim patches need to be applied
Installing patches...
Patch installation complete.  Total patches installed: 1
Validating logfiles...done
Patch 32218454 apply (pdb PROD_PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32218454/24018797/32218454_apply_PROD_PROD_PDB1_2022Jan19_16_48_21.log (no errors)
SQL Patching tool complete on Wed Jan 19 16:54:58 2022
[oracle@bms-10 OPatch]$


2、Check the following log files in $ORACLE_BASE/cfgtoollogs/sqlpatch/32218454/ for errors    

3、Any databases that have invalid objects after the execution                  of datapatch should have utlrp.sql run to revalidate those                  objects.   处理无效对象

For example:

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
[oracle@bms-10 OPatch]$ cd $ORACLE_HOME/rdbms/admin
[oracle@bms-10 admin]$ pwd
/u01/app/oracle/product/19c/db_1/rdbms/admin
[oracle@bms-10 admin]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 19 16:59:55 2022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
SQL> @utlrp.sql
Session altered.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2022-01-19 16:59:56
DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END              2022-01-19 16:59:59
DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
                  0
DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC>       logged into this table: they go into DBA_ERRORS instead.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
                          0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>

       

1.2.6.3            Upgrade Oracle Recovery Manager Catalog  没有安装  略



##############################################################


接下来安装Patch 32067171 - Oracle JavaVM Component Release Update 19.10.0.0.210119

同样根据里面的readme.html文件来

1.1 Patch Information

1.2 Prerequisites    都是2节点

根据里面的步骤确认,有些略过

我把这个上面解压的授权给oracle账户

[root@bms-10 32126842]# chown -R oracle:oinstall 32067171

8、冲突测试

[oracle@bms-10 32067171]$ pwd
/soft/32126842/32067171
[oracle@bms-10 32067171]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
PREREQ session
Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.24
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_17-05-43PM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.

9、If you can apply this patch to an Oracle RAC environment using an out-of-place approach, follow the instructions described for an Oracle RAC Rolling installation in Note . Shutdown of database services may not be required for this case. Otherwise for an Oracle RAC environment, shut down all the services (database, ASM, listeners, nodeapps, and CRS daemons) running                  from the Oracle home on all the nodes you want to patch. After                  all nodes are patched, start all services. OPatch is used on                  only one node at a time.

我这里把rac两节点都停掉。然后一个节点一个节点打补丁,全部节点打完,才可以启动服务。


1.3 Installation

  1.  Set your current directory to the directory where the patch                  is located and then run the OPatch utility by entering the                  following commands

  2. Install the patch by running the following command

  3. Verify whether the patch has been successfully installed by                  running the following command

  4. Start the services from the Oracle home.

  5. If there are errors, see .

[root@bms-10 ~]# crsctl stop crs
[root@bms-9 32126842]# crsctl stop crs

节点1

[oracle@bms-10 ~]$ cd /soft/32126842/32067171/
[oracle@bms-10 32067171]$ opatch apply
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.24
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_17-16-23PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   32067171
Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/19c/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '32067171' to OH '/u01/app/oracle/product/19c/db_1'
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.javavm.server.core, 19.0.0.0.0...
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
Patching component oracle.rdbms, 19.0.0.0.0...
Patching component oracle.javavm.client, 19.0.0.0.0...
Patch 32067171 successfully applied.
Log file location: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_17-16-23PM_1.log
OPatch succeeded.
[oracle@bms-10 32067171]$


节点2报错

/u01/app/oraInventory/ContentsXML/oui-patch.xml (Permission denied)

上一个补丁还需要把权限w加给oinstall组

[root@bms-9 32126842]# cd /u01/app/oraInventory/ContentsXML/
[root@bms-9 ContentsXML]# ll
total 20
-rw-rw---- 1 grid   oinstall 300 Jan 19 16:07 comps.xml
-rw-rw---- 1 grid   oinstall 551 Jan  4 11:43 inventory.xml
-rw-rw---- 1 grid   oinstall 292 Jan 19 16:07 libs.xml
-rw-r--r-- 1 grid   oinstall 174 Jan 19 16:07 oui-patch.xml
-rw-r--r-- 1 oracle oinstall 174 Jan 19 16:07 oui-patch.xml.back
[root@bms-9 ContentsXML]# chmod 660 oui-patch.xml
[root@bms-9 ContentsXML]# ll
total 20
-rw-rw---- 1 grid   oinstall 300 Jan 19 16:07 comps.xml
-rw-rw---- 1 grid   oinstall 551 Jan  4 11:43 inventory.xml
-rw-rw---- 1 grid   oinstall 292 Jan 19 16:07 libs.xml
-rw-rw---- 1 grid   oinstall 174 Jan 19 16:07 oui-patch.xml
-rw-r--r-- 1 oracle oinstall 174 Jan 19 16:07 oui-patch.xml.back



节点2重新执行。

[oracle@bms-9 32067171]$ opatch apply
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2022, Oracle Corporation.  All rights reserved.
Oracle Home       : /u01/app/oracle/product/19c/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/19c/db_1/oraInst.loc
OPatch version    : 12.2.0.1.24
OUI version       : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_17-29-07PM_1.log
Verifying environment and performing prerequisite checks...
The following patch(es) are duplicate patches with patches installed in the Oracle Home.
 [ 32067171]
You have already installed same patch(es) with same UPI(s) or same version(s).
These patch(es) will be skipped.
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product/19c/db_1/cfgtoollogs/opatch/opatch2022-01-19_17-29-07PM_1.log
OPatch completed with warnings.
[root@bms-10 ~]# crsctl start crs
[root@bms-9 ContentsXML]# crsctl start crs
然后把数据库都停掉。继续下面的步骤。

1.4 Postinstallation

1.4.1 Loading Modified SQL            Files Into the Database



根据说明一步一步操作,只需要在一个节点执行。

[root@bms-10 ~]# su - oracle
Last login: Wed Jan 19 17:20:24 CST 2022
[oracle@bms-10 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 19 17:35:42 2022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup ;
ORACLE instance started.
Total System Global Area 2.0186E+11 bytes
Fixed Size                 30404896 bytes
Variable Size            2.9528E+10 bytes
Database Buffers         1.7180E+11 bytes
Redo Buffers              506462208 bytes
Database mounted.
Database opened.
SQL> alter system set cluster_database=false scope=spfile;
System altered.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
[oracle@bms-10 ~]$ srvctl stop database -d prod
^C[oracle@bms-10 ~]$
[oracle@bms-10 ~]$ exit
logout
[root@bms-10 ~]# srvctl stop database -d prod
[root@bms-10 ~]# su - oracle
Last login: Wed Jan 19 17:35:38 CST 2022 on pts/0
[oracle@bms-10 ~]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 19 17:40:14 2022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> STARTUP UPGRADE
ORACLE instance started.
Total System Global Area 2.0186E+11 bytes
Fixed Size                 30404896 bytes
Variable Size            2.9528E+10 bytes
Database Buffers         1.7180E+11 bytes
Redo Buffers              506462208 bytes
Database mounted.
Database opened.
SQL>  alter pluggable database all open upgrade;
Pluggable database altered.
SQL> quit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
[oracle@bms-10 ~]$ cd $ORACLE_HOME/OPatch
[oracle@bms-10 OPatch]$ ./datapatch -verbose
SQL Patching tool version 19.10.0.0.0 Production on Wed Jan 19 17:41:33 2022
Copyright (c) 2012, 2020, Oracle.  All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_231998_2022_01_19_17_41_33/sqlpatch_invocation.log
Connecting to database...OK
Gathering database info...done
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of interim SQL patches:
Interim patch 32067171 (OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)):
  Binary registry: Installed
  PDB CDB$ROOT: Not installed
  PDB PDB$SEED: Not installed
  PDB PROD_PDB1: Not installed
Current state of release update SQL patches:
  Binary registry:
    19.10.0.0.0 Release_Update 210108185017: Installed
  PDB CDB$ROOT:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 19-JAN-22 04.35.07.339185 PM
  PDB PDB$SEED:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 19-JAN-22 04.35.11.217905 PM
  PDB PROD_PDB1:
    Applied 19.10.0.0.0 Release_Update 210108185017 successfully on 19-JAN-22 04.54.50.152281 PM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED PROD_PDB1
    No interim patches need to be rolled back
    No release update patches need to be installed
    The following interim patches will be applied:
      32067171 (OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171))
Installing patches...
Patch installation complete.  Total patches installed: 3
Validating logfiles...done
Patch 32067171 apply (pdb CDB$ROOT): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32067171/23947975/32067171_apply_PROD_CDBROOT_2022Jan19_17_41_47.log (no errors)
Patch 32067171 apply (pdb PDB$SEED): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32067171/23947975/32067171_apply_PROD_PDBSEED_2022Jan19_17_42_22.log (no errors)
Patch 32067171 apply (pdb PROD_PDB1): SUCCESS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/32067171/23947975/32067171_apply_PROD_PROD_PDB1_2022Jan19_17_42_22.log (no errors)
SQL Patching tool complete on Wed Jan 19 17:42:30 2022
[oracle@bms-10 OPatch]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 19 17:43:04 2022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 2.0186E+11 bytes
Fixed Size                 30404896 bytes
Variable Size            2.9528E+10 bytes
Database Buffers         1.7180E+11 bytes
Redo Buffers              506462208 bytes
Database mounted.
Database opened.
SQL> alter system set cluster_database=true scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
[oracle@bms-10 OPatch]$ exit
logout
[root@bms-10 ~]# srvctl start database -d prod
[root@bms-10 ~]# su - oracle
Last login: Wed Jan 19 17:40:09 CST 2022 on pts/0
[oracle@bms-10 ~]$ cd $ORACLE_HOME/rdbms/admin
[oracle@bms-10 admin]$
[oracle@bms-10 admin]$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 19 17:46:52 2022
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
SQL> @utlrp.sql
Session altered.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN              2022-01-19 17:46:55
DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#
PL/SQL procedure successfully completed.
TIMESTAMP
--------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END              2022-01-19 17:46:57
DOC> The following query reports the number of invalid objects.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#
OBJECTS WITH ERRORS
-------------------
                  0
DOC> The following query reports the number of exceptions caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC> Note: Typical compilation errors (due to coding errors) are not
DOC>       logged into this table: they go into DBA_ERRORS instead.
DOC>#
ERRORS DURING RECOMPILATION
---------------------------
                          0
Function created.
PL/SQL procedure successfully completed.
Function dropped.
PL/SQL procedure successfully completed.
SQL>



1.5 Post Installation            Instructions for Databases Created or Upgraded after Installation of            OJVM Update in the Oracle Home

You must execute the steps in              for any new database. There are no actions required for databases              that have been upgraded.


如果新建新的pdb还需要正对pdb执行一遍上面的  步骤。





最后重启下两节点集群,看是否ok,并查询一下补丁信息。

节点1

[grid@bms-10 ~]$ opatch lspatches
32240590;TOMCAT RELEASE UPDATE 19.0.0.0.0 (32240590)
32222571;OCW Interim patch for 32222571
32218663;ACFS RELEASE UPDATE 19.10.0.0.0 (32218663)
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
29340594;DBWLM RELEASE UPDATE 19.0.0.0.0 (29340594)
OPatch succeeded.
[grid@bms-10 ~]$ su - oracle
Password:
Last login: Wed Jan 19 17:50:24 CST 2022
[oracle@bms-10 ~]$ opatch lspatches
32067171;OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
32222571;OCW Interim patch for 32222571
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
OPatch succeeded.

节点2

[grid@bms-9 ~]$ opatch lspatches
32240590;TOMCAT RELEASE UPDATE 19.0.0.0.0 (32240590)
32222571;OCW Interim patch for 32222571
32218663;ACFS RELEASE UPDATE 19.10.0.0.0 (32218663)
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
29340594;DBWLM RELEASE UPDATE 19.0.0.0.0 (29340594)
OPatch succeeded.
[grid@bms-9 ~]$ su - oracle
Password:
Last login: Wed Jan 19 17:57:00 CST 2022
[oracle@bms-9 ~]$ opatch lspatches
32067171;OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
32222571;OCW Interim patch for 32222571
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
OPatch succeeded.


SQL> col ACTION_TIME format a50
SQL> col DESCRIPTION format a80
SQL> select patch_id,patch_type,action,status,action_time,description from dba_registry_sqlpatch;
  PATCH_ID PATCH_TYPE ACTION          STATUS                    ACTION_TIME                                        DESCRIPTION
---------- ---------- --------------- ------------------------- -------------------------------------------------- --------------------------------------------------------------------------------
  29517242 RU         APPLY           SUCCESS                   04-JAN-22 04.34.30.960683 PM                       Database Release Update : 19.3.0.0.190416 (29517242)
  32218454 RU         APPLY           SUCCESS                   19-JAN-22 04.35.07.339185 PM                       Database Release Update : 19.10.0.0.210119 (32218454)
  32067171 INTERIM    APPLY           SUCCESS                   19-JAN-22 05.42.30.273433 PM                       OJVM RELEASE UPDATE: 19.10.0.0.210119 (32067171)
SQL> select ACTION_TIME,VERSION,COMMENTS from dba_registry_history;
ACTION_TIME                                        VERSION                        COMMENTS
-------------------------------------------------- ------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
                                                   19                             RDBMS_19.10.0.0.0DBRU_LINUX.X64_201227
04-JAN-22 04.34.06.312800 PM                       19.0.0.0.0                     Patch applied on 19.3.0.0.0: Release_Update - 190410122720
19-JAN-22 04.28.23.007529 PM                       19.0.0.0.0                     Patch applied from 19.3.0.0.0 to 19.10.0.0.0: Release_Update - 210108185017
19-JAN-22 05.42.20.595508 PM                       19.10.0.0.210119OJVMRU         RAN jvmpsu.sql
19-JAN-22 05.42.20.605280 PM                       19.10.0.0.210119OJVMRU         OJVM RU post-install



所以确认升级成功了。

























请使用浏览器的分享功能分享到微信等