Oracle 19c rac集群最新19.3Opatch到19.10整体升级步骤流程与相关要求,请仔细阅读并参照README文档。
一、查看当前数据库patch版本
col ACTION for a8
col status for a15
set line 999
col ACTION_TIME for a30
col DESCRIPTION for a50
SQL> select patch_id, action,status,action_time,description from dba_registry_sqlpatch;
PATCH_ID ACTION STATUS ACTION_TIME DESCRIPTION
---------- -------- ---------- ------------------------------ ------------------------------------------------------------
29517242 APPLY SUCCESS 24-JUN-21 05.57.37.337431 PM Database Release Update : 19.3.0.0.190416 (29517242)
SQL> !$ORACLE_HOME/OPatch/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@rac01.hkrt.cn:/u01/app/oracle/product/19.0.0/db_1/OPatch]$opatch version
OPatch Version: 12.2.0.1.17
OPatch succeeded.
所需Opatch安装包和补丁包:
p32126842_190000_Linux-x86-64.zip p6880880_122010_Linux-x86-64.zip
二、备份数据库家目录,防止升级失败的回退
三、RAC两节点GI_home和DB_home都替换新的Opatch(备库相同步骤修改)
注意grid用户的OPatch权限不足,需要root用户替换,注意赋权
[root@saast01 ~]# mv /u01/app/19.0.0/grid/OPatch /tmp/OPatch_bak19017
[root@saast01 ~]# unzip p6880880_122010_Linux-x86-64.zip -d /u01/app/19.0.0/grid/
[root@saast01 ~]# cd /u01/app/19.0.0/grid/
[root@rac02 grid]# chown -R grid.oinstall OPatch
[root@rac02 grid]# chmod -R 775 OPatch
oracle用户替换新版OPatch
[oracle@saast02.hkrt.cn:/u01/app/oracle/product/19.0.0/db_1]$mv OPatch OPatch_bak19017
[oracle@saast02.hkrt.cn:/home/oracle]$unzip p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME/
验证查看grid与oracle用户opatch版本为最新
[grid@rac01.hkrt.cn:/u01/app/19.0.0/grid/OPatch]$opatch version
OPatch Version: 12.2.0.1.24
[oracle@rac02.hkrt.cn:/u01/app/oracle/product/19.0.0/db_1/OPatch]$opatch version
OPatch Version: 12.2.0.1.24
四、检查 Grid主页和Oracle主页的清单信息一致性(注意rac主库oracle和grid用户都需要检查,备库oracle用户检查)
[grid@saast01.hkrt.cn:/u01/app/19.0.0/grid/OPatch]$./opatch lsinventory -detail -oh $ORACLE_HOME
[grid@saast02.hkrt.cn:/u01/app/19.0.0/grid/OPatch]$./opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@saast01.hkrt.cn:/u01/app/oracle/product/19.0.0/db_1/OPatch]$./opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@saast02.hkrt.cn:/u01/app/oracle/product/19.0.0/db_1/OPatch]$./opatch lsinventory -detail -oh $ORACLE_HOME
备库:
[oracle@p4.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
五、解压缩补丁包,存放在grid和oracle用户都可以访问的共享路径,注意grid用户解压。备库节点oracle家目录下解压即可
[root@saast02 ~]# cd /
[root@saast02 /]# mkdir soft
[root@saast02 /]# chmod -R 777 soft
[grid@rac01.hkrt.cn:/home/grid/soft]$unzip p32126842_190000_Linux-x86-64.zip -d /patch/
备库:
[oracle@p4.hkrt.cn:/home/oracle]$unzip p32126842_190000_Linux-x86-64.zip -d patch/
六、进行OPatch补丁冲突检测,如果检测有问题解决并重新检测。(备库只运行oracle的检测即可)
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218454
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32222571
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218663
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/29340594
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32240590
[oracle@saast01.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32218454
[oracle@saast01.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /soft/32126842/32226239/32222571
备库:
[oracle@p4.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/patch/32126842/32226239/32218454
[oracle@p4.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /home/oracle/patch/32126842/32226239/32222571
七、进行 OPatch系统空间检测,两节点都做。如果确保Opatch所在路径大于20G,可忽略检测(备库oracle用户检测)
Grid主目录:
vim /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
[grid@saast01.hkrt.cn:/home/grid]$/u01/app/19.0.0/grid/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
[oracle@saast01.hkrt.cn:/home/oracle]$cat /tmp/patch_list_dbhome.txt
/soft/32126842/32226239/32218454
/soft/32126842/32226239/32222571
[oracle@saast01.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
备库:
[oracle@p4181-170.hkrt.cn:/home/oracle]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_dbhome.txt
八、补丁安装前的冲突检测分析与解决
root用户下grid用户的patchauto检测 两节点都做。
[root@saast01 ~]# /u01/app/19.0.0/grid/OPatch/opatchauto apply /soft/32126842/32226239 -analyze
[root@saast02 ~]# /u01/app/19.0.0/grid/OPatch/opatchauto apply /soft/32126842/32226239 -analyze
九、正式补丁安装前解决BUG 29859410问题
注意:19C BUG 29859410问题是由于在安装19c GI 时生成的本地 oui-patch.xml 文件并没有在远程节点创建,这会导致打补丁时对远程节点无法操作的问题。所以为避免补丁失败,可提前将主节点的该文件拷贝至远程节点并附权限。
[root@saast01 ContentsXML]# scp oui-patch.xml 192.168.xxx.xxx:/u01/app/oraInventory/ContentsXML/
[root@saast02 ContentsXML]# chmod 660 oui-patch.xml
[root@saast02 ContentsXML]# chown grid:oinstall oui-patch.xml
十、先进行备库的oracle补丁安装,备库单点需要关闭监听与数据库。补丁安装完成后启动到mount正常接收主库的日志
SQL> shutdown immediate;
[oracle@p4$lsnrctl stop
[oracle@p4]$cd /home/oracle/patch/32126842/32226239/32218454/
[oracle@p4:]$/u01/app/oracle/product/19.0.0/db_1/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.24
Copyright (c) 2021, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/19.0.0/db_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/19.0.0/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/19.0.0/db_1/cfgtoollogs/opatch/opatch2021-07-06_17-04-24PM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 32218454
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/19.0.0/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '32218454' to OH '/u01/app/oracle/product/19.0.0/db_1'
ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.rdbms.ic, 19.0.0.0.0 ] , [ oracle.rdbms.tg4db2, 19.0.0.0.0 ] , [ oracle.tfa, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] not present in the Oracle Home or a higher version is found.
Patching component oracle.rdbms, 19.0.0.0.0...
Patching component oracle.rdbms.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.util, 19.0.0.0.0...
Patching component oracle.assistants.acf, 19.0.0.0.0...
Patching component oracle.assistants.deconfig, 19.0.0.0.0...
Patching component oracle.assistants.server, 19.0.0.0.0...
Patching component oracle.buildtools.rsf, 19.0.0.0.0...
Patching component oracle.ctx, 19.0.0.0.0...
Patching component oracle.dbjava.ic, 19.0.0.0.0...
Patching component oracle.dbjava.jdbc, 19.0.0.0.0...
Patching component oracle.dbjava.ucp, 19.0.0.0.0...
Patching component oracle.dbtoolslistener, 19.0.0.0.0...
Patching component oracle.ldap.owm, 19.0.0.0.0...
Patching component oracle.ldap.rsf, 19.0.0.0.0...
Patching component oracle.network.rsf, 19.0.0.0.0...
Patching component oracle.oracore.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.dbscripts, 19.0.0.0.0...
Patching component oracle.rdbms.deconfig, 19.0.0.0.0...
Patching component oracle.sdo, 19.0.0.0.0...
Patching component oracle.sdo.locator.jrf, 19.0.0.0.0...
Patching component oracle.sqlplus, 19.0.0.0.0...
Patching component oracle.xdk, 19.0.0.0.0...
Patching component oracle.marvel, 19.0.0.0.0...
Patching component oracle.xdk.rsf, 19.0.0.0.0...
Patching component oracle.ctx.atg, 19.0.0.0.0...
Patching component oracle.rdbms.scheduler, 19.0.0.0.0...
Patching component oracle.rdbms.lbac, 19.0.0.0.0...
Patching component oracle.duma, 19.0.0.0.0...
Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...
Patching component oracle.odbc, 19.0.0.0.0...
Patching component oracle.ctx.rsf, 19.0.0.0.0...
Patching component oracle.oraolap.api, 19.0.0.0.0...
Patching component oracle.xdk.parser.java, 19.0.0.0.0...
Patching component oracle.oraolap, 19.0.0.0.0...
Patching component oracle.sdo.locator, 19.0.0.0.0...
Patching component oracle.sqlplus.ic, 19.0.0.0.0...
Patching component oracle.mgw.common, 19.0.0.0.0...
Patching component oracle.ons, 19.0.0.0.0...
Patching component oracle.dbdev, 19.0.0.0.0...
Patching component oracle.network.listener, 19.0.0.0.0...
Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...
Patching component oracle.ovm, 19.0.0.0.0...
Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...
Patching component oracle.xdk.xquery, 19.0.0.0.0...
Patching component oracle.precomp.rsf, 19.0.0.0.0...
Patching component oracle.javavm.client, 19.0.0.0.0...
Patching component oracle.precomp.common.core, 19.0.0.0.0...
Patching component oracle.ldap.security.osdt, 19.0.0.0.0...
Patching component oracle.rdbms.oci, 19.0.0.0.0...
Patching component oracle.rdbms.rman, 19.0.0.0.0...
Patching component oracle.rdbms.crs, 19.0.0.0.0...
Patching component oracle.rdbms.install.common, 19.0.0.0.0...
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.rdbms.drdaas, 19.0.0.0.0...
Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...
Patching component oracle.rdbms.dv, 19.0.0.0.0...
Patching component oracle.ldap.client, 19.0.0.0.0...
Patching component oracle.network.client, 19.0.0.0.0...
Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...
Patching component oracle.precomp.common, 19.0.0.0.0...
Patching component oracle.precomp.lang, 19.0.0.0.0...
Patching component oracle.jdk, 1.8.0.201.0...
Patch 32218454 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [32218454].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/19.0.0/db_1/cfgtoollogs/opatch/opatch2021-07-06_17-04-24PM_1.log
OPatch succeeded.
cd /soft/32126842/32226239/32222571
$ORACLE_HOME/OPatch/opatch apply
启动监听,数据库mount状态
SQL> startup mount;
SQL> alter database recover managed standby database disconnect from session;
十一、主库RAC集群自动应用补丁
[root@saast01 ~]# /u01/app/19.0.0/grid/OPatch/opatchauto apply /soft/32126842/32226239
[root@saast02 ~]# /u01/app/19.0.0/grid/OPatch/opatchauto apply /soft/32126842/32226239
十二、验证补丁是否安装成功并启动从库MRR实时接收日志
col ACTION for a10
col status for a15
set line 999
col ACTION_TIME for a30
col DESCRIPTION for a50
select patch_id, action,status,action_time,description from dba_registry_sqlpatch;
PATCH_ID ACTION STATUS ACTION_TIME DESCRIPTION
---------- -------- ---------- ------------------------------ ------------------------------------------------------------
29517242 APPLY SUCCESS 01-JUN-21 05.43.39.148708 PM Database Release Update : 19.3.0.0.190416 (29517242)
32218454 APPLY SUCCESS 29-JUN-21 03.38.39.437560 PM Database Release Update : 19.10.0.0.210119 (32218454)
SQL> !$ORACLE_HOME/OPatch/opatch lspatches
32222571;OCW Interim patch for 32222571
32218454;Database Release Update : 19.10.0.0.210119 (32218454)
OPatch succeeded.
如果检查发现OCW 还没有更新成功,可单独执行补丁:
cd /soft/32126842/32226239/32222571
$ORACLE_HOME/OPatch/opatch apply
备库打开:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> select database_role,open_mode from v$database;
DATABASE_ROLE OPEN_MODE
-------------------------------- ----------------------------------------
PHYSICAL STANDBY READ ONLY WITH APPLY