更新opatch,根据README要求,opatch工具版本至少12.2.0.1.34 或更高版本,两节点oracle用户和grid用户都需要更新opatch
[oracle@test02:/home/oracle]$ cd $ORACLE_HOME/OPatch
[oracle@test02:/u01/app/oracle/product/19.3.0/db/OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.36
OPatch succeeded.
grid用户下:
[grid@test02:/u01/app/19.3.0/grid/OPatch]$ cd $ORACLE_HOME/OPatch
[grid@test02:/u01/app/19.3.0/grid/OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.36
OPatch succeeded.
校验数据库清单并保存结果
$ <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME>
oracle用户下:
[oracle@test01:/u01/app/oracle/product/19.3.0/db/OPatch]$ ./opatch lsinv -detail -oh $ORACLE_HOME
grid用户下:
[grid@test01:/u01/app/19.3.0/grid/OPatch]$ ./opatch lsinv -detail -oh $ORACLE_HOME
上传补丁包到节点一/soft目录,补丁包给755权限,所属用户和组要设置为grid用户和grid组
[root@test01 soft]# chown grid:oinstall p34762026_190000_Linux-x86-64.zip
[root@test01 soft]#
[root@test01 soft]# chmod 755 p34762026_190000_Linux-x86-64.zip
[root@test01 soft]# ll -h
total 2.7G
-rwxr-xr-x 1 grid oinstall 2.7G Mar 2 16:47 p34762026_190000_Linux-x86-64.zip
用grid用户解压补丁包
[root@test01 soft]# su - grid
Last login: Thu Mar 9 14:27:18 CST 2023 on pts/0
[grid@test01:/home/grid]$ cd /soft/
[grid@test01:/soft]$ ll -h
total 2.7G
-rwxr-xr-x 1 grid oinstall 2.7G Mar 2 16:47 p34762026_190000_Linux-x86-64.zip
[grid@test01:/soft]$
[grid@test01:/soft]$ unzip p34762026_190000_Linux-x86-64.zip
检查补丁冲突
# For Grid Infrastructure home, as home user(grid用户),返回结果为passed说明无补丁冲突:
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34765931
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34768559
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34768569
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34863894
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/33575402
# For database home, as home user(oracle用户)返回结果为passed说明无补丁冲突:
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34765931
% $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/34762026/34768559
检查操作系统空间是否足够
# For Grid Infrastructure home, as home user(grid用户):
[grid@test01:/soft]$ vim /tmp/patch_list_gihome.txt
[grid@test01:/soft]$
[grid@test01:/soft]$ cat /tmp/patch_list_gihome.txt
/soft/34762026/34765931
/soft/34762026/34768559
/soft/34762026/34768569
/soft/34762026/34863894
/soft/34762026/33575402
[grid@test01:/soft]$
[grid@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.36
Copyright (c) 2023, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/19.3.0/grid
Central Inventory : /u01/app/oraInventory
from : /u01/app/19.3.0/grid/oraInst.loc
OPatch version : 12.2.0.1.36
OUI version : 12.2.0.7.0
Log file location : /u01/app/19.3.0/grid/cfgtoollogs/opatch/opatch2023-03-09_14-38-43PM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
[grid@test01:/soft]$
# For database home, as home user(oracle用户):
[oracle@test01:/soft]$ vim /tmp/patch_list_dbhome.txt
[oracle@test01:/soft]$ cat /tmp/patch_list_dbhome.txt
/soft/34762026/34765931
/soft/34762026/34768559
[oracle@test01:/soft]$ $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
Oracle Interim Patch Installer version 12.2.0.1.36
Copyright (c) 2023, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/19.3.0/db
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19.3.0/db/oraInst.loc
OPatch version : 12.2.0.1.36
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-03-09_14-40-56PM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
[oracle@test01:/soft]$
节点一安装前分析:
[grid@test01:/soft]$ echo $ORACLE_BASE
/u01/app/grid
[grid@test01:/soft]$ echo $ORACLE_HOME
/u01/app/19.3.0/grid
[grid@test01:/soft]$ echo $PATH
/u01/app/19.3.0/grid/bin:/u01/app/19.3.0/grid/OPatch:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/grid/.local/bin:/home/grid/bin
[grid@test01:/soft]$
[grid@test01:/soft]$ exit
logout
[root@test01 soft]#
[root@test01 soft]# export ORACLE_BASE=/u01/app/grid
[root@test01 soft]# export ORACLE_HOME=/u01/app/19.3.0/grid
[root@test01 soft]# export PATH=/u01/app/19.3.0/grid/bin:/u01/app/19.3.0/grid/OPatch:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/grid/.local/bin:/home/grid/bin
[root@test01 soft]#
[root@test01 soft]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/34762026 -analyze
节点一升级GI:
[root@test01 soft]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/34762026 -oh /u01/app/19.3.0/grid
升级完检查:
[root@test01 ~]# su - grid
Last login: Thu Mar 9 15:59:36 CST 2023
[grid@test01:/home/grid]$ cd $ORACLE_HOME
[grid@test01:/u01/app/19.3.0/grid]$ cd OPatch
[grid@test01:/u01/app/19.3.0/grid/OPatch]$ ./opatch lspatches
34863894;TOMCAT RELEASE UPDATE 19.0.0.0.0 (34863894)
34768569;ACFS RELEASE UPDATE 19.18.0.0.0 (34768569)
34768559;OCW RELEASE UPDATE 19.18.0.0.0 (34768559)
34765931;DATABASE RELEASE UPDATE : 19.18.0.0.230117 (REL-JAN230131) (34765931)
33575402;DBWLM RELEASE UPDATE 19.0.0.0.0 (33575402)
OPatch succeeded.
[grid@test01:/u01/app/19.3.0/grid/OPatch]$
节点二安装前分析:
[root@test02 /]# export ORACLE_BASE=/u01/app/grid
[root@test02 /]# export ORACLE_HOME=/u01/app/19.3.0/grid
[root@test02 /]# export PATH=/u01/app/19.3.0/grid/bin:/u01/app/19.3.0/grid/OPatch:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/grid/.local/bin:/home/grid/bin
[root@test02 /]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/34762026 -analyze
节点二升级GI:
[root@test02 soft]# /u01/app/19.3.0/grid/OPatch/opatchauto apply /soft/34762026 -oh /u01/app/19.3.0/grid
节点一升级DB补丁:
[root@test01 ~]# export ORACLE_BASE=/u01/app/oracle
[root@test01 ~]# export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db
[root@test01 ~]# export PATH=/u01/app/oracle/product/19.3.0/db/bin:/u01/app/oracle/product/19.3.0/db/OPatch:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin
[root@test01 ~]#
[root@test01 ~]# /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /soft/34762026 -oh /u01/app/oracle/product/19.3.0/db
节点二升级DB补丁:
升级节点二DB补丁前,先检查/u01/app/oraInventory/ContentsXML/oui-patch.xml权限,需授予660权限
[root@test02 ContentsXML]# ll -h
total 16K
-rw-rw---- 1 grid oinstall 300 Mar 9 16:34 comps.xml
-rw-rw---- 1 grid oinstall 555 Sep 7 2022 inventory.xml
-rw-rw---- 1 grid oinstall 292 Mar 9 16:34 libs.xml
-rw-r--r-- 1 grid oinstall 174 Mar 9 16:34 oui-patch.xml
[root@test02 ContentsXML]# chmod 660 oui-patch.xml
[root@test02 ContentsXML]#
[root@test02 ContentsXML]# ll -h
total 16K
-rw-rw---- 1 grid oinstall 300 Mar 9 16:34 comps.xml
-rw-rw---- 1 grid oinstall 555 Sep 7 2022 inventory.xml
-rw-rw---- 1 grid oinstall 292 Mar 9 16:34 libs.xml
-rw-rw---- 1 grid oinstall 174 Mar 9 16:34 oui-patch.xml
[root@test02 ContentsXML]# pwd
/u01/app/oraInventory/ContentsXML
[root@test02 ContentsXML]#
调整完权限后开始打节点二DB补丁:
[root@test02 /]# cd /soft/
[root@test02 soft]# export ORACLE_BASE=/u01/app/oracle
[root@test02 soft]# export ORACLE_HOME=/u01/app/oracle/product/19.3.0/db
[root@test02 soft]# export PATH=/u01/app/oracle/product/19.3.0/db/bin:/u01/app/oracle/product/19.3.0/db/OPatch:/usr/sbin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/oracle/.local/bin:/home/oracle/bin
[root@test02 soft]#
[root@test02 soft]# /u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /soft/34762026 -oh /u01/app/oracle/product/19.3.0/db
更新数据字典:
[oracle@test02:/home/oracle]$sqlplus / as sysdba
SQL> startup;
SQL> alter pluggable database all open;
SQL> exit;
[oracle@test01:/u01/app/oracle/product/19.3.0/db/OPatch]$% cd $ORACLE_HOME/OPatch
[oracle@test01:/u01/app/oracle/product/19.3.0/db/OPatch]$% ./datapatch -verbose
处理无效对象
[oracle@test02:/home/oracle]$ cd $ORACLE_HOME/rdbms/admin
SQL>select status,count(*) from dba_objects group by status;
SQL>@?/rdbms/admin/utlrp