目录
- 前言
- 一、补丁下载地址
- 二、OPatch
- 三、开始安装
- 四、检查
- 1、检查日志
- 2、Any (pluggable) database that has invalid objects after the execution of datapatch should have utlrp.sql run to revalidate those objects
- 五、Upgrade Oracle Recovery Manager Catalog
- 六、回退
- 七、继续打补丁
- 七 报错
前言
前面已经在oracle linux 8.8 安装好oracle 19c
《基于oracle linux 8.8操作系统安装oracle 19c数据库-单机版》
下面开始把补丁打上。
一、补丁下载地址
安装包:DATABASE_UPDATE_19.19_x86-64.zip
大小:1.7G
二、OPatch
- 版本要求: Patch 35042068 requires OPatch version 12.2.0.1.36
OPatch下载地址
下载的文件:p6880880_190000_Linux-x86-64.zip
解压到$ORACLE_HOME/
(1) Please take a backup of ORACLE_HOME/OPatch into a dedicated backup
location.
(2) Please make sure no directory ORACLE_HOME/OPatch exist.
cd $ORACLE_HOME mv OPatch OPatch.bak
复制
(3) Please unzip the OPatch downloaded zip into ORACLE_HOME directory.
unzip p6880880_190000_Linux-x86-64.zip -d /u01/app/oracle/product/19.3/dbhome_1/
复制
- 检测冲突
把包解压到ORACLE_HOME下
su - oracle unzip DATABASE_UPDATE_19.19_x86-64.zip -d /u01/app/oracle/product/19.3/dbhome_1/
复制
开始检测,进入到OPatch目录下
[oracle@master01 dbhome_1]$ cd 35042068/ [oracle@master01 35042068]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ 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/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.3/dbhome_1/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/dbhome_1/cfgtoollogs/opatch/opatch2023-07-06_23-12-26PM_1.log Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
复制
三、开始安装
1、说明
- 1、If you are using a Data Guard Physical Standby database, you must install this patch on both the primary database and the physical standby database, as described by My Oracle Support Document 278641.1.
2、If this is a RAC environment, install this patch using the OPatch rolling (no downtime) installation method as this patch is rolling RAC installable. Refer to My Oracle Support Document 244241.1 Rolling Patch - OPatch Support for RAC.
3、If this is not a RAC environment, shut down all instances and listeners associated with the Oracle home that you are updating. For more information, see Oracle Database Administrator’s Guide.
4、Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands:
我们是单机,需要关闭实例进行安装。
- 报错
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed 原因: 1、数据库没关闭:shutdown 2、监听没关闭:lsnrctl stop 3、有sqlplus客户端没退出:exit
复制
2、进行安装
进入目录中、执行命令
cd 35042068 $ORACLE_HOME/OPatch/opatch apply
复制
输出内容如下,其中有交互,需要输入:Y
[oracle@master01 35042068]$ $ORACLE_HOME/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/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.3/dbhome_1/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/dbhome_1/cfgtoollogs/opatch/opatch2023-07-06_23-33-04PM_1.log Verifying environment and performing prerequisite checks... -------------------------------------------------------------------------------- Start OOP by Prereq process. Launch OOP... 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/dbhome_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/19.3/dbhome_1/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/dbhome_1/cfgtoollogs/opatch/opatch2023-07-06_23-35-08PM_1.log Verifying environment and performing prerequisite checks... OPatch continues with these patches: 35042068 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/dbhome_1') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files... Applying interim patch '35042068' to OH '/u01/app/oracle/product/19.3/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.ons.cclient, 19.0.0.0.0 ] , [ oracle.network.cman, 19.0.0.0.0 ] , [ oracle.rdbms.tg4sybs, 19.0.0.0.0 ] , [ oracle.sdo.companion, 19.0.0.0.0 ] , [ oracle.rdbms.tg4ifmx, 19.0.0.0.0 ] , [ oracle.options.olap.api, 19.0.0.0.0 ] , [ oracle.rdbms.tg4tera, 19.0.0.0.0 ] , [ oracle.oid.client, 19.0.0.0.0 ] , [ oracle.options.olap, 19.0.0.0.0 ] , [ oracle.ons.eons.bwcompat, 19.0.0.0.0 ] , [ oracle.rdbms.tg4msql, 19.0.0.0.0 ] , [ oracle.net.cman, 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.rsf, 19.0.0.0.0... Patching component oracle.nlsrtl.rsf.core, 19.0.0.0.0... Patching component oracle.slax.rsf, 19.0.0.0.0... Patching component oracle.ordim.jai, 19.0.0.0.0... Patching component oracle.bali.jewt, 11.1.1.6.0... Patching component oracle.bali.ewt, 11.1.1.6.0... Patching component oracle.help.ohj, 11.1.1.7.0... Patching component oracle.rdbms.locator, 19.0.0.0.0... Patching component oracle.perlint.expat, 2.0.1.0.4... Patching component oracle.rdbms.util, 19.0.0.0.0... Patching component oracle.rdbms.rsf, 19.0.0.0.0... Patching component oracle.rdbms, 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.xquery, 19.0.0.0.0... Patching component oracle.javavm.server, 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.ctx.rsf, 19.0.0.0.0... Patching component oracle.oraolap, 19.0.0.0.0... Patching component oracle.rdbms.hsodbc, 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.rdbms.install.common, 19.0.0.0.0... Patching component oracle.oraolap.dbscripts, 19.0.0.0.0... Patching component oracle.ldap.rsf.ic, 19.0.0.0.0... Patching component oracle.install.deinstalltool, 19.0.0.0.0... Patching component oracle.ldap.client, 19.0.0.0.0... Patching component oracle.rdbms.rman, 19.0.0.0.0... Patching component oracle.ovm, 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.oraolap.api, 19.0.0.0.0... Patching component oracle.network.listener, 19.0.0.0.0... Patching component oracle.rdbms.dv, 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.xdk, 19.0.0.0.0... Patching component oracle.dbtoolslistener, 19.0.0.0.0... Patching component oracle.rdbms.install.plugins, 19.0.0.0.0... Patching component oracle.ldap.ssl, 19.0.0.0.0... Patching component oracle.rdbms.lbac, 19.0.0.0.0... Patching component oracle.mgw.common, 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 35042068 successfully applied. Sub-set patch [29517242] has become inactive due to the application of a super-set patch [35042068]. Please refer to Doc ID 2161861.1 for any possible further required actions. Log file location: /u01/app/oracle/product/19.3/dbhome_1/cfgtoollogs/opatch/opatch2023-07-06_23-35-08PM_1.log OPatch succeeded. [oracle@master01 35042068]$
复制
3、Load Modified SQL Files into the Database
安装如下顺序执行
sqlplus / as sysdba startup alter pluggalbe database all open; exit cd $ORACLE_HOME/OPatch ./datapatch -verbose
复制
输出如下
[oracle@master01 OPatch]$ ./datapatch -verbose SQL Patching tool version 19.19.0.0.0 Production on Fri Jul 7 00:08:43 2023 Copyright (c) 2012, 2023, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_59814_2023_07_07_00_08_43/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.19.0.0.0 Release_Update 230322020406: Installed PDB CDB$ROOT: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 06-JUL-23 07.55.52.358391 PM PDB PDB: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 06-JUL-23 08.06.22.015078 PM PDB PDB$SEED: Applied 19.3.0.0.0 Release_Update 190410122720 successfully on 06-JUL-23 08.06.22.015078 PM Adding patches to installation queue and performing prereq checks...done Installation queue: For the following PDBs: CDB$ROOT PDB$SEED PDB No interim patches need to be rolled back Patch 35042068 (Database Release Update : 19.19.0.0.230418 (35042068)): Apply from 19.3.0.0.0 Release_Update 190410122720 to 19.19.0.0.0 Release_Update 230322020406 No interim patches need to be applied Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles...done Patch 35042068 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/35042068_apply_MASTER_CDBROOT_2023Jul07_00_09_53.log (no errors) Patch 35042068 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/35042068_apply_MASTER_PDBSEED_2023Jul07_00_37_46.log (no errors) Patch 35042068 apply (pdb PDB): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/35042068_apply_MASTER_PDB_2023Jul07_00_37_46.log (no errors) Automatic recompilation incomplete; run utlrp.sql to revalidate. PDBs: PDB PDB$SEED SQL Patching tool complete on Fri Jul 7 01:02:59 2023 [oracle@master01 OPatch]$
复制
- 需要注意
1、system,sysaux,undo,temp 表空间需要空间够,空间不够,会出现卡住。
2、PDB$SEED和pdb中的system,sysaux,undo,temp 表空间也需要空间够。
3、如果不够,进行扩容,下面语句修改后使用。
alter database datafile '/../undotbs01.dbf' resize 1G; alter tablespace SYSTEM add datafile '/../system02.dbf' size 1g autoextend on next 100m; alter database tempfile '/u01/app/oracle/oradata/MASTER/temp01.dbf' resize 1G;
复制
四、检查
1、检查日志
日志位置
$ORACLE_BASE/cfgtoollogs/sqlpatch/35042068/<unique patch ID> /u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678
复制
2、Any (pluggable) database that has invalid objects after the execution of datapatch should have utlrp.sql run to revalidate those objects
$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql
复制
[oracle@master01 25183678]$ $ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -e -b utlrp -d $ORACLE_HOME/rdbms/admin utlrp.sql catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/utlrp_catcon_6 1405.lst] catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/utlrp*.log] files for output generated by scrip ts catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/cfgtoollogs/sqlpatch/35042068/25183678/utlrp_*.lst] files for spool files, if any catcon.pl: completed successfully
复制
启动监听
lsrnctl start
复制
升级完成
五、Upgrade Oracle Recovery Manager Catalog
If you are using the Oracle Recovery Manager, the catalog needs to be upgraded. Enter the following command to upgrade it. The UPGRADE CATALOG command must be entered twice to confirm the upgrade.
$ rman catalog username/password@alias RMAN> UPGRADE CATALOG; RMAN> UPGRADE CATALOG; RMAN> EXIT;
复制
六、回退
su - oracle sqlplus / as sysdba shutdown immediate; exit;
复制
执行回退
opatch rollback -id 35042068
复制
七、继续打补丁
介绍
这部分是后加的内容
在使用p6880880_190000_Linux-x86-64.zip后,又使用p35320081_190000_Linux-x86-64.zip。
这部分内容是基于p35320081_190000_Linux-x86-64.zip的补丁进行的。
7.1 解压
replace /u01/app/oracle/product/19.3/dbhome_1/PatchSearch.xml? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: /u01/app/oracle/product/19.3/dbhome_1/PatchSearch.xml
复制
七 报错
问题1
- 表现 CheckSystemCommandAvailable
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/dbhome_1/cfgtoollogs/opatch/opatch2023-07-19_23-31-12PM_1.log OPatch failed with error code 73
复制
-
原因
操作系统没有fuser这个命令 -
解决
yum search fuser yum -y install psmisc
复制
- 官方解决方案如下
1) Check if the missing package (fuser) is installed. If yes, make sure the executable is included in the PATH. The common executables used by opatch are make, ld, ar and nm. These executables will be by default under /usr/bin directory. Add the path location to the $PATH environment variable: export PATH=$PATH:/usr/bin 2) If the OS package which provides the 'fuser' utility is not installed, then install that OS package. Example: In Linux , the rpm 'psmisc' provides the fuser utility ,so install this rpm. Workaround: Make sure that database and all process accessing database/ORACLE_HOME are shut down as fuser will be skipped. 1) Pass argument for OPatch to ignore fuser and continue with patching. Set the environment variable OPATCH_NO_FUSER=true export OPATCH_NO_FUSER=true opatch apply 2) Set temporary fuser Set /tmp in your PATH Create an empty file named "fuser" Run the opatch command
复制
问题2
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]
复制