今天我们在给oracle数据库19c打补丁时,补丁要求升级到19.25.0.0.241015时,报错信息如下:
[oracle@sit-db OPatch]$ ./opatch version
./opatch: line 839: [: syntax error: `-lt' unexpected
./opatch: line 839: [: syntax error: `-lt' unexpected
Java (1.7) could not be located. OPatch cannot proceed!
OPatch returns with error code = 1
[oracle@sit-db OPatch]$
解决方案
-
删除OPatch目录下的jre目录。
-
将db的. / jdk / jre 目录 copy 到OPatch目录下即可。
验证方法:
[oracle@sit-db OPatch]$ ./opatch version
OPatch Version: 12.2.0.1.46
OPatch succeeded.
打补丁的详细过程
-
打补丁前的检查
[oracle@sit-db 36912597]$ ../opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 12.2.0.1.46 Copyright (c) 2025, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /app/oracle/product/19.0.0/dbhome_1 Central Inventory : /app/oraInventory from : /app/oracle/product/19.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.46 OUI version : 12.2.0.7.0 Log file location : /app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-11_14-19-48PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
2. 补丁安装
安装说明:
2.1)如果使用的是Data Guard物理备用数据库,则必须在主数据库和物理备用数据库上安装此修补程序,可以参考My Oracle Support文档278641.1所述。如何在Data Guard物理待机配置中应用修补程序集、PSU或CPU。
2.2)如果是Oracle RAC环境,请使用OPatch滚动(无停机)安装方法安装此补丁,因为此补丁可滚动RAC安装。 可以参考My Oracle支持文档244241.1 RAC滚动修补程序-OPatch支持。
2.3)如果不是RAC环境,单机实例,请关闭与您正在更新的Oracle关联的所有实例和侦听器。
[oracle@zht-lis-sit-db 36912597]$ ../opatch apply Oracle Interim Patch Installer version 12.2.0.1.46 Copyright (c) 2025, Oracle Corporation. All rights reserved. Oracle Home : /app/oracle/product/19.0.0/dbhome_1 Central Inventory : /app/oraInventory from : /app/oracle/product/19.0.0/dbhome_1/oraInst.loc OPatch version : 12.2.0.1.46 OUI version : 12.2.0.7.0 Log file location : /app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-11_17-02-21PM_1.log Verifying environment and performing prerequisite checks... OPatch continues with these patches: 36912597 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 = '/app/oracle/product/19.0.0/dbhome_1') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files... Applying interim patch '36912597' to OH '/app/oracle/product/19.0.0/dbhome_1' ApplySession: Optional component(s) [ oracle.network.gsm, 19.0.0.0.0 ] , [ oracle.crypto.rsf, 19.0.0.0.0 ] , [ oracle.pg4appc, 19.0.0.0.0 ] , [ oracle.pg4mq, 19.0.0.0.0 ] , [ oracle.precomp.companion, 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.sdo.companion, 19.0.0.0.0 ] , [ oracle.net.cman, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.xdk.companion, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.ldap.ztk, 19.0.0.0.0 ] , [ oracle.ons.cclient, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.jdk, 1.8.0.191.0 ] , [ oracle.jdk, 1.8.0.391.11 ] 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.rsf, 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.rsf, 19.0.0.0.0... Patching component oracle.javavm.server, 19.0.0.0.0... Patching component oracle.xdk.xquery, 19.0.0.0.0... Patching component oracle.ctx.rsf, 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.nlsrtl.rsf.lbuilder, 19.0.0.0.0... Patching component oracle.rdbms.rat, 19.0.0.0.0... Patching component oracle.ldap.rsf.ic, 19.0.0.0.0... Patching component oracle.rdbms.dv, 19.0.0.0.0... Patching component oracle.xdk, 19.0.0.0.0... Patching component oracle.mgw.common, 19.0.0.0.0... Patching component oracle.ldap.client, 19.0.0.0.0... Patching component oracle.install.deinstalltool, 19.0.0.0.0... Patching component oracle.rdbms.rman, 19.0.0.0.0... Patching component oracle.oraolap.api, 19.0.0.0.0... Patching component oracle.dbtoolslistener, 19.0.0.0.0... Patching component oracle.rdbms.drdaas, 19.0.0.0.0... Patching component oracle.rdbms.hs_common, 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.rdbms.dm, 19.0.0.0.0... Patching component oracle.ldap.ssl, 19.0.0.0.0... Patching component oracle.xdk.parser.java, 19.0.0.0.0... Patching component oracle.odbc, 19.0.0.0.0... Patching component oracle.network.listener, 19.0.0.0.0... Patching component oracle.ctx.atg, 19.0.0.0.0... Patching component oracle.rdbms.install.common, 19.0.0.0.0... Patching component oracle.rdbms.hsodbc, 19.0.0.0.0... Patching component oracle.network.aso, 19.0.0.0.0... Patching component oracle.rdbms.locator, 19.0.0.0.0... Patching component oracle.rdbms.install.plugins, 19.0.0.0.0... Patching component oracle.nlsrtl.rsf, 19.0.0.0.0... Patching component oracle.nlsrtl.rsf.core, 19.0.0.0.0... Patching component oracle.nlsrtl.rsf.ic, 19.0.0.0.0... Patching component oracle.oraolap.dbscripts, 19.0.0.0.0... Patching component oracle.network.client, 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 36912597 successfully applied. Sub-set patch [35943157] has become inactive due to the application of a super-set patch [36912597]. Please refer to Doc ID 2161861.1 for any possible further required actions. Log file location: /app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/opatch/opatch2025-06-11_17-02-21PM_1.log OPatch succeeded. [oracle@zht-lis-sit-db 36912597]$ sqlplusq / as sysdba bash: sqlplusq: command not found... [oracle@zht-lis-sit-db 36912597]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 11 17:07:29 2025 Version 19.25.0.0.0 Copyright (c) 1982, 2024, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 1.5301E+10 bytes Fixed Size 13690472 bytes Variable Size 2952790016 bytes Database Buffers 1.2314E+10 bytes Redo Buffers 19861504 bytes Database mounted. Database opened. SQL> exit Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.25.0.0.0 [oracle@zht-lis-sit-db 36912597]$ cd $ORACLE_HOME/OPatch [oracle@zht-lis-sit-db OPatch]$ ./datapatch -sanity_checks SQL Patching sanity checks version 19.25.0.0.0 on Wed Jun 11 17:08:50 2025 Copyright (c) 2021, 2025, Oracle. All rights reserved. Log file for this invocation: /app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20250611_170850_2503970/sanity_checks_20250611_170850_2503970.log Running checks JSON report generated in /app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20250611_170850_2503970/sqlpatch_sanity_checks_summary.json file Checks completed. Printing report: Check: Database component status - OK Check: PDB Violations - OK Check: Invalid System Objects - OK Check: Tablespace Status - OK Check: Backup jobs - OK Check: Temp file exists - OK Check: Temp file online - OK Check: Data Pump running - OK Check: Container status - OK Check: Oracle Database Keystore - OK Check: Dictionary statistics gathering - OK Check: Scheduled Jobs - WARNING Execution of scheduler jobs while database patching is running may lead to failures and/or performance issues. There are jobs currently running or scheduled to be executed during next hour. Consider patching the database when jobs are not running and will not be scheduled to run during patching. To check for jobs that are running or scheduled to run: SELECT owner as schema_name, job_name, state, next_run_date FROM sys.all_scheduler_jobs WHERE state = 'RUNNING' UNION SELECT owner as schema_name, job_name, state, next_run_date FROM sys.all_scheduler_jobs WHERE state = 'SCHEDULED' and cast(next_run_date as date) > sysdate and cast(next_run_date as date) < sysdate + 1/24; lissit: | JOB_NAME | NEXT_RUN_DATE | SCHEMA_NAME | STATE | |--------------------------+-------------------------------------+-------------+-----------| | DBMS_JOB$_304 | 11-JUN-25 05.17.00.000000 PM +08:00 | LISMAN | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| | DBMS_JOB$_661 | 11-JUN-25 05.17.00.000000 PM +08:00 | LISMAN | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| | DBMS_JOB$_742 | 11-JUN-25 05.09.09.000000 PM +08:00 | LISMAN | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| | CLEANUP_ONLINE_IND_BUILD | 11-JUN-25 05.46.08.194679 PM +08:00 | SYS | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| | CLEANUP_ONLINE_PMO | 11-JUN-25 05.46.48.135467 PM +08:00 | SYS | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| | CLEANUP_TAB_IOT_PMO | 11-JUN-25 05.46.18.351527 PM +08:00 | SYS | SCHEDULED | |--------------------------+-------------------------------------+-------------+-----------| Check: GoldenGate triggers - OK Check: Logminer DDL triggers - OK Check: Check sys public grants - OK Check: Statistics gathering running - OK Check: Optim dictionary upgrade parameter - OK Check: Symlinks on oracle home path - OK Check: Central Inventory - OK Check: Queryable Inventory dba directories - OK Check: Queryable Inventory locks - OK Check: Queryable Inventory package - OK Check: Queryable Inventory external table - OK Check: Imperva processes - OK Check: Guardium processes - OK Check: Locale - OK Refer to MOS Note 2680521.1 and debug log /app/oracle/cfgtoollogs/sqlpatch/sanity_checks_20250611_170850_2503970/sanity_checks_debug_20250611_170850_2503970.log SQL Patching sanity checks completed on Wed Jun 11 17:09:14 2025 [oracle@zht-lis-sit-db OPatch]$ [oracle@zht-lis-sit-db OPatch]$ ./datapatch -verbose SQL Patching tool version 19.25.0.0.0 Production on Wed Jun 11 17:09:37 2025 Copyright (c) 2012, 2024, Oracle. All rights reserved. Log file for this invocation: /app/oracle/cfgtoollogs/sqlpatch/sqlpatch_2504848_2025_06_11_17_09_37/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done 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.25.0.0.0 Release_Update 241010184253: Installed SQL registry: Applied 19.22.0.0.0 Release_Update 240104023954 successfully on 24-JUN-24 04.49.50.706429 PM Adding patches to installation queue and performing prereq checks...done Installation queue: No interim patches need to be rolled back Patch 36912597 (Database Release Update : 19.25.0.0.241015 (36912597)): Apply from 19.22.0.0.0 Release_Update 240104023954 to 19.25.0.0.0 Release_Update 241010184253 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 1 Validating logfiles...done Patch 36912597 apply: SUCCESS logfile: /app/oracle/cfgtoollogs/sqlpatch/36912597/25871884/36912597_apply_LISSIT_2025Jun11_17_10_13.log (no errors) SQL Patching tool complete on Wed Jun 11 17:11:11 2025 [oracle@zht-lis-sit-db OPatch]$ [oracle@zht-lis-sit-db OPatch]$ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jun 11 17:11:28 2025 Version 19.25.0.0.0 Copyright (c) 1982, 2024, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.25.0.0.0 SQL>
验证补丁升级时候成功:
SQL> select * from dba_registry_sqlpatch; INSTALL_ID PATCH_ID PATCH_UID PATCH_TYPE ACTION STATUS ACTION_TIME DESCRIPTION LOGFILE RU_LOGFILE FLAGS PATCH_DESCRIPTOR PATCH_DIRECTORY SOURCE_VERSION SOURCE_BUILD_DESCRIPTION SOURCE_BUILD_TIMESTAMP TARGET_VERSION TARGET_BUILD_DESCRIPTION TARGET_BUILD_TIMESTAMP ---------- ---------- ---------- ---------- --------------- ------------------------- --------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- --------------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------- --------------- -------------------------------------------------------------------------------- --------------------------------------------------------------------------- 1 35943157 25527362 RU APPLY SUCCESS 25-MAR-24 05.32.16.693696 PM Database Release Update : 19.22.0.0.240116 (35943157) /app/oracle/cfgtoollogs/sqlpatch/35943157/25527362/35943157_apply_LISUAT_2024Mar25_17_30_43.log /app/oracle/cfgtoollogs/sqlpatch/35943157/25527362/35943157_ru_apply_LISUAT_2024Mar25_17_30_43.log N 19.1.0.0.0 Feature Release 19.22.0.0.0 Release_Update 04-JAN-24 02.39.54.000000 AM19.22.0.0.0 Release_Update 04-JAN-24 02.39.54.000000 AM 19.25.0.0.0 Release_Update 10-OCT-24 06.42.53.000000 PM