系统:CentOS7.9
环境:oracle 19.14 + rac
说明:1-9步骤两个节点均需执行
1、备份目录
[root@hisdb1 ~]# tar -zcvPf oraclebase.tar.gz /u01/app/oracle >/dev/null
[root@hisdb1 ~]# tar -zcvPf oraInventory.tar.gz /u01/app/oraInventory >/dev/null
[root@hisdb1 ~]# tar -zcvPf gridbase.tar.gz /u01/app/grid >/dev/null
[root@hisdb1 ~]# tar -zcvPf gridhome.tar.gz /u01/app/11.2.0/grid >/dev/null
2、安装OPatch
说明:19.15 DB的RU编号是:33806152,GI的RU编号是:33803476,OPatch版本至少为12.2.0.1.29
sftp> cd /tmp
sftp> lcd F:\installmedium\19c\19.15
sftp> put p6880880_190000_Linux-x86-64.zip
[grid@hisdb1:/tmp]$ unzip -q -o p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
[oracle@hisdb1:/tmp]$ unzip -q -o p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
[grid@hisdb1 tmp]$ opatch version
OPatch Version: 12.2.0.1.30
OPatch succeeded.
[oracle@hisdb1 tmp]$ opatch version
OPatch Version: 12.2.0.1.30
OPatch succeeded.
3、验证Oracle Inventory
检查DB Home和Grid Home的补丁列表里补丁的一致性.
[grid@hisdb1:/home/grid]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@hisdb1:/home/oracle]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
4、下载及解压Patch
[root@hisdb1 /]# mkdir /upgrade
[root@hisdb1 /]# chown -R grid:oinstall /upgrade
sftp> lcd F:\installmedium\19c\19.15
sftp> cd /home/grid
sftp> put p33803476_190000_Linux-x86-64.zip
[grid@hisdb1 ~]$ unzip -q p33803476_190000_Linux-x86-64.zip -d /upgrade
5、运行opatch冲突检查
确定当前安装的一次性修补程序是否与此修补程序33803476冲突
grid用户:
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33806152
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33815596
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33815607
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33911149
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33575402
oracle用户:
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33806152
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /upgrade/33803476/33815596
6、运行OPatch检查系统空间
检查ORACLE_HOME文件系统是否有足够的可用空间,以便应用补丁程序:
6.1、grid用户
[grid@hisdb1:/home/grid]$ vi /tmp/patch_lists_gihome.txt
/upgrade/33803476/33806152
/upgrade/33803476/33815596
/upgrade/33803476/33815607
/upgrade/33803476/33911149
/upgrade/33803476/33575402
运行以下命令检查Grid Infrastructure home是否有足够空间.
[grid@hisdb1:/home/grid]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_lists_gihome.txt
6.2、oracle用户
[oracle@hisdb1:/home/oracle]$ vi /tmp/patch_lists_dbhome.txt
/upgrade/33803476/33806152
/upgrade/33803476/33815596
运行以下命令检查oracle home是否有足够空间.
[oracle@hisdb1:/home/oracle]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
7、一次性补丁冲突检测和解决
[root@hisdb1 ~]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /upgrade/33803476 -analyze
[root@hisdb1 ~]# /u01/app/19.3.0/grid/OPatch/opatchauto rollback /upgrade/33803476 -analyze
8、自动补丁安装
[root@hisdb1 ~]# export PATH=$PATH:/u01/app/19.3.0/grid/OPatch (说明:/u01/app/19.3.0/grid为GRID_HOME)
[root@hisdb1 ~]# opatchauto apply /upgrade/33803476
9、检查 grid 补丁
[grid@hisdb1 ~]$ opatch lspatches
33911149;TOMCAT RELEASE UPDATE 19.0.0.0.0 (33911149)
33815607;ACFS RELEASE UPDATE 19.15.0.0.0 (33815607)
33815596;OCW RELEASE UPDATE 19.15.0.0.0 (33815596)
33806152;Database Release Update : 19.15.0.0.220419 (33806152)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
[grid@hisdb1 ~]$ sqlplus -version
SQL*Plus: Release 19.0.0.0.0 - Production
Version 19.15.0.0.0
10、加载SQL
说明:此步骤为加载变化的SQL到数据库,RAC环境只需在节点1执行。
[oracle@hisdb1:/u01/app/oracle/product/19.3.0/db/OPatch]$ ./datapatch -verbose
11、处理无效对象
因之前datapatch命令会加载SQL,此过程可能会产生无效对象,节点1执行@utlrp.sql脚本处理无效对象
SQL> @?/rdbms/admin/utlrp.sql