【Oracle】Opatch 工具介绍

【Oracle】Opatch 工具介绍Opatch 是 oracle 公司开发的安装 卸载 检测 patch 冲突的工具 管理 oracle 所有已经安装的补丁 opatch 命令格式为 opatchcomman comma opatch

大家好,欢迎来到IT知识分享网。

Opatch 是oracle公司开发的安装,卸载,检测patch冲突的工具,管理oracle所有已经安装的补丁!
opatch命令格式为:
opatch < command > [< command_options >] [ -h[elp] ]
oracle@rac3:/home/oracle/opatch/>$ORACLE_HOME/OPatch/opatch -h
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Usage: opatch [ -help ] [ -r[eport] ] [ command ]
command := 
apply        安装个别补丁
lsinventory  对inventory进行列表
lspatches    显示已经打的补丁
napply       apply 的加强版本,可以同时打多个补丁
nrollback    同时回滚多个补丁
rollback     卸载个别补丁   
query        显示某一个别补丁的详细信息
version      显示opatch版本信息
prereq
util
:= -help       Displays the help message for the command.
                      -report     Print the actions without executing.
 example:
   ‘opatch -help’
   ‘opatch -help -fmw’
   ‘opatch auto -help’
   ‘opatch apply -help’
   ‘opatch lsinventory -help’
   ‘opatch lspatches -help’
   ‘opatch napply -help’
   ‘opatch nrollback -help’
   ‘opatch rollback -help’
   ‘opatch prereq -help’
   ‘opatch util -help’
OPatch succeeded.
1 安装前准备:
1.1 安装non-recommended patch要咨询ORACLE SUPPORT,确认bug的现象和官方文档中的描述吻合 
1.2 安装patch,系统必须确保perl的版本号大于5.00503,可以使用如下命令确认:
[root@rac3 oracle]# perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi
如果不是可以参考Note .1 – Oracle Data Server Interim Patch Installation来解决!
1.3 Verify the OUI Inventory. 
检查 OUI Inventory Opatch工具需要完整且有效的Inventory信息。如果执行opatch lsinventory 出错,请及时和oracle 技术支持联系并使inventory 信息正确。
1.4 下载最新的Opatch工具:在metalink 上搜索bug db 比如linux 平台: p__Linux-x86-64
oracle@rac3:/opt/oracle/11.2.0/alifpre/OPatch>sh opatch version
OPatch Version: 11.2.0.1.9
OPatch succeeded.
1.5 创建存放patch的目录,比如
mkdir /home/oracle/patch
1.6 下载patch 并解压到存放patch的目录:以 patch 为例:
oracle@rac3:/home/oracle/opatch>ls
p__Linux-x86-64.zip
oracle@rac3:/home/oracle/opatch>unzip -d /home/oracle/patch  p__Linux-x86-64.zip
oracle@rac3:/home/oracle/opatch>ls
 p__Linux-x86-64.zip
1.7 关闭oracle数据库所有服务:数据库,监听(可以放在前面的步骤中执行)
2 安装补丁
2.1安装一个补丁:
oracle@rac3:/home/oracle/opatch>cd /
oracle@rac3:/home/oracle/opatch/>ls
etc  files  README.txt
oracle@rac3:/home/oracle/opatch/>sh /opt/oracle/11.2.0/alifpre/OPatch/opatch  apply
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_19-14-55下午.log
Applying interim patch ” to OH ‘/opt/oracle/11.2.0/alifpre’
Verifying environment and performing prerequisite checks…
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
电子邮件地址/用户名:  
尚未提供电子邮件地址以接收有关安全问题的通知。
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知:  Y
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = ‘/opt/oracle/11.2.0/alifpre’)
本地系统是否已准备打补丁? [y|n]
Y
User Responded with: Y
Backing up files…
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁…
Patch successfully applied
Log file location: /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_19-14-55下午.log
OPatch succeeded.
用inventory 命令查看已经安装的patch
oracle@rac3:/home/oracle/opatch/>$ORACLE_HOME/OPatch/opatch lsinventory
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_19-18-39下午.log
Lsinventory Output file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/lsinv/lsinventory2011-11-27_19-18-39下午.txt
——————————————————————————–
已安装的顶级产品 (1):
Oracle Database 11g                                                  11.2.0.1.0
此 Oracle 主目录中已安装 1 个产品。
中间补丁程序 (1) :
Patch        : applied on Sun Nov 27 19:16:54 CST 2011
Unique Patch ID:  
   Created on 4 May 2010, 01:12:36 hrs PST8PDT
   Bugs fixed:
     
