【opatch】Oracle打补丁工具opatch简介

本文简单介绍一下opatch命令的位置和帮助文档。

1.opatch命令存放位置
该命令的存放位置在$ORACLE_HOME下的OPatch目录下。
secooler@secDB /home/oracle$ cd $ORACLE_HOME
secooler@secDB /oracle/ora11gR2/product/11.2.0/dbhome_1$ cd OPatch/

2.查看OPatch目录下文件列表
secooler@secDB /oracle/ora11gR2/product/11.2.0/dbhome_1/OPatch$ ls -l
total 60K
drwxr-xr-x 2 oracle oinstall 4.0K Oct 28 00:29 docs/
-rw-r--r-- 1 oracle oinstall  22K May  6  2009 emdpatch.pl
drwxr-xr-x 2 oracle oinstall 4.0K Oct 28 00:29 jlib/
drwxr-xr-x 5 oracle oinstall 4.0K Oct 28 00:29 ocm/
-rwxr-xr-x 1 oracle oinstall 8.6K May  6  2009 opatch*
-rw-r--r-- 1 oracle oinstall   49 Oct 28 00:30 opatch.ini
-rw-r--r-- 1 oracle oinstall 2.6K May  6  2009 opatch.pl
drwxr-xr-x 4 oracle oinstall 4.0K Oct 28 00:29 opatchprereqs/


其中opatch就是我们要寻找的命令文件。
这是一个Shell脚本,有兴趣的朋友可以深入研究一下这个脚本的编写逻辑。

3.使用“-help”参数可以获得opatch命令的简要帮助信息
secooler@secDB /oracle/ora11gR2/product/11.2.0/dbhome_1/OPatch$ ./opatch -help
Invoking OPatch 11.1.0.6.6

Oracle Interim Patch Installer version 11.1.0.6.6
Copyright (c) 2009, Oracle Corporation.  All rights reserved.


 Usage: opatch [ -help ] [ -r[eport] ] [ command ]

            command := apply
                       lsinventory
                       napply
                       nrollback
                       rollback
                       query
                       version
                       prereq
                       util

  := -help       Displays the help message for the command.
                       -report     Print the actions without executing.

 example:
   'opatch -help'
   'opatch apply -help'
   'opatch lsinventory -help'
   'opatch napply -help'
   'opatch nrollback -help'
   'opatch rollback -help'
   'opatch prereq -help'
   'opatch util -help'



OPatch succeeded.

在帮助信息的最后的“example”部分的内容列举出了其他几个获得进一步帮助信息的方法,大家可以自行尝试。

4.opatch工具的安装方法
如果没有找到这个工具,可以使用这个地址自行下载:https://updates.oracle.com/Orion/PatchDetails/process_form?patch_num=6880880
(参考MOS的“Opatch - Where Can I Find the Latest Version of Opatch? [ID 224346.1]”文章描述)

5.小结
任何一个Oracle版本中都或多或少的存在bug,因此种类庞杂的补丁内容就应运而生,如CPU(Critical Patch Update)、PSU(Patch Set Update)等,此时opatch就派上用场了。

Good luck.

secooler
10.04.25

-- The End --

请使用浏览器的分享功能分享到微信等