简洁版,只保留了命令,删除了输出!
其他版本的patch也是一样的 只需吧patch number 变为你需要升级的RU 即可,
19c最近一年RU的patch number 请参考我另外一篇博文
1.检查集群状态
-------------------------------------------------
2---更新grid opatch 两个节点 root执行
mv /u01/app/19.3.0.0/grid/OPatch /u01/app/19.3.0.0/grid/OPatch.bak --备份opatch
unzip -q /u01/app/p6880880_190000_Linux-x86-64.zip -d /u01/app/19.3.0.0/grid/ --更新opatch
chmod -R 755 /u01/app/19.3.0.0/grid/OPatch
chown -R grid:oinstall /u01/app/19.3.0.0/grid/OPatch
[grid@nssuzvwit59db1prod ~]$ opatch version --更新后检查opatch的版本 至少30
OPatch Version: 12.2.0.1.32
OPatch succeeded.
[grid@nssuzvwit59db1prod ~]$
3---更新oracle opatch 两个节点 root执行
mv /u01/app/oracle/product/19.3.0.0/db_1/OPatch /u01/app/oracle/product/19.3.0.0/db_1/OPatch.bak --备份opatch
unzip -q /u01/app/p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.3.0.0/db_1/
chmod -R 755 /u01/app/oracle/product/19.3.0.0/db_1/OPatch
chown -R oracle:oinstall /u01/app/oracle/product/19.3.0.0/db_1/OPatch
4---解压patch包 两个节点 root执行
unzip /u01/app/p33567274_190000_Linux-x86-64.zip -d /u01/app/
这一个包 包含了全部的patch
chown -R grid:oinstall /u01/app/33567274
chmod -R 755 /u01/app/33567274
5、兼容性检查
OPatch兼容性检查 两个节点 grid用户
/u01/app/19.3.0.0/grid/OPatch/opatch lsinventory -detail -oh /u01/app/19.3.0.0/grid/
6、补丁冲突检查
注意:db1和db2都执行
子目录的五个patch分别在grid和oracle用户下分别执行检查
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33509923/33239955
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33509923/33515361
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33509923/33529556
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33509923/33534448
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33509923/33575402
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/33567274/33561310
7 空间检查
注意:db1和db2都执行
grid 执行
vi /tmp/patch_list_gihome.txt
/u01/app/33567274/33509923/33239955
/u01/app/33567274/33509923/33515361
/u01/app/33567274/33509923/33529556
/u01/app/33567274/33509923/33534448
/u01/app/33567274/33509923/33575402
/u01/app/33567274/33561310
两个节点 grid用户 oracle用户分别执行
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
8 补丁分析检查
Root 执行
/u01/app/19.3.0.0/grid/OPatch/opatchauto apply /u01/app/33567274/33561310 -analyze ---大约1.5分钟
/u01/app/19.3.0.0/grid/OPatch/opatchauto apply /u01/app/33567274/33509923 -analyze ---大约2分钟
9 grid 升级
## root两个节点都要分别执行 --grid upgrade
/u01/app/19.3.0.0/grid/OPatch/opatchauto apply /u01/app/33567274/33561310 -oh /u01/app/19.3.0.0/grid ---约5.5分钟(OJVM)
/u01/app/19.3.0.0/grid/OPatch/opatchauto apply /u01/app/33567274/33509923 -oh /u01/app/19.3.0.0/grid ---约10分钟
opatch lspatches
[grid@nssuzvwit59db1prod ~]$ opatch lspatches --升级后的状态
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
33534448;ACFS RELEASE UPDATE 19.14.0.0.0 (33534448)
33529556;OCW RELEASE UPDATE 19.14.0.0.0 (33529556)
33515361;Database Release Update : 19.14.0.0.220118 (33515361)
33239955;TOMCAT RELEASE UPDATE 19.0.0.0.0 (33239955)
33561310;OJVM RELEASE UPDATE: 19.14.0.0.220118 (33561310)
10 oracle 升级
## root两个节点都要分别执行 --oracle upgrade
/u01/app/oracle/product/19.3.0.0/db_1/OPatch/opatchauto apply /u01/app/33567274/33509923 -oh /u01/app/oracle/product/19.3.0.0/db_1 --约6 -18分钟 第二节点用了18分钟
opatch lspatches 升级后状态
[oracle@nssuzvwit59db1prod ~]$ opatch lspatches
33529556;OCW RELEASE UPDATE 19.14.0.0.0 (33529556)
33515361;Database Release Update : 19.14.0.0.220118 (33515361)
OPatch succeeded.
[oracle@nssuzvwit59db1prod ~]$
###after patch
11、升级后动作
仅节点1
opatch lspatches
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> alter system set cluster_database=false scope=spfile; --设置接非集群
srvctl stop db -d dbname
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP UPGRADE
如果使用了pdb 请确认pdb 全部open
alter pluggable database all open;
[oracle@db1 ~]$ datapatch -verbose
执行前确认两个节点pdb都打开,如果pdb没有打开 可能会出现cdb和pdb RU不一致,
导致pdb受限。如果pdb没有更新 可以使用这个命令强制更新ru
datapatch -verbose -apply ru_id -force -pdbs PDB1
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> alter system set cluster_database=true scope=spfile sid='*';
SQL> SHUTDOWN
srvctl start database -d dbname
--编译无效对象
SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql
完成后检查patch情况
set linesize 180
col action for a15
col status for a15
select PATCH_ID,PATCH_TYPE,ACTION,STATUS,TARGET_VERSION from dba_registry_sqlpatch;
SQL> select PATCH_UID,PATCH_ID,ACTION,STATUS,ACTION_TIME ,DESCRIPTION from dba_registry_sqlpatch;
PATCH_UID PATCH_ID ACTION STATUS
---------- ---------- --------------- -------------------------
ACTION_TIME
---------------------------------------------------------------------------
DESCRIPTION
--------------------------------------------------------------------------------
22862832 29517242 APPLY SUCCESS
10-DEC-22 06.20.30.799965 PM
Database Release Update : 19.3.0.0.190416 (29517242)
24589353 33515361 APPLY SUCCESS
10-DEC-22 09.56.18.746359 PM
Database Release Update : 19.14.0.0.220118 (33515361)