——————————————————————————–
OPatch succeeded.
oracle@rac3:/home/oracle/opatch/>
或者执行opatch  lspatches  查看已经安装的patch:
oracle@rac3:/home/oracle/opatch/>$ORACLE_HOME/OPatch/opatch  lspatches 
;
;
2.2 安装补丁集:
Bug – 11.2.0.1.5 Patch Set Update (PSU) [ID .8]
oracle@rac3:/home/oracle/opatch/>sh /opt/oracle/11.2.0/alifpre/OPatch/opatch  apply
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_20-51-49下午.log
Applying interim patch ” to OH ‘/opt/oracle/11.2.0/alifpre’
Verifying environment and performing prerequisite checks…
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
电子邮件地址/用户名: 
尚未提供电子邮件地址以接收有关安全问题的通知。
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知:  Y
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = ‘/opt/oracle/11.2.0/alifpre’)
本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files…
正在为组件 oracle.rdbms.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.dbscripts, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁…
将文件复制到 “/opt/oracle/11.2.0/alifpre/cpu/scripts/bug.sql”
将文件复制到 “/opt/oracle/11.2.0/alifpre/cpu/scripts/bug.sql”
将文件复制到 “/opt/oracle/11.2.0/alifpre/cpu/scripts/bug.sql”
将文件复制到 “/opt/oracle/11.2.0/alifpre/psu/scripts/bug.sql”
将文件复制到 “/opt/oracle/11.2.0/alifpre/psu/11.2.0.1.5/catpsu.sql”
将文件复制到 “/opt/oracle/11.2.0/alifpre/psu/11.2.0.1.5/catpsu_rollback.sql”
正在为组件 oracle.oraolap, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.deconfig, 11.2.0.1.0 打补丁…
正在为组件 oracle.javavm.server, 11.2.0.1.0 打补丁…
正在为组件 oracle.precomp.common, 11.2.0.1.0 打补丁…
正在为组件 oracle.network.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.network.listener, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.dv.oc4j, 11.2.0.1.0 打补丁…
正在为组件 oracle.sdo.locator, 11.2.0.1.0 打补丁…
正在为组件 oracle.sysman.console.db, 11.2.0.1.0 打补丁…
正在为组件 oracle.sysman.oms.core, 10.2.0.4.2 打补丁…
正在为组件 oracle.rdbms.dv, 11.2.0.1.0 打补丁…
正在为组件 oracle.xdk.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.ldap.rsf.ic, 11.2.0.1.0 打补丁…
正在为组件 oracle.ldap.rsf, 11.2.0.1.0 打补丁…
Patch successfully applied
Log file location: /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_20-51-49下午.log
OPatch succeeded.
注意:关于patch 冲突的问题:
OPatch categorizes two types of conflicts:
(a) Conflicts with a patch already applied to the ORACLE_HOME
In this case, please stop the patch installation and contact Oracle Support Services.
对于一个patch与已经安装的冲突,则要停止安装并和Oracle Support Services联系。
(b) Conflicts with subset patch already applied to the ORACLE_HOME
In this case, please continue the install, as the new patch contains all the fixes from the existing patch in the ORACLE_HOME.
The subset patch will automatically be rolled back prior to the installation of the new patch.
即如果是与已经安装的补丁集的子补丁冲突,则继续安装,那些冲突的子补丁会自动回滚!
比如:
oracle@rac3:/home/oracle/opatch/>sh /opt/oracle/11.2.0/alifpre/OPatch/opatch  apply
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_20-58-00下午.log
Applying interim patch ” to OH ‘/opt/oracle/11.2.0/alifpre’
Verifying environment and performing prerequisite checks…
Interim patch is a superset of the patch(es) [   ] in the Oracle Home
OPatch 将回退补丁程序子集并应用指定的补丁程序。
Patch : Optional component(s) missing : [ oracle.client, 11.2.0.1.0 ] 
All checks passed.
提供电子邮件地址以用于接收有关安全问题的通知, 安装 Oracle Configuration Manager 并启动它。如果您使用 My Oracle
Support 电子邮件地址/用户名, 操作将更简单。
有关详细信息, 请访问 http://www.oracle.com/support/policies.html。
电子邮件地址/用户名: 
尚未提供电子邮件地址以接收有关安全问题的通知。
是否不希望收到有关安全问题 (是 [Y], 否 [N]) [N] 的通知:  Y
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = ‘/opt/oracle/11.2.0/alifpre’)
本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files…
Rolling back interim patch ” from OH ‘/opt/oracle/11.2.0/alifpre’
正在为组件 oracle.rdbms.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.dbscripts, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁…
用 “/opt/oracle/11.2.0/alifpre/.patch_storage/_Mar_25_2011_03_03_29/files//rdbms/jlib/schagent.jar/oracle/scheduler/agent/ExecutionAgent$1.class” 更新 jar 文件 “/opt/oracle/11.2.0/alifpre/rdbms/jlib/schagent.jar”
用 “/opt/oracle/11.2.0/alifpre/.patch_storage/_Mar_25_2011_03_03_29/files//rdbms/jlib/schagent.jar/oracle/scheduler/agent/ExecutionAgent$2.class” 更新 jar 文件 “/opt/oracle/11.2.0/alifpre/rdbms/jlib/schagent.jar”
….省略….
正在为组件 oracle.oraolap, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.deconfig, 11.2.0.1.0 打补丁…
正在为组件 oracle.javavm.server, 11.2.0.1.0 打补丁…
正在为组件 oracle.precomp.common, 11.2.0.1.0 打补丁…
正在为组件 oracle.network.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.network.listener, 11.2.0.1.0 打补丁…
正在为组件 oracle.rdbms.dv.oc4j, 11.2.0.1.0 打补丁…
正在为组件 oracle.sdo.locator, 11.2.0.1.0 打补丁…
正在为组件 oracle.sysman.console.db, 11.2.0.1.0 打补丁…
正在为组件 oracle.sysman.oms.core, 10.2.0.4.2 打补丁…
正在为组件 oracle.rdbms.dv, 11.2.0.1.0 打补丁…
正在为组件 oracle.xdk.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.ldap.rsf.ic, 11.2.0.1.0 打补丁…
正在为组件 oracle.ldap.rsf, 11.2.0.1.0 打补丁…
正在为组件 oracle.sysman.plugin.db.main.repository, 11.2.0.1.0 打补丁…
Patch successfully applied
OPatch 会话已完成, 但出现警告。
别忘了查看日志/opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_20-58-00下午.log。
对于psu 可以通过下面的命令查看所有的补丁!

