oracle 19.3打补丁到19.20
1.本次是单实例打补丁,不需要GI,所需的补丁如下
p6880880_190000_Linux-x86-64.zip (.37的opatch)
p35354406_190000_Linux-x86-64.zip(OJVM)
p35320081_190000_Linux-x86-64.zip(DB)
p35319490_190000_Linux-x86-64.zip(GI)
如果是RAC打补丁请参考我的另一篇文章只需要把补丁包换成19.20的即可
https://www.modb.pro/db/580230
2.备份opatch
mv /u01/app/oracle/product/19.3.0/db/OPatch /u01/app/oracle/product/19.3.0/db/OPatch.bak
3.替换高版本opatch
unzip p6880880_190000_Linux-x86-64.zip -d $ORACLE_HOME
chmod -R 755 /u01/app/oracle/product/19.3.0/db/OPatch
chown –R oracle:oinstall /u01/app/oracle/product/19.3.0/db/OPatch
opatch version
OPatch Version: 12.2.0.1.37
OPatch succeeded.
4.打DB patch
打补丁前需要关闭监听和数据库
unzip p35320081_190000_Linux-x86-64.zip -d /u01/app
chmod -R 755 /u01/app/35320081
chown –R oracle:oinstall /u01/app/35320081
补丁检查
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/app/35320081
Oracle Interim Patch Installer version 12.2.0.1.37
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.37
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_09-46-39AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
补丁空间检查
Vi /tmp/patch_list_gihome.txt
/u01/app/35320081
$ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /tmp/patch_list_gihome.txt
Oracle Interim Patch Installer version 12.2.0.1.37
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.37
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_09-48-18AM_1.log
Invoking prereq "checksystemspace"
Prereq "checkSystemSpace" passed.
OPatch succeeded.
打补丁
/u01/app/oracle/product/19.3.0/db/OPatch/opatchauto apply /u01/app/35320081 -oh /u01/app/oracle/product/19.3.0/db
OPatchauto session is initiated at Thu Aug 10 09:51:58 2023
OPATCHAUTO-72083: Performing bootstrap operations failed.
OPATCHAUTO-72083: The bootstrap execution failed because Cannot detect any valid Grid Infrastructure setup..
OPATCHAUTO-72083: Fix the reported problem and re-run opatchauto.
OPatchauto session completed at Thu Aug 10 09:51:58 2023
Time taken to complete the session 0 minute, 0 second
opatchauto bootstrapping failed with error code 255.
错误原因,非RAC环境不可以使用opatchauto
Oracle Interim Patch Installer version 12.2.0.1.37
Copyright (c) 2023, Oracle Corporation. All rights reserved.
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.37
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_10-02-32AM_1.log
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckSystemCommandAvailable" failed.
The details are:
Missing command :fuser
UtilSession failed:
Prerequisite check "CheckSystemCommandAvailable" failed.
Log file location: /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_10-02-32AM_1.log
OPatch failed with error code 73
这个报错是因为缺少fuser命令
yum search fuser
Loaded plugins: fastestmirror
Determining fastest mirrors
====================================================================== Matched: fuser =======================================================================
psmisc.x86_64 : Utilities for managing processes on your system
yum install -y psmisc #安装这个包
正式打patch
cd /u01/app/35320081
/u01/app/oracle/product/19.3.0/db/OPatch/opatch apply
Oracle Interim Patch Installer version 12.2.0.1.37
Copyright (c) 2023, Oracle Corporation. All rights reserved.
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.37
OUI version : 12.2.0.7.0
Log file location : /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_10-11-05AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 35320081
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.3.0/db')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '35320081' to OH '/u01/app/oracle/product/19.3.0/db'
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.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.options.olap.api, 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.util, 19.0.0.0.0...
Patching component oracle.rdbms.rsf, 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.blaslapack, 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.dbdev, 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.duma, 19.0.0.0.0...
Patching component oracle.javavm.client, 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.ldap.security.osdt, 19.0.0.0.0...
Patching component oracle.marvel, 19.0.0.0.0...
Patching component oracle.network.rsf, 19.0.0.0.0...
Patching component oracle.odbc.ic, 19.0.0.0.0...
Patching component oracle.ons, 19.0.0.0.0...
Patching component oracle.ons.ic, 19.0.0.0.0...
Patching component oracle.oracore.rsf, 19.0.0.0.0...
Patching component oracle.perlint, 5.28.1.0.0...
Patching component oracle.precomp.common.core, 19.0.0.0.0...
Patching component oracle.precomp.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.crs, 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.rdbms.oci, 19.0.0.0.0...
Patching component oracle.rdbms.rsf.ic, 19.0.0.0.0...
Patching component oracle.rdbms.scheduler, 19.0.0.0.0...
Patching component oracle.rhp.db, 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.sqlplus.ic, 19.0.0.0.0...
Patching component oracle.wwg.plsql, 19.0.0.0.0...
Patching component oracle.xdk.parser.java, 19.0.0.0.0...
Patching component oracle.ldap.ssl, 19.0.0.0.0...
Patching component oracle.ctx.rsf, 19.0.0.0.0...
Patching component oracle.rdbms.dv, 19.0.0.0.0...
Patching component oracle.rdbms.drdaas, 19.0.0.0.0...
Patching component oracle.network.client, 19.0.0.0.0...
Patching component oracle.rdbms.hsodbc, 19.0.0.0.0...
Patching component oracle.network.listener, 19.0.0.0.0...
Patching component oracle.ldap.rsf.ic, 19.0.0.0.0...
Patching component oracle.dbtoolslistener, 19.0.0.0.0...
Patching component oracle.nlsrtl.rsf, 19.0.0.0.0...
Patching component oracle.xdk.xquery, 19.0.0.0.0...
Patching component oracle.rdbms.install.common, 19.0.0.0.0...
Patching component oracle.ovm, 19.0.0.0.0...
Patching component oracle.oraolap, 19.0.0.0.0...
Patching component oracle.rdbms.rman, 19.0.0.0.0...
Patching component oracle.install.deinstalltool, 19.0.0.0.0...
Patching component oracle.rdbms.install.plugins, 19.0.0.0.0...
Patching component oracle.rdbms.lbac, 19.0.0.0.0...
Patching component oracle.sdo.locator, 19.0.0.0.0...
Patching component oracle.oraolap.dbscripts, 19.0.0.0.0...
Patching component oracle.oraolap.api, 19.0.0.0.0...
Patching component oracle.ctx.atg, 19.0.0.0.0...
Patching component oracle.javavm.server, 19.0.0.0.0...
Patching component oracle.rdbms.hs_common, 19.0.0.0.0...
Patching component oracle.xdk, 19.0.0.0.0...
Patching component oracle.xdk.rsf, 19.0.0.0.0...
Patching component oracle.ldap.client, 19.0.0.0.0...
Patching component oracle.mgw.common, 19.0.0.0.0...
Patching component oracle.odbc, 19.0.0.0.0...
Patching component oracle.precomp.lang, 19.0.0.0.0...
Patching component oracle.precomp.common, 19.0.0.0.0...
Patching component oracle.jdk, 1.8.0.201.0...
Patch 35320081 successfully applied.
Sub-set patch [29517242] has become inactive due to the application of a super-set patch [35320081].
Please refer to Doc ID 2161861.1 for any possible further required actions.
Log file location: /u01/app/oracle/product/19.3.0/db/cfgtoollogs/opatch/opatch2023-08-10_10-11-05AM_1.log
OPatch succeeded.
opatch lspatches #打完后补丁检查
35320081;Database Release Update : 19.20.0.0.230718 (35320081)
29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399)
OPatch succeeded.
5.OJVM补丁
基本和上面的步骤一致
unzip p35354406_190000_Linux-x86-64.zip -d /u01/app
chmod -R 755 /u01/app/35354406
chown –R oracle:oinstall /u01/app/35354406
cd /u01/app/35354406
/u01/app/oracle/product/19.3.0/db/OPatch/opatch apply
输出就不加上了
6.补完丁后操作
STARTUP UPGRADE
ORACLE instance started.
Total System Global Area 1.0100E+10 bytes
Fixed Size 13893832 bytes
Variable Size 1610612736 bytes
Database Buffers 8455716864 bytes
Redo Buffers 19656704 bytes
Database mounted.
Database opened.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED MIGRATE YES
3 YZCCREP MOUNTED
SQL>alter pluggable database all open;
alter pluggable database all open
*
ERROR at line 1:
ORA-65054: Cannot open a pluggable database in the desired mode.
这时候PDB是无法启动的,需要先关闭数据库 然后正常startup
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1.0100E+10 bytes
Fixed Size 13893832 bytes
Variable Size 1610612736 bytes
Database Buffers 8455716864 bytes
Redo Buffers 19656704 bytes
Database mounted.
Database opened.
SQL> show pdbs
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 YZCCREP READ WRITE NO
SQL>
SQL>
SQL> exit
datapatch -verbose
SQL Patching tool version 19.20.0.0.0 Production on Thu Aug 10 10:25:40 2023
Copyright (c) 2012, 2023, Oracle. All rights reserved.
Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_15430_2023_08_10_10_25_40/sqlpatch_invocation.log
Connecting to database...OK
Gathering database info...
done
Note: Datapatch will only apply or rollback SQL fixes for PDBs
that are in an open state, no patches will be applied to closed PDBs.
Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
(Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done
Current state of interim SQL patches:
Interim patch 35354406 (OJVM RELEASE UPDATE: 19.20.0.0.230718 (35354406)):
Binary registry: Installed
PDB CDB$ROOT: Not installed
PDB PDB$SEED: Not installed
PDB YZCCREP: Not installed
Current state of release update SQL patches:
Binary registry:
19.20.0.0.0 Release_Update 230715022800: Installed
PDB CDB$ROOT:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 03-AUG-23 11.07.33.141644 AM
PDB PDB$SEED:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 03-AUG-23 11.14.05.579640 AM
PDB YZCCREP:
Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 03-AUG-23 11.14.05.579640 AM
Adding patches to installation queue and performing prereq checks...done
Installation queue:
For the following PDBs: CDB$ROOT PDB$SEED YZCCREP
No interim patches need to be rolled back
Patch 35320081 (Database Release Update : 19.20.0.0.230718 (35320081)):
Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.20.0.0.0 Release_Update 230715022800
The following interim patches will be applied:
35354406 (OJVM RELEASE UPDATE: 19.20.0.0.230718 (35354406))
WARNING: Following components are NOT in a valid state.
This could cause patching failure. If it does, consider
running utlrp.sql to bring components to VALID state.
Then, re-run datapatch.
PDB$SEED : SDO [INVALID]
Installing patches...
Patch installation complete. Total patches installed: 6
Validating logfiles...done
Patch 35320081 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_YZCCREPD_CDBROOT_2023Aug10_10_26_35.log (no errors)
Patch 35354406 apply (pdb CDB$ROOT): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35354406/25255010/35354406_apply_YZCCREPD_CDBROOT_2023Aug10_10_26_13.log (no errors)
Patch 35320081 apply (pdb PDB$SEED): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_YZCCREPD_PDBSEED_2023Aug10_10_31_29.log (no errors)
Patch 35354406 apply (pdb PDB$SEED): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35354406/25255010/35354406_apply_YZCCREPD_PDBSEED_2023Aug10_10_31_16.log (no errors)
Patch 35320081 apply (pdb YZCCREP): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35320081/25314491/35320081_apply_YZCCREPD_YZCCREP_2023Aug10_10_31_29.log (no errors)
Patch 35354406 apply (pdb YZCCREP): SUCCESS
logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35354406/25255010/35354406_apply_YZCCREPD_YZCCREP_2023Aug10_10_31_16.log (no errors)
Automatic recompilation incomplete; run utlrp.sql to revalidate.
PDBs: PDB$SEED YZCCREP
SQL Patching tool complete on Thu Aug 10 10:35:00 2023
编译无效对象
@$ORACLE_HOME/rdbms/admin/utlrp.sql
检查补丁结果
set linesize 180
col action for a15
col status for a15
SQL> select PATCH_ID,PATCH_TYPE,ACTION,STATUS,TARGET_VERSION from dba_registry_sqlpatch;
PATCH_ID PATCH_TYPE ACTION STATUS TARGET_VERSION
---------- ---------- --------------- --------------- ---------------
29517242 RU APPLY SUCCESS 19.3.0.0.0
35354406 INTERIM APPLY SUCCESS 19.3.0.0.0
35320081 RU APPLY SUCCESS 19.20.0.0.0
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 03-AUG-23 11.07.33.141644 AM
Database Release Update : 19.3.0.0.190416 (29517242)
25255010 35354406 APPLY SUCCESS 10-AUG-23 10.34.40.723444 AM
OJVM RELEASE UPDATE: 19.20.0.0.230718 (35354406)
25314491 35320081 APPLY SUCCESS 10-AUG-23 10.34.40.720241 AM
Database Release Update : 19.20.0.0.230718 (35320081)
评论

