在之前的Oracle 补丁体系的blog 提到了opatch工具:
Oracle 补丁体系 及opatch 工具 介绍
http://blog.csdn.net/tianlesoftware/article/details/5809526
从9.2版开始,Oracle公司实现了个别补丁安装工具opatch. opatch使用一个称为inventory的系统数据结构(严格说是与oui共享inventory),集中管理所有已安装的个别补丁;个别补丁的安装和卸载都使用opatch命令完成,冲突检测也由opatch在安装时自动完成;提供列表命令可以很方便得到已安装个别补丁的信息。
10g(10.1和10.2)版本中,opatch作为一个标准工具,在安装时自动安装。(安装在$ORACLE_HOME/OPatch下。)而对于9.2版,需要从metalink下载opatch.无论是哪一个版本,系统中是否已经安装opatch,在使用之前,应从metalink下载最新版本的opatch.很遗憾,由于系统实现的问题,10.2使用的opatch与之前版本(10.1和9.2)使用的opatch不兼容,不能混用,这一点必须注意。
opatch是使用perl编写的脚本程序(其中也使用JAVA API)。使用的perl版本是5.6版,虽然在5.6之前的版本中也可运行,但应尽可能安装5.6或以上的版本的perl. 对于DBA来说一个好消息是,如果安装9.2版软件时保留了HTTP服务器,则在$ORACLE_HOME/Apache下会自动安装perl.(10g会自动安装配置perl和opatch.)
因为OPatch 版本之间的差别也带来一些不方便。 比如我们使用OPatch 工具来升级数据库到10.2.0.5.x时,就必须要求OPatch的版本达到10.2.0.5 以上,而我们将实例升级到10.2.0.5时,OPatch 的版本缺是到了10.2.0.4.9. 达不到我们的要求。 这时候,就需要单独从MOS 上下载高版本的OPatch,更新ORACLE_HOME 下的OPatch 之后,才能继续进行升级。
SQL> select * from v$version whererownum=1;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise EditionRelease 10.2.0.5.0 – Prod
dave:/u01/app/oracle/product/10.2.0/db_1/OPatch>./opatch version
Invoking OPatch 10.2.0.4.9
OPatch Version: 10.2.0.4.9
OPatch succeeded.
更新OPatch 工具的方法很简单, 只需要从MOS 上下载对应Patch,然后覆盖到ORACLE_HOME 下的OPatch目录即可。 当然覆盖之前,最好备份一下。
10.2.0.3.4的OPatch 工具Patch NO是:4898608
10.2.0.5的OPatch 工具的Patch NO是: 6880880, 关于OPatch 补丁的版本,相关升级文档上会有详细说明。
dave:/u01/app/oracle/product/10.2.0/db_1>mv OPatch OPatch.bak
dave:/u01/app/oracle/product/10.2.0/db_1>cp /mnt/OracleSoftware/OPatch_10.2_p6880880/p6880880_102000_LINUX.zip$ORACLE_HOME
dave:/u01/app/oracle/product/10.2.0/db_1>ls
assistants dbs jlib odbc perl sqlnet.log
bin demo jre ODBC plsql sqlplus
ccr diagnostics ldap olap precomp srvm
cdata has lib OPatch.bak racg sysman
cfgtoollogs hs log opmn rdbms uix
clone install md oracore relnotes wwg
config install.platform mesg oraInst.loc root.sh xdk
crs inventory mgw ord root.sh.old
css javavm network oui root.sh.old.1
ctx jdbc nls owm slax
dave_anqing jdk oc4j p6880880_102000_LINUX.zip sqlj
dave:/u01/app/oracle/product/10.2.0/db_1>unzip p6880880_102000_LINUX.zip
Archive: p6880880_102000_LINUX.zip
creating: OPatch/
creating: OPatch/ocm/
extracting: OPatch/ocm/ocm.zip
creating: OPatch/ocm/lib/
inflating: OPatch/ocm/lib/osdt_jce.jar
inflating: OPatch/ocm/lib/osdt_core3.jar
inflating: OPatch/ocm/lib/emocmclnt-14.jar
inflating: OPatch/ocm/lib/emocmutl.jar
creating: OPatch/ocm/bin/
inflating: OPatch/ocm/bin/emocmrsp
inflating: OPatch/ocm/ocm_platforms.txt
creating: OPatch/crs/
creating: OPatch/crs/log/
inflating: OPatch/crs/patch112.pl
inflating: OPatch/crs/crsdelete.pm
inflating: OPatch/crs/crspatch.pm
inflating: OPatch/crs/s_crsconfig_defs
inflating: OPatch/crs/crsconfig_lib.pm
inflating: OPatch/crs/oracss.pm
inflating: OPatch/crs/auto_patch.pl
inflating: OPatch/crs/s_crsconfig_lib.pm
inflating: OPatch/opatch
creating: OPatch/opatchprereqs/
creating: OPatch/opatchprereqs/opatch/
inflating: OPatch/opatchprereqs/opatch/runtime_prereq.xml
inflating: OPatch/opatchprereqs/opatch/opatch_prereq.xml
inflating: OPatch/opatchprereqs/opatch/rulemap.xml
inflating: OPatch/opatchprereqs/prerequisite.properties
creating: OPatch/opatchprereqs/oui/
inflating: OPatch/opatchprereqs/oui/knowledgesrc.xml
inflating:OPatch/opatch.ini
inflating: OPatch/emdpatch.pl
inflating: OPatch/opatch.pl
creating: OPatch/jlib/
inflating: OPatch/jlib/opatchprereq.jar
inflating: OPatch/jlib/opatchactions.jar
inflating: OPatch/jlib/opatchutil.jar
inflating: OPatch/jlib/opatchfmw.jar
inflating: OPatch/jlib/opatchext.jar
inflating: OPatch/jlib/opatch.jar
inflating: OPatch/opatch.bat
creating: OPatch/docs/
inflating: OPatch/docs/Prereq_Users_Guide.txt
inflating: OPatch/docs/FAQ
inflating: OPatch/docs/Users_Guide.txt
inflating: OPatch/README.txt
dave:/u01/app/oracle/product/10.2.0/db_1>ll OPatch
total 80
drwxr-xr-x 3 oracle oinstall 4096 Nov 3 2010 crs
drwxr-xr-x 2 oracle oinstall 4096 Nov 3 2010 docs
-rw-r--r-- 1 oracle oinstall 23695 Nov 3 2010emdpatch.pl
drwxr-xr-x 2 oracle oinstall 4096 Nov 3 2010 jlib
drwxr-xr-x 4 oracle oinstall 4096 Nov 3 2010 ocm
-r-x--x--- 1 oracle oinstall 13252 Nov 3 2010opatch
-rwxr-xr-x 1 oracle oinstall 8085 Nov 3 2010 opatch.bat
-rw-r--r-- 1 oracle oinstall 49 Nov 3 2010 opatch.ini
-rw-r--r-- 1 oracle oinstall 2576 Nov 3 2010 opatch.pl
drwxr-xr-x 4 oracle oinstall 4096 Nov 3 2010 opatchprereqs
-rw-r--r-- 1 oracle oinstall 2417 Nov 3 2010 README.txt
验证OPatch 工具版本信息:
dave:/u01/app/oracle/product/10.2.0/db_1>cd OPatch
dave:/u01/app/oracle/product/10.2.0/db_1/OPatch>./opatch version
Invoking OPatch 10.2.0.5.1
OPatch Version: 10.2.0.5.1
OPatch succeeded.
OPatch 的版本上来了,就可以进行其他的操作了。