1.所需文件
p6880880_122010_Linux-x86-64.zip
p32126842_190000_Linux-x86-64.zip
2.查看OPatch版本
/u01/app/19.3.0.0/OPatch
[root@rac1 OPatch]# ./opatchauto version
Oracle OPatchAuto Version 13.9.4.2.0
Copyright (c) 2016, Oracle Corporation. All rights reserved.
1. OPatchAuto version 13.9.4.2.0
2. OpatchautoDB version 12.2.0.1.17
3.保存并替换OPatch文件
tar -zcvf /setup/u01_app.tar.gz /u01/app
cp -r OPatch OPatch_BAk
rm -rf /u01/app/19.3.0.0/OPatch
cd /setup
unzip p6880880_122010_Linux-x86-64.zip
cp -r OPatch /u01/app/19.3.0.0
chown grid:oinstall /u01/app/19.3.0.0/OPatch -R
mv /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch_BAK
cp -r /setup/OPatch /u01/app/oracle/product/19.3.0.0/dbhome_1/
chown oracle:oinstall /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch -R
其他节点
rm -rf /u01/app/19.3.0.0/OPatch
rm -rf /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch
cd /setup
unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/19.3.0.0/
unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/oracle/product/19.3.0.0/dbhome_1/
chown grid:oinstall /u01/app/19.3.0.0/OPatch -R
chown oracle:oinstall /u01/app/oracle/product/19.3.0.0/dbhome_1/OPatch -R
4.oracle inventory 验证
su - grid
./opatch lspatches #查看验证现有补丁
或者使用
./opatch lsinventory -detail -oh /u01/app/19.3.0.0/
5.检查空间
su - grid
vi /tmp/patch_list_gihome.txt
/setup/32126842/32226239/32218454
/setup/32126842/32226239/32222571
/setup/32126842/32226239/32218663
/setup/32126842/32226239/29340594
/setup/32126842/32226239/32240590
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
[grid@rac1 32126842]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/19.3.0.0
Central Inventory : /u01/app/oraInventory
from : /u01/app/19.3.0.0/oraInst.loc
OPatch version : 12.2.0.1.24
OUI version : 12.2.0.7.0
Log file location : /u01/app/19.3.0.0/cfgtoollogs/opatch/opatch2021-08-27_02-28-09AM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
su - oracle
vi /tmp/patch_list_dbhome.txt
/setup/32126842/32226239/32218454
/setup/32126842/32226239/32222571
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2021, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/19.3.0.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19.3.0.0/dbhome_1/oraInst.loc
OPatch version : 12.2.0.1.24
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatch/opatch2021-08-27_02-32-11AM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
6.冲突检测
su - grid
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218454
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32222571
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218663
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/29340594
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32240590
su - oracle
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32218454
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /setup/32126842/32226239/32222571
##########确认所有执行都是返回OPatch succeeded###############################
7.检查各个节点oui-patch.xml文件
没有则复制其他节点文件过去
cd /u01/app/oraInventory/ContentsXML
[root@olrac1 ContentsXML]# ll
total 16
-rwxrwxrwx 1 grid oinstall 300 Mar 18 2020 comps.xml
-rwxrwxrwx 1 grid oinstall 623 Aug 22 2020 inventory.xml
-rwxrwxrwx 1 grid oinstall 292 Mar 18 2020 libs.xml
-rwxrwxrwx 1 grid oinstall 174 Mar 18 2020 oui-patch.xml
scp oui-patch.xml grid@192.168.5.132:/u01/app/oraInventory/ContentsXML/
chmod 660 oui-patch.xml
8.补丁分析
su - root
/u01/app/19.3.0.0/grid/OPatch/opatchauto apply /setup/32126842/32226239 -analyze
9.执行补丁安装
[root@olrac1 ~]# /u01/app/19.3.0.0/grid/OPatch/opatchauto apply /setup/32126842/32226239
OPatchauto session is initiated at Sat Aug 28 03:20:34 2021
System initialization log file is /u01/app/19.3.0.0/grid/cfgtoollogs/opatchautodb/systemconfig2021-08-28_03-20-42AM.log.
Session log file is /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/opatchauto2021-08-28_03-22-20AM.log
The id for this session is 25G2
Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Executing OPatch prereq operations to verify patch applicability on home /u01/app/19.3.0.0/grid
Patch applicability verified successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Patch applicability verified successfully on home /u01/app/19.3.0.0/grid
Executing patch validation checks on home /u01/app/19.3.0.0/grid
Patch validation checks successfully completed on home /u01/app/19.3.0.0/grid
Executing patch validation checks on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Patch validation checks successfully completed on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Verifying SQL patch applicability on home /u01/app/oracle/product/19.3.0.0/dbhome_1
SQL patch applicability verified successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Preparing to bring down database service on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Successfully prepared home /u01/app/oracle/product/19.3.0.0/dbhome_1 to bring down database service
Performing prepatch operations on CRS - bringing down CRS service on home /u01/app/19.3.0.0/grid
Prepatch operation log file location: /u01/app/grid/crsdata/olrac1/crsconfig/crs_prepatch_apply_inplace_olrac1_2021-08-28_03-25-00AM.log
CRS service brought down successfully on home /u01/app/19.3.0.0/grid
Performing prepatch operation on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Perpatch operation completed successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Start applying binary patch on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Binary patch applied successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Performing postpatch operation on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Postpatch operation completed successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
Start applying binary patch on home /u01/app/19.3.0.0/grid
Binary patch applied successfully on home /u01/app/19.3.0.0/grid
Performing postpatch operations on CRS - starting CRS service on home /u01/app/19.3.0.0/grid
Postpatch operation log file location: /u01/app/grid/crsdata/olrac1/crsconfig/crs_postpatch_apply_inplace_olrac1_2021-08-28_03-55-00AM.log
CRS service started successfully on home /u01/app/19.3.0.0/grid
Preparing home /u01/app/oracle/product/19.3.0.0/dbhome_1 after database service restarted
No step execution required.........
Trying to apply SQL patch on home /u01/app/oracle/product/19.3.0.0/dbhome_1
SQL patch applied successfully on home /u01/app/oracle/product/19.3.0.0/dbhome_1
OPatchAuto successful.
--------------------------------Summary--------------------------------
Patching is completed successfully. Please find the summary as follows:
Host:olrac1
RAC Home:/u01/app/oracle/product/19.3.0.0/dbhome_1
Version:19.0.0.0.0
Summary:
==Following patches were SKIPPED:
Patch: /setup/32126842/32226239/32218663
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /setup/32126842/32226239/29340594
Reason: This patch is not applicable to this specified target type - "rac_database"
Patch: /setup/32126842/32226239/32240590
Reason: This patch is not applicable to this specified target type - "rac_database"
==Following patches were SUCCESSFULLY applied:
Patch: /setup/32126842/32226239/32218454
Log: /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-31-29AM_1.log
Patch: /setup/32126842/32226239/32222571
Log: /u01/app/oracle/product/19.3.0.0/dbhome_1/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-31-29AM_1.log
Host:olrac1
CRS Home:/u01/app/19.3.0.0/grid
Version:19.0.0.0.0
Summary:
==Following patches were SUCCESSFULLY applied:
Patch: /setup/32126842/32226239/29340594
Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
Patch: /setup/32126842/32226239/32218454
Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
Patch: /setup/32126842/32226239/32218663
Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
Patch: /setup/32126842/32226239/32222571
Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
Patch: /setup/32126842/32226239/32240590
Log: /u01/app/19.3.0.0/grid/cfgtoollogs/opatchauto/core/opatch/opatch2021-08-28_03-40-50AM_1.log
OPatchauto session completed at Sat Aug 28 04:08:48 2021
Time taken to complete the session 48 minutes, 15 seconds
/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/
/u01/app/19.3.0.0/OPatch/opatchauto rollback /setup/32126842/32226239
rollback
/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]
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
安装lsof 命令
yum install lsof -y
lsof /u01/app/19c/grid/lib/libclntsh.so.19.1
[root@cesmon01 install]# lsof /u01/app/19c/grid/lib/libclntsh.so.19.1
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 22303 grid mem REG 8,33 79942576 3019450 /u01/app/19c/grid/lib/libclntsh.so.19.1
[root@cesmon01 install]# kill -9 22303
重新运行升级脚本发现集群未启动不能升级
手动逐个升级
su - grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/29340594 -oh /u01/app/19c/grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32218454 -oh /u01/app/19c/grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32218663 -oh /u01/app/19c/grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32222571 -oh /u01/app/19c/grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32226239/32240590 -oh /u01/app/19c/grid
/u01/app/19c/grid/OPatch/opatch apply /u01/app/install/32126842/32067171 -oh /u01/app/19c/grid
升级完启动集群报错
[root@cesmon01 install]# /u01/app/19c/grid/bin/crsctl start has
CRS-6706: Oracle Clusterware Release patch level ('1944883066') does not match Software patch level ('724960844'). Oracle Clusterware cannot be started.
CRS-4000: Command Start failed, or completed with errors.
/u01/app/19c/grid/bin/clscfg -localpatch
/u01/app/19c/grid/crs/install/rootcrs.sh -lock
[root@cesmon01 install]# /u01/app/19c/grid/bin/clscfg -localpatch
clscfg: EXISTING configuration version 0 detected.
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
[root@cesmon01 install]# /u01/app/19c/grid/crs/install/rootcrs.sh -lock
Using configuration parameter file: /u01/app/19c/grid/crs/install/crsconfig_params
The log of current session can be found at:
/u01/app/grid/crsdata/cesmon01/crsconfig/crslock_cesmon01_2022-06-24_12-34-11AM.log
2022/06/24 12:34:14 CLSRSC-329: Replacing Clusterware entries in file 'oracle-ohasd.service'
[root@cesmon01 install]# /u01/app/19c/grid/bin/crsctl start has
CRS-4123: Oracle High Availability Services has been started.
升级数据库
/u01/app/oracle/product/19c/db_1/OPatch/opatchauto apply /u01/app/install/32126842/32226239 -oh /u01/app/oracle/product/19c/db_1