展开补丁包
inflating: 31281355/README.html inflating: PatchSearch.xml [oracle@localhost ~]$ cd 31281355 /opatch lspatches ./opatch lsinv Database opened.
查询当前状态
SQL> select patch_id,patch_type,action,status,source_version from dba_registry_sqlpatch; PATCH_ID PATCH_TYPE ACTION STATUS SOURCE_VERSION ---------- ---------- --------------- ------------------------- --------------- 29517242 RU APPLY SUCCESS 19.1.0.0.0 SQL> select owner, object_type, status, count(*) from dba_objects where status='INVALID' group by owner, object_type, status order by owner, object_type; no rows selected [oracle@oln ~]$ $ORACLE_HOME/OPatch/opatch version OPatch Version: 12.2.0.1.21 OPatch succeeded. [oracle@oln ~]$ $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@oln 31281355]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /opt/oracle/product/19c/dbhome_1 Central Inventory : /opt/oracle/oraInventory from : /opt/oracle/product/19c/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.21 OUI version : 12.2.0.7.0 Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2020-09-22_05-07-16AM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
关闭数据库,然后打补丁。
[oracle@oln 31281355]$ $ORACLE_HOME/OPatch/opatch apply Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation. All rights reserved. Oracle Home : /opt/oracle/product/19c/dbhome_1 Central Inventory : /opt/oracle/oraInventory from : /opt/oracle/product/19c/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.21 OUI version : 12.2.0.7.0 Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2020-09-22_05-10-19AM_1.log Verifying environment and performing prerequisite checks... -------------------------------------------------------------------------------- Start OOP by Prereq process. Launch OOP... Oracle Interim Patch Installer version 12.2.0.1.21 Copyright (c) 2020, Oracle Corporation. All rights reserved. Oracle Home : /opt/oracle/product/19c/dbhome_1 Central Inventory : /opt/oracle/oraInventory from : /opt/oracle/product/19c/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.21 OUI version : 12.2.0.7.0 Log file location : /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2020-09-22_05-10-45AM_1.log Verifying environment and performing prerequisite checks... OPatch continues with these patches: 31281355 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 = '/opt/oracle/product/19c/dbhome_1') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files... Applying interim patch '31281355' to OH '/opt/oracle/product/19c/dbhome_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.oraolap.mgmt, 19.0.0.0.0 ] , [ oracle.xdk.parser.java.jaxb2, 19.0.0.0.0 ] , [ oracle.options.olap.awm, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.assistants.asm, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.sqlj, 19.0.0.0.0 ] , [ oracle.assistants.usm, 19.0.0.0.0 ] , [ oracle.options.olap, 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.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.ldap.rsf, 19.0.0.0.0... Patching component oracle.network.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.rdbms.crs, 19.0.0.0.0... Patching component oracle.install.deinstalltool, 19.0.0.0.0... Patching component oracle.dbjava.ucp, 19.0.0.0.0... Patching component oracle.oraolap.dbscripts, 19.0.0.0.0... Patching component oracle.rdbms.lbac, 19.0.0.0.0... Patching component oracle.dbdev, 19.0.0.0.0... Patching component oracle.marvel, 19.0.0.0.0... Patching component oracle.network.listener, 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.rsf.ic, 19.0.0.0.0... Patching component oracle.network.client, 19.0.0.0.0... Patching component oracle.ctx.atg, 19.0.0.0.0... Patching component oracle.ctx.rsf, 19.0.0.0.0... Patching component oracle.rdbms.drdaas, 19.0.0.0.0... Patching component oracle.duma, 19.0.0.0.0... Patching component oracle.javavm.server, 19.0.0.0.0... Patching component oracle.odbc, 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.dv, 19.0.0.0.0... Patching component oracle.bali.ice, 11.1.1.7.0... Patching component oracle.ovm, 19.0.0.0.0... Patching component oracle.dbjava.jdbc, 19.0.0.0.0... Patching component oracle.oracore.rsf, 19.0.0.0.0... Patching component oracle.rdbms.scheduler, 19.0.0.0.0... Patching component oracle.rdbms.install.common, 19.0.0.0.0... Patching component oracle.ldap.owm, 19.0.0.0.0... Patching component oracle.ldap.security.osdt, 19.0.0.0.0... Patching component oracle.ons, 19.0.0.0.0... Patching component oracle.rdbms.install.plugins, 19.0.0.0.0... Patching component oracle.sdo.locator, 19.0.0.0.0... Patching component oracle.nlsrtl.rsf, 19.0.0.0.0... Patching component oracle.xdk.rsf, 19.0.0.0.0... Patching component oracle.sqlplus.ic, 19.0.0.0.0... Patching component oracle.oraolap, 19.0.0.0.0... Patching component oracle.xdk.parser.java, 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 31281355 successfully applied. Sub-set patch [29517242] has become inactive due to the application of a super-set patch [31281355]. Please refer to Doc ID 2161861.1 for any possible further required actions. Log file location: /opt/oracle/product/19c/dbhome_1/cfgtoollogs/opatch/opatch2020-09-22_05-10-45AM_1.log OPatch succeeded. [oracle@oln 31281355]$
启动数据库后检查没有发现刚才打的补丁!
[oracle@oln 31281355]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 22 05:16:25 2020 Version 19.8.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. staConnected to an idle instance. SQL> rtup; ORACLE instance started. Total System Global Area 2415918568 bytes Fixed Size 9137640 bytes Variable Size 553648128 bytes Database Buffers 1845493760 bytes Redo Buffers 7639040 bytes Database mounted. Database opened. SQL> select patch_id,patch_type,action,status,source_version from dba_registry_sqlpatch; PATCH_ID PATCH_TYPE ACTION STATUS SOURCE_VERSION ---------- ---------- --------------- ------------------------- --------------- 29517242 RU APPLY SUCCESS 19.1.0.0.0 SQL> select owner, object_type, status, count(*) from dba_objects where status='INVALID' group by owner, object_type, status order by owner, object_type; no rows selected SQL> SQL> set linesize 200 SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- BANNER_FULL ---------------------------------------------------------------------------------------------------------------------------------------------------------------- BANNER_LEGACY CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.8.0.0.0 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 0 SQL>
执行datapatch
[oracle@oln 31281355]$ $ORACLE_HOME/OPatch/datapatch -verbose SQL Patching tool version 19.8.0.0.0 Production on Tue Sep 22 05:43:08 2020 Copyright (c) 2012, 2020, Oracle. All rights reserved. Log file for this invocation: /opt/oracle/cfgtoollogs/sqlpatch/sqlpatch_1741_2020_09_22_05_43_08/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: No interim patches found Current state of release update SQL patches: Binary registry: 19.8.0.0.0 Release_Update 200703031501: Installed PDB CDB$ROOT: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 21-SEP-20 06.28.27.195519 AM PDB ORCLPDB1: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 21-SEP-20 06.35.48.668341 AM PDB PDB$SEED: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 21-SEP-20 06.35.48.668341 AM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT PDB$SEED ORCLPDB1 No interim patches need to be rolled back Patch 31281355 (Database Release Update : 19.8.0.0.200714 (31281355)): Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.8.0.0.0 Release_Update 200703031501 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 31281355 apply (pdb CDB$ROOT): SUCCESS logfile: /opt/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_ORCLCDB_CDBROOT_2020Sep22_05_44_00.log (no errors) Patch 31281355 apply (pdb PDB$SEED): SUCCESS logfile: /opt/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_ORCLCDB_PDBSEED_2020Sep22_05_53_00.log (no errors) Patch 31281355 apply (pdb ORCLPDB1): SUCCESS logfile: /opt/oracle/cfgtoollogs/sqlpatch/31281355/23688465/31281355_apply_ORCLCDB_ORCLPDB1_2020Sep22_05_53_02.log (no errors) SQL Patching tool complete on Tue Sep 22 06:04:54 2020 [oracle@oln 31281355]$
再检查
[oracle@oln 31281355]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Sep 22 06:09:23 2020 Version 19.8.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.8.0.0.0 SQL> select patch_id,patch_type,action,status,source_version from dba_registry_sqlpatch; PATCH_ID PATCH_TYPE ACTION STATUS SOURCE_VERSION ---------- ---------- --------------- ------------------------- --------------- 29517242 RU APPLY SUCCESS 19.1.0.0.0 31281355 RU APPLY SUCCESS 19.3.0.0.0 SQL> set linesize 200 SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- BANNER_FULL ---------------------------------------------------------------------------------------------------------------------------------------------------------------- BANNER_LEGACY CON_ID -------------------------------------------------------------------------------- ---------- Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.8.0.0.0 Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production 0 SQL> select patch_id,patch_type,action,status,source_version,TARGET_VERSION from dba_registry_sqlpatch; PATCH_ID PATCH_TYPE ACTION STATUS SOURCE_VERSION TARGET_VERSION ---------- ---------- --------------- ------------------------- --------------- --------------- 29517242 RU APPLY SUCCESS 19.1.0.0.0 19.3.0.0.0 31281355 RU APPLY SUCCESS 19.3.0.0.0 19.8.0.0.0 SQL>