oracle@rac3:/home/oracle/opatch/>
$ORACLE_HOME/OPatch/opatch lsinventory
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_21-09-19下午.log
Lsinventory Output file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/lsinv/lsinventory2011-11-27_21-09-19下午.txt
——————————————————————————–
已安装的顶级产品 (1):
Oracle Database 11g                                                  11.2.0.1.0
此 Oracle 主目录中已安装 1 个产品。
中间补丁程序 (2) :
Patch  
    : applied on Sun Nov 27 21:00:37 CST 2011
Unique Patch ID:  
   Created on 8 Jul 2011, 02:47:43 hrs PST8PDT
   Bugs fixed:
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , , , , ,
     , , , ,


Patch        : applied on Sun Nov 27 19:16:54 CST 2011
Unique Patch ID:  
   Created on 4 May 2010, 01:12:36 hrs PST8PDT
   Bugs fixed:
     

3 卸载补丁:
oracle@rac3:/home/oracle/opatch/>$ORACLE_HOME/OPatch/opatch  rollback -id
Oracle 中间补丁程序安装程序版本 11.2.0.1.9
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home       : /opt/oracle/11.2.0/alifpre
Central Inventory : /opt/oraInventory
   from           : /opt/oracle/11.2.0/alifpre/oraInst.loc
OPatch version    : 11.2.0.1.9
OUI version       : 11.2.0.1.0
Log file location : /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_21-59-51下午.log
RollbackSession 从 OH ‘/opt/oracle/11.2.0/alifpre’ 回退中间补丁程序 ”
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = ‘/opt/oracle/11.2.0/alifpre’)
本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
正在为组件 oracle.rdbms, 11.2.0.1.0 打补丁…
RollbackSession 从产品清单中删除中间补丁程序 ”
Log file location: /opt/oracle/11.2.0/alifpre/cfgtoollogs/opatch/opatch2011-11-27_21-59-51下午.log
OPatch succeeded.
oracle@rac3:/home/oracle/opatch/>$ORACLE_HOME/OPatch/opatch  lspatches 
;


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net//viewspace-/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net//viewspace-/

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/133235.html

(0)
上一篇 2025-07-25 14:00
下一篇 2025-07-25 14:10

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信