在实际的工作和学习中很多人都会发现有些Patch没有setup安装程序本文中我们将详细的介绍如何使用Oracle的opatch工具来进行安装 下载 Opatch的最新版本可以从Metalink下载参考 Note: (Opatch Where Can I Find the Latest Version of Opatch?) 准备工作 # You must have Perl (or later) # installed under the ORACLE_HOME or elsewhere within the host # environment OPatch is no longer included in patches as of # Refer to the following link for details on Perl and OPatch: # tabase_id=NOT&p_id= 下载Optach后上传到$ORACLE_HOME [/app/oracle/product//OPatch]$chmod * [/app/oracle/product//OPatch]$ opatch version Invoking OPatch OPatch Version: OPatch succeeded [/app/oracle/product//OPatch]$ opatch lsinventory Invoking OPatch Oracle Interim Patch Installer version Copyright (c) Oracle Corporation All rights reserved Oracle Home : /app/oracle/product/ Central Inventory : /app/oracle/oraInventory from : /var/opt/oracle/oraInstloc OPatch version : OUI version : OUI location : /app/oracle/product//oui Log file location : /app/oracle/product//cfgtoollogs/opatch/opatch_PMlog LsInventorySession failed: The Oracle Home does not meet OUI version requirement This OPatch (version ) detects OUI version in the home It requires OUI version or above OPatch failed with error code 原因Opatch的版本过高 下载新的Opatch重新执行opatch lsinventory [/app/oracle/product//OPatch]$ opatch lsinventory Oracle Interim Patch Installer version Copyright (c) Oracle Corporation All Rights Reserved We recommend you refer to the OPatch documentation under OPatch/docs for usage reference We also recommend using the latest OPatch version For the latest OPatch version and other support related issues please refer to document which is viewable from Oracle Home : /app/oracle/product/ Oracle Home Inventory : /app/oracle/product//inventory Central Inventory : /app/oracle/oraInventory from : /var/opt/oracle/oraInstloc OUI location : /app/oracle/product//oui OUI shared library : /app/oracle/product//oui/lib/hpunix/liboraInstallersl Java location : /app/oracle/product//jre//bin/java Log file location : /app/oracle/product//patch_storage//*log Creating log file /app/oracle/product//patch_storage/LsInventory___log Result: There is no Interim Patch OPatch succeeded 具体范例及遇到的问题 下面以打补丁为例 [/app/oracle/product//patches/]$opatch apply 报错 Invoking fuser to check for active processes Invoking fuser on /app/oracle/product//bin/oracle Problems when checking for files that are active There were problems when checking for active processes on critical files The patch tool runs the command fuser to check that critical files are not in use Make sure fuser is available and executable on your PATH ERROR: OPatch failed during prereqs check 原因为fuser没有执行权限su root /usr/sbin#chmod +x fuser 重新命令打Patch成功 用opatch lsinventory显示打patch结果 [/app/oracle/product//OPatch]$ opatch lsinventory Oracle Interim Patch Installer version Copyright (c) Oracle Corporation All Rights Reserved We recommend you refer to the OPatch documentation under OPatch/docs for usage reference We also recommend using the latest OPatch version For the latest OPatch version and other support related issues please refer to document which is viewable from Oracle Home : /app/oracle/product/ Oracle Home Inventory : /app/oracle/product//inventory Central Inventory : /app/oracle/oraInventory from : /var/opt/oracle/oraInstloc OUI location : /app/oracle/product//oui OUI shared library : /app/oracle/product//oui/lib/hpunix/liboraInstallersl Java location : /app/oracle/product//jre//bin/java Log file location : /app/oracle/product//patch_storage//*log Creating log file /app/oracle/product//patch_storage/LsInventory___log Result: Installed Patch List: ===================== ) Patch applied on Wed Feb :: GMT+: [ Base Bug(s): ] OPatch succeeded 最后通过opatch查看数据库各组件版本 [/app/oracle/product//OPatch]$ opatch lsinventory –details |