Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8345052
  • 博文数量: 444
  • 博客积分: 10593
  • 博客等级: 上将
  • 技术积分: 3852
  • 用 户 组: 普通用户
  • 注册时间: 2006-05-09 15:26
文章分类

全部博文(444)

文章存档

2014年(1)

2013年(10)

2012年(18)

2011年(35)

2010年(125)

2009年(108)

2008年(52)

2007年(72)

2006年(23)

分类: Oracle

2010-11-24 12:19:19

从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 < command > [< command_options >] [ -h[elp] ]

    命令有:apply(安装个别补丁)、rollback(卸载个别补丁)、lsinventory(对inventory进行列表)

、query(显示某一个别补丁的详细信息)、version(显示opatch版本信息)。在opatch目录下,有用户使

用指南文件(Users_Guide.txt),其中有详细的命令格式和使用示例,读者可以参考。Opatch执行操作时,

除在屏幕输出结果外,还生成日志文件。日志文件的路径和文件名格式如下:

    $ORACLE_HOME/.patch_storage/< patch_id >/< action >-< patch_id >_< mm-dd-yyyy_hh-mi-ss

>.log

    其中“patch_id”是Oracle技术支持部门为个别补丁分配的编号。

     * 个别补丁安装实例

    沿用安装PSR实例中的环境。在安装PSR10.1.0.5后,检索metalink,发现若干在其之上的个别补丁。选

择其中之一安装。

    个别补丁Patch 4518443修复BUG4518443,这一BUG的主要问题是TNS LISTENER在注册ONS(Oracle

Notification Services)的同时如果创建子进程,那么LISTENER会挂起(HANGUP)。

    安装时,首先,从metalink下载补丁的压缩文件p4518443_10105_LINUX.zip.将此文件解压缩至某一目录

中。解压缩后,这一补丁的所有文件都在子目录4518443下,目录名就是个别补丁的补丁号,opatch依据目录

名获得信息,所以一定不要重命名子目录。

    然后,在终端窗口中,执行cd命令移动到4518443子目录中,执行以下命令:

    $ $ORACLE_HOME/OPatch/opatch apply

    对inventory列表,确认安装操作:

    $ $ORACLE_HOME/OPatch/opatch lsinventory

    执行卸载命令时,也必须使4518443子目录成为当前目录。其中,Rollback命令需要两个参数:-id给出

个别补丁号;-ph 给出个别补丁解压缩后的路径。

    $ $ORACLE_HOME/OPatch/opatch rollback -id 4518443 -ph /…/4518443

    随后再对inventory列表,则会看到这一个别补丁已经被移去。
* 使用opatch显示已安装的版本信息

    不需要启动数据库,执行加选项的对inventory的列表命令,可以得到已安装的软件的各个组件的详细版

本信息。

    $ $ORACLE_HOME/OPatch/opatch lsinventory -detail

    安全补丁CPU

    一个CPU内包含了对多个安全漏洞的修复,并且也包括相应必需的非安全漏洞的补丁。CPU是累积型的,

只要安装最新发布的CPU即可,其中包括之前发布的所有CPU的内容。事实上,在CPU之前的安全漏洞修改除去

个别例外也被包括在CPU中。Oracle公司只对处于标准技术支持和延长支持期间的产品提供CPU更新,对处于

维持支持范围的产品不提供新的CPU.(对于9.2以前的版本,只对处于ECS和EMS期间的版本提供CPU更新。)

一般对当前补丁发行版及前一个版本提供CPU,但也有只限于当前补丁发行版的例外情形。也就是说,一般需

要先安装最新PSR后才可能安装CPU.由于是累积型的定期发布,所以对于某一平台的某一版本,如果两次CPU

发布期间没有发现新的安全漏洞,则新发布的CPU与前一版本完全相同。

    在以下网址中可以找到CPU发布的信息,但是很遗憾,只有技术支持签约用户才可以从metalink下载补丁

文件。

   http://www.oracle.com/technology/deploy/security/alerts.htm

    Oracle公司制定的CPU的发布日期大约在一月、四月、七月和十月的最接近15的星期二。

    对于每一个CPU,附有相应的说明文档(Critical Patch Update Note),其中介绍安装过程和注意事项

,在安装之前应认真阅读此文档。同样也存在文档“Oracle Critical Patch Update MM YYYY Known Issues

for Oracle Database”,其中列出了说明文档中没有给出的新信息。

    在安装时,首先下载压缩文件p5225797_10105_LINUX.zip,解压缩到与其它个别补丁相同的目录下。检

查其发行说明时,发现要求opatch版本比现已安装版本要高,下载安装指定版本opatch.进入子目录5225797

(这是此安全补丁的补丁号),执行apply命令。

    $ $ORACLE_HOME/OPatch/opatch apply

    打开此次安装生成的日志文件,其中没有错误信息出现。执行inventory列表命令确认安装:

    $ $ORACLE_HOME/opatch lsinventory
 

 

set ORACLE_HOME=[oracle目录]
cd $ORACLE_HOME/Opatch/
opatch lsinventory -all -detail
[删除补丁] 删除这个补丁 opatch rollback -id [patchID]

如果没有安装opatch工具,需要先安装。上传文件p2617419_10102_GENERIC.zip
解压到oracle目录下:
unzip p2617419_10102_GENERIC.zip
Archive:  p2617419_10102_GENERIC.zip
   creating: OPatch/
   creating: OPatch/docs/
  inflating: OPatch/docs/FAQ        
  inflating: OPatch/docs/Users_Guide.txt 
  inflating: OPatch/docs/bt1.txt    
  inflating: OPatch/docs/bt2.txt    
   creating: OPatch/jlib/
  inflating: OPatch/jlib/opatch.jar 
   creating: OPatch/perl_modules/
  inflating: OPatch/perl_modules/Apply.pm 
  inflating: OPatch/perl_modules/AttachHome.pm 
  inflating: OPatch/perl_modules/Command.pm 
  inflating: OPatch/perl_modules/LsInventory.pm 
  inflating: OPatch/perl_modules/Query.pm 
  inflating: OPatch/perl_modules/RollBack.pm 
  inflating: OPatch/perl_modules/Version.pm 
  inflating: OPatch/perl_modules/XML.pm 
  inflating: OPatch/perl_modules/opatchIO.pm 
  inflating: OPatch/opatch          
  inflating: OPatch/opatch.pl       
  inflating: OPatch/opatch.bat      
  inflating: OPatch/emdpatch.pl     
  inflating: OPatch/README.txt      
将这个路径加到oracle的path中:
:/home/oracle/OPatch
执行opatch lsinventory检查工具


[转]e.g.

将oracle patch上传到oracle目录下面:p4193286_10103_LINUX.zip
解压在oracle目录下面:
[oracle@**** oracle]$ unzip p4193286_10103_LINUX.zip
Archive:  p4193286_10103_LINUX.zip
  inflating: 4193286/amdcpu.sql     
  inflating: 4193286/catcpu.sql     
  inflating: 4193286/catcpu_rollback.sql 
   creating: 4193286/etc/
   creating: 4193286/etc/config/
  inflating: 4193286/etc/config/actions 
  inflating: 4193286/etc/config/inventory 
   creating: 4193286/etc/xml/
  inflating: 4193286/etc/xml/GenericActions.xml 
  inflating: 4193286/etc/xml/ShiphomeDirectoryStructure.xml 
  inflating: 4193286/exfcpu.sql     
   creating: 4193286/files/
   creating: 4193286/files/dm/
   creating: 4193286/files/dm/admin/
   …….
  
shutdown 数据库、stop监听
 
打patch:
[oracle@**** oracle]$ cd 4193286
[oracle@**** 4193286]$ opatch apply
PERL5LIB=/home/oracle/product/10.1.0/db_1/perl/lib/5.6.1:/home/oracle/OPatch/perl_modules; export PERL5LIB
/home/oracle/product/10.1.0/db_1/perl/bin/perl /home/oracle/OPatch/opatch.pl apply
Oracle Home = /home/oracle/product/10.1.0/db_1
Location of Oracle Inventory = /home/oracle/product/10.1.0/db_1/inventory
Oracle Universal Installer shared library = /home/oracle/product/10.1.0/db_1/oui/lib/linux/liboraInstaller.so
Path to Java = /home/oracle/product/10.1.0/db_1/jre/1.4.2/bin/java
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Universal Installer components = /home/oracle/product/10.1.0/db_1/oui
Required Jar File under Oracle Universal Installer = jlib/OraInstaller.jar
 

OPatch Version 1.0.0.0.50
Perl Version 5.006001
 
/home/oracle/OPatch/opatch.pl version: 1.0.0.0.50
Copyright (c) 2001-2004 Oracle Corporation. All Rights Reserved.
 
Some commands below are not in your path:
  Command= fuser
  Path= /usr/kerberos/bin:/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/oracle/bin:/home/oracle/bin:/home/oracle/product/10.1.0/db_1/bin:/home/oracle/OPatch
 
ERROR: OPatch failed because of Path problem.
 
提示fuser命令没有找到,该命令在/sbin目录下面,将该目录加到用户的path中,再执行
[oracle@bj34 4193286]$ opatch apply
 
Oracle Interim Patch Installer version 1.0.0.0.52
Copyright (c) 2005 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
293369.1 which is viewable from metalink.oracle.com
 
Oracle Home = /home/oracle/product/10.1.0/db_1
Location of Oracle Universal Installer components = /home/oracle/product/10.1.0/db_1/oui
Location of OraInstaller.jar  = “/home/oracle/product/10.1.0/db_1/oui/jlib”
Oracle Universal Installer shared library = /home/oracle/product/10.1.0/db_1/oui/lib/linux/liboraInstaller.so
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Inventory = /home/oracle/product/10.1.0/db_1/inventory
Path to Java = /home/oracle/product/10.1.0/db_1/jre/1.4.2/bin/java
Log file = /home/oracle/product/10.1.0/db_1/.patch_storage//*.log
 
Backing up comps.xml …
 
OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only.
 

Please shut down Oracle instances running out of this ORACLE_HOME
(Oracle Home = /home/oracle/product/10.1.0/db_1)
Is this system ready for updating?
Please respond Y|N >
y
Patching…
 
Updating inventory…
Backing up comps.xml …
 

OPatch succeeded.
 
执行opatch lsinventory察看patch是否正确安装:
[oracle@bj34 4193286]$ opatch lsinventory
 
Oracle Interim Patch Installer version 1.0.0.0.52
Copyright (c) 2005 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
293369.1 which is viewable from metalink.oracle.com
 
Oracle Home = /home/oracle/product/10.1.0/db_1
Location of Oracle Universal Installer components = /home/oracle/product/10.1.0/db_1/oui
Location of OraInstaller.jar  = “/home/oracle/product/10.1.0/db_1/oui/jlib”
Oracle Universal Installer shared library = /home/oracle/product/10.1.0/db_1/oui/lib/linux/liboraInstaller.so
Location of Oracle Inventory Pointer = /etc/oraInst.loc
Location of Oracle Inventory = /home/oracle/product/10.1.0/db_1/inventory
Path to Java = /home/oracle/product/10.1.0/db_1/jre/1.4.2/bin/java
Log file = /home/oracle/product/10.1.0/db_1/.patch_storage//*.log
 
Result:
 

  Installed Patch List:
  =====================
  1) Patch 4193286 applied on Mon Apr 25 11:42:00 CST 2005
      [ Base Bug(s): 4003062 4125530 3906246 3965635 3528288 3756949 4048145 4006984 3925449 3909356 3878841 4199450 3878754 4167241 3889519 3878756 3483420 3878793 4193286 3897017 4105639 3925450 4125581 4125549 3878810 4167230 3878817 3458489 4167233 3878835 4118781 3878749 3878839 3878766 4008180 4167237 4057733 3878783 4008181 4008182 4167239 4125511 3111225  ]
 
 
 
OPatch succeeded.
 
启动数据库,执行catcpu.sql,log里面发现一些错误。
SQL> spool logfile
SQL> @catcpu.sql
 
[lisa@**** 4193286]$ grep -n ‘ORA-’ logfile.lst
452:ORA-00955: name is already used by an existing object
461:ORA-00955: name is already used by an existing object
533:ORA-00955: name is already used by an existing object
545:ORA-00955: name is already used by an existing object
563:ORA-00955: name is already used by an existing object
609:ORA-00955: name is already used by an existing object
618:ORA-00955: name is already used by an existing object
659:ORA-00955: name is already used by an existing object
668:ORA-00955: name is already used by an existing object
678:ORA-04043: object MDPRVT_IDX does not exist
853:ORA-00955: name is already used by an existing object
 
安装文档提到这些错误可以忽略:
9. The following ignorable errors may be encountered during execution of catcup.sql and catcpu_rollback.sql
 
ORA-00942: table or view does not exist
ORA-04043: object does not exist
ORA-01917: user or role ‘XDB’ does not exist
ORA-01435: user does not exist
ORA-00955: name is already used by an existing object
ORA-04043: Object Missing.
ORA-01430: column being added already exists in table
 
重启数据库,察看警告日志,没有发现异常,启动监听,至此patch打完了。
如果准备充分的话,当掉数据库到重新启动大约也就20分钟,还是比较顺利的。
 
备注:20050425
今天察看安装文档,发现要求的opatch版本比我使用的要新,还是特别标注的,不知道有什么不同,重新下载了新的opatch,卸掉原来的patch,重新打patch,并没有什么特别的地方。
但是在运行了一段时间以后,发现我的admin/*/bdump下面有个文件centdb_mmon_9603.trc一直在写,基本上每分钟都写:
内容大致如下:
*** 2005-04-25 15:00:56.580
Unable to schedule a MMON slave at: Auto Flush Main 1
  Attempt to create slave process failed.
  Can happen for several reasons:
    – No process state objects
    – Reached OS set limits
    – A shutdown was going on
  Check alert log for more details.
 
查询了alert.log和udump下面,并没有什么特别的东西,查询了metalink,也没有人提到,最后我重新启动了数据库就好了。可能是打完了patch还是需要重启数据库的吧。

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

Summary

Symptom
 

Oracle patch installation using OPatch

This note describes how to install Oracle database patches using the Oracle patch tool OPatch for Oracle Release 10.2 in the SAP environment. For Oracle Release 9i, see Note 306408.

For information about installing Oracle database patches using the Oracle tool MOPatch, see Note 1027012. This tool supports the collective installation and the delta installation of patches on UNIX platforms as of Oracle Release 10.2.

This note also describes the procedure for installing a new version of OPatch for Oracle Release 10.2.0.2 or 10.2.0.4 (see below).

Other terms

Patch 2617419
Patch 4898608
Patch 6880880

p2617419_10102_GENERIC.zip
p4898608_10202_GENERIC_v5.zip
Opatch_10204_Generic_v3.zip

Reason and Prerequisites

Oracle patch installation for Oracle Release 10.2 in the SAP environment.

Solution
 

Patches, patch sets, merge patches, critical patch updates, bug fixes

This section describes the differences between Oracle database patch sets, Oracle database patches, merge patches, Critical Patch Updates (CPUs), and so on.

Oracle Database Patch Sets

Oracle database patch sets are installed using the Oracle Universal Installer (OUI) (UNIX: runInstaller, Windows: setup.exe). Generally, Oracle patch sets cannot be uninstalled. Before you install a new patch set, you should always create a backup of the relevant Oracle software (ORACLE_HOME), including the current Oracle inventory (except when you first install an Oracle Home). You must install a patch set in accordance with the instructions that come with it (patchnote.htm, readme.htm).

Oracle Database Patches

As of Oracle9i, you can install and uninstall Oracle database patches with the Oracle patch tool (Unix: opatch, Windows: opatch.bat).  As of Oracle Database Release 10g, OPatch is contained in ORACLE_HOME in the directory OPatch by default.

An Oracle database patch is sometimes also called ‘interim patch‘ (temporary correction), ‘one-off‘ (individual correction), or simply ‘bug fix‘ (error correction) because it corrects only an individual error. If several error corrections are combined in one patch, this is known as a ‘merge patch‘ (see below).

Each Oracle database patch contains instructions for installing and uninstalling the patch (README.txt). In addition to the general statements, these instructions may also contain patch-specific statements that you must also execute before or after installing or uninstalling the patch.

Patch collections and Critical Patch Updates (CPUs) for Windows

For reasons relating to the software, there are patch collections (known as ‘bundle patch‘, ‘patch collection‘, or sometimes also ‘mini patch‘) for Windows platforms, which combine the corrections of several individual patches in a patch collection.

Individual patches, like the ones for UNIX platforms, are not available for Windows. For this reason, MOPatch is available only for UNIX platforms. MOPatch automates the installation of several individual patches.

Patch collections that are relevant for the SAP environment are available on SAP Service Marketplace (see Note 871735). Some of these patch collections are Critical Patch Updates (CPUs), which are provided within the critical patch update program (see Note 850306). On Windows platforms, there is no difference between a CPU and a patch collection with regard to the technical installation. Both are installed using OPatch.

Merge patches

A merge patch contains several error corrections in one patch. Merge patches are required if the correction of an error is contained in the same program module as the correction of another error. After you install a merge patch, the OPatch inventory log lists the number of the ‘Merge bug’ and the relevant numbers (bug IDs) of the individual errors, which have been corrected in the merge patch, under ‘Bugs fixed’.

Technical differences between OPatch 9.2/10.1 and OPatch 10.2

OPatch Release 9.2/10.1

Release: 9.2.0/10.1.0
Oracle patch ID: 2617419 (Oracle MetaLink 602334.1)
Runtime environment: Pearl (installed in ORACLE_HOME)
Patch storage     (UNIX): $ORACLE_HOME/.patch_storage
OPatch log files (UNIX): $ORACLE_HOME/.patch_storage
Download link:
Oracle->Oracle other->Tools
Download zip file: p2617419_10102_GENERIC.zip
OCM support: No
MOPatch support: No

As of June 9, 2008, you can no longer use the OPatch version that is available in patch 2617419 on Oracle MetaLink to install patches (see Oracle MetaLink Note 602334.1). Therefore, continue to use the OPatch version that is available on SAP Service Marketplace for the patch installation for Oracle Release 9.2/10.1 in the SAP environment.

OPatch Release 10.2.0.2

Release: 10.2.0.2
Oracle patch ID: 4898608 (Oracle MetaLink 602334.1)
Runtime environment: Java (installed in ORACLE_HOME)
Patch storage     (UNIX): $ORACLE_HOME/.patch_storage
OPatch log files (UNIX): $ORACLE_HOME/cfgtoollogs/opatch
$ORACLE_HOME/cfgtoollogs/opatch/lsinv
OPatch history file: opatch_history.txt
Download link:
Oracle->Oracle other->OPatch 10.2
Download zip file: p4898608_10202_GENERIC_v.zip
OCM support: No
MOPatch support: Yes, see Note 1027012.

As of June 9, 2008, you can no longer use the OPatch version that is available in patch 4898608 on Oracle MetaLink to install patches (see Oracle MetaLink Note 602334.1). Therefore, continue to use the OPatch version for Release 10.2.0.2 that is available on SAP Service Marketplace for the patch installation for Oracle Release 10.2.0.2 in the SAP environment.

OPatch Release 10.2.0.4

Release: 10.2.0.4
Oracle patch ID: 6880880 (Oracle MetaLink 602334.1)
Runtime environment: Java (installed in ORACLE_HOME)
Patch storage     (UNIX): $ORACLE_HOME/.patch_storage
OPatch log files (UNIX): $ORACLE_HOME/cfgtoollogs/opatch
$ORACLE_HOME/cfgtoollogs/opatch/lsinv
OPatch history file: opatch_history.txt
Download link:
Oracle->Oracle 10.2.0.4->OPatch
Download zip file: Opatch_10204_Generic_v.zip
OCM support: No, see Note 1227404.
MOPatch support: Yes, see Note 1027012.

As of June 9, 2008, you can no longer use the OPatch version, which is also available for Release 10.2.0.4 in patch 4898608 on Oracle MetaLink, to install patches (see Oracle MetaLink Note 602334.1). Therefore, use the OPatch version for Release 10.2.0.4 that is available on SAP Service Marketplace for the patch installation for Oracle Release 10.2.0.4 in the SAP environment.

The OPatch version for Release 10.2.0.4, which is available on SAP Service Marketplace, is a special version of OPatch that is released only for the use in the SAP environment. It is platform-independent and does not include OCM support, unlike the OPatch version on Oracle MetaLink (patch ID 6880880).

The version display of the SAP version of OPatch is as follows:

%> $ORACLE_HOME/OPatch/opatch version
========================================================
GENERIC OPATCH VERSION – FOR USE IN SAP ENVIRONMENT ONLY
========================================================
Invoking OPatch 10.2.0.4.3
OPatch Version: 10.2.0.4.3
OPatch succeeded.
%>


OPatch logs and documentation

OPatch logs are saved in the directory $ORACLE_HOME/cfgtoollogs/opatch (UNIX) or %ORACLE_HOME%\cfgtoollogs\opatch (Windows). In addition to these logs for each individual OPatch action, OPatch also logs all the OPatch activities in a summary log opatch_history.txt in the same directory. OPatch inventory listings are also saved in the directory $ORACLE_HOME/cfgtoollogs/opatch/lsinv.

The documentation for OPatch Release 10.2 is available in the Oracle online documentation ‘Universal Installer and OPatch User’s Guide for Windows and UNIX’ and under $ORACLE_HOME/OPatch/docs.

Patch number , bug number , and patch directory

Each Oracle bug has a bug number (bug ID) that uniquely identifies the bug.  In the same way, each Oracle patch also has a patch number (patch ID) that uniquely identifies the patch. When you display the Oracle inventory, the system displays the patch number for each patch that was installed and the numbers of the bugs that were corrected by the patch.

The patch directory of a patch is the directory that contains the unpacked patch files for this patch. Up to OPatch Version 10.2.0.4, the absolute path for this directory must not contain any blank characters (Oracle Bug #5406580).

In most cases, the patch number corresponds to the bug number for individual patches, and the patch number corresponds to the number of the merge bug for merge patches.

The bug number always corresponds to the number in the file name of the packed patch, which means that the file p1234567_10202_SOLARIS64.zip contains the patch for bug 1234567 for Solaris 64-bit.  In addition, the patch number always corresponds to the name of the patch directory, which means that the patch directory is created with the name 7654321 when unpacking patch 7654321.

Using OPatch

The same operating system user that was used to install the Oracle software is also used when you install or uninstall patches using OPatch. For UNIX, this is the user ora; for Windows, this is the user adm.

OPatch requires that the environment variable ORACLE_HOME is set. As a result, you can call OPatch anytime as follows, without having to enhance the search path:

UNIX: $ORACLE_HOME/OPatch/opatch [command] [options]
Windows: %ORACLE_HOME%\OPatch\opatch [command] [options]

Important: When you install a patch, read the delivered README.txt of the patch to determine whether you have to carry out any additional steps (and, if this is the case, which steps you have to carry out) before or after you install the patch.

Before you install or uninstall patches, you must first stop all instances and processes that were started in ORACLE_HOME (Oracle instance(s), listener, Oracle CSS service ocssd.bin (see Note 839574), and so on).

You can install several Oracle database patches in direct succession, without having to restart the Oracle instance after each patch, provided that the patch description does not contain other instructions (see MOPatch, Note 1027012).

Before you install a patch set, you are not required to manually uninstall patches.

When you install patches and patch sets, the status of the installed software is stored in the Oracle inventory. Both OPatch and the Oracle Universal Installer display the installed patches and patch sets from the Oracle inventory.

After you install or uninstall one or more patches, you should execute ‘opatch lsinventory’ to log the new patch status in an OPatch log.

Overview of OPatch commands

Displaying the OPatch version
% opatch version

Displaying the online help
% opatch -help

Displaying the online help for a certain command
% opatch -help
= apply, rollback, lsinventory, util

Displaying the Oracle inventory (see below)
% opatch lsinventory [-all][-detail]

Installing a patch (see below)
% opatch apply

Uninstalling a patch (see below)
% opatch rollback -id

Special functions of OPatch (see below)
% opatch util

Cleanup of the patch storage directory
% opatch util cleanup
When you install patches using MOPatch, the patch storage directory is automatically cleaned up by default using this option at the end.

For OPatch, there are two general options that you can specify in addition using the command apply when you install a patch, and using the command rollback when you uninstall a patch: -verbose or -silent

You can use the option -silent to suppress the user query ‘Is the local system ready for patching?’, and the command is executed immediately. This command is used by MOPatch during the collective installation of patches. You should use the option -silent only if you are absolutely sure that the Oracle instance and all of the processes have been stopped.

You can specify the option -verbose for each OPatch command in addition. It is used to obtain more detailed information about the patch process.

Displaying the Oracle inventory

UNIX: $ORACLE_HOME/OPatch/opatch lsinventory
Windows: %ORACLE_HOME%\OPatch\opatch.bat lsinventory

When you use ‘lsinventory’, OPatch displays which patch sets and patches are installed in your system.

UNIX: $ORACLE_HOME/OPatch/opatch lsinventory -all
Windows: %ORACLE_HOME%\OPatch\opatch.bat lsinventory -all

When you use ‘lsinventory -all’, OPatch displays all of the Oracle Homes. This only provides significant information if several Oracle Homes are registered in a central inventory.

UNIX: $ORACLE_HOME/OPatch/opatch lsinventory -details
Windows: %ORACLE_HOME%\OPatch\opatch.bat lsinventory -details
When you use ‘lsinventory -details’, OPatch displays detailed information for each individual patch (modules, make objects, and so on).

UNIX: $ORACLE_HOME/OPatch/opatch lsinventory -group_by_date
Windows: %ORACLE_HOME%\OPatch\opatch.bat lsinventory -group_by_date
When you use ‘-group_by_date’, OPatch displays which patches were installed and when (grouped by days).

Patch installation using OPatch on UNIX platforms

    1. For each Oracle patch set release, create a separate OPatch base directory .

              For example: for Release 10.2.0.2
UNIX: %mkdir /oracle//opatch_base_dir_10202

For example: for Release 10.2.0.4
UNIX: %mkdir /oracle//opatch_base_dir_10204

    2. Copy the patches that are to be installed to the base directory and unpack them there. In this case, an individual patch directory is created for each patch under the base directory.

              Example for UNIX:
opatch_base_dir = /oracle//opatch_base_dir_10202
% cp p1234567_10202_SOLARIS64.zip
% cd
% unzip p1234567_10202_SOLARIS64.zip

    3. Stop the instance and all of the Oracle processes of the relevant ORACLE_HOME.
    UNIX: % sqlplus / as sysoper
            SQL> shutdown immediate
             % lsnrctl stop
    4. We recommend that you create a backup of the ORACLE_HOME and the Oracle inventory BEFORE you install the patch.
    5. Install the patch by calling OPatch as follows:

              Option 1: Calling OPatch specifying the patch directory
UNIX: % $ORACLE_HOME/OPatch/opatch apply [-verbose]

Option 2: Calling OPatch directly from the patch directory
UNIX: % cd
        % $ORACLE_HOME/OPatch/opatch apply [-verbose]

    6. Optional: Cleanup of the patch storage directory

Patch installation using OPatch on Windows platforms

In general, installing a patch on Windows platforms works in the same way as installing a patch on UNIX platforms. The main difference is that, for reasons relating to the platform, you can install several individual patches and merge patches on UNIX, whereas you can install exactly one patch collection on Windows.

Before you start the installation, take account of the specifications in the patch README.

    1. For each Oracle release, create a separate OPatch base directory .

              For example: for Release 10.2.0.4
WINDOWS: C:\> mkdir opatch_base_dir_10204

    2. Copy the Windows patch collection that is to be installed to the base directory, and unpack the patch collection there in the directory .
    3. Stop all of the Oracle processes, Oracle services, and so on, of the relevant ORACLE_HOME (OracleService, OracleTNSListener, OracleDBConsole).
    WINDOWS: C:\> sqlplus / as sysoper
            SQL> shutdown immediate
             C:\> lsnrctl stop
    4. We recommend that you create a backup of the ORACLE_HOME and the Oracle inventory BEFORE you install the patch.
    5. Install the patch by calling OPatch as follows:

              Option 1: Calling OPatch specifying the patch directory
WINDOWS: C:\> %ORACLE_HOME%\OPatch\opatch.bat apply
              [-verbose]

Option 2: Calling OPatch directly from the patch directory
WINDOWS: C:\> cd
WINDOWS: C:\> %ORACLE_HOME%\OPatch\opatch.bat apply [-verbose]

    6. Then carry out the post-install steps that are prescribed in the patch README.
    7. Optional: Cleanup of the patch storage directory

Uninstalling a patch

To uninstall a patch, proceed as follows:

In the following, on Windows platforms refers to %ORACLE_HOME%\OPatch\opatch.bat, and on UNIX platforms refers to $ORACLE_HOME/OPatch/opatch.

    1. First, determine the patch IDs of the patches that are currently installed, and check whether the patch to be uninstalled is actually installed in the system.
    lsinventory
    2. Take a note of the patch ID of the patch you want to uninstall.
    3. Stop all of the Oracle instances, all of the Oracle processes, Oracle services, and so on, of the relevant ORACLE_HOME.
    4. We recommend that you create a backup of the ORACLE_HOME and the Oracle inventory BEFORE you uninstall the patch.
    5. To uninstall the relevant patch, execute the following command:
    rollback -id
    6. Check the result:
    lsinventory
    7. If required, carry out the post-install steps in accordance with the relevant patch README or SAP Note.
    8. Optional: Cleanup of the patch storage directory

 


Installing a new OPatch version

An update of the OPatch software is required in the following cases:

  • In general, this is required for the correction of errors in OPatch.
  • This is required if the relevant patch README requests a certain version of OPatch for the installation of a patch, a Windows mini patch, or a CPU.
  • This is required after the installation of Oracle Release 10.2.0.4.

The relevant OPatch version for Oracle Release 10.2 (10.2.0.2 or 10.2.0.4) is available in the SAP Software Distribution Center (on SAP Service Marketplace) at:

-> Download
—> Database Patches
—–> Oracle
——-> Oracle 10.2.0.4
———> OPatch (only for Release 10.2.0.4)
——-> Oracle other
———> OPatch 10.2 (only for Release 10.2.0.2)

Caution: For Oracle Release 10.2, do not use an old OPatch version from the directory ‘Oracle other -> Tools’.

Installing OPatch 10.2.0.2.5 for Release 10.2.0.2

Use OPatch Version 10.2.0.2.X only for Oracle Release 10.2.0.2!

    1. Download OPatch 10.2.0.2.5 (p4898608_10202_GENERIC_v5.zip) from SAP Service Marketplace from the directory ‘Oracle->Oracle other->OPatch 10.2′, and copy this file to the ORACLE_HOME.

              UNIX: % cp p4898608_10202_GENERIC_v5.zip $ORACLE_HOME
Windows: C:\> copy p4898608_10202_GENERIC_v5.zip %ORACLE_HOME%

    2. Rename the previous OPatch directory.

              UNIX: % mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch.SAVE
Windows: C:\> rename %ORACLE_HOME%\OPatch %ORACLE_HOME%\OPatch.SAVE

    3. Unpack the new version of OPatch.

              UNIX: % unzip -d $ORACLE_HOME p4898608_10202_GENERIC_v5.zip
Windows: C:\> %ORACLE_HOME%\bin\unzip -d %ORACLE_HOME%
p4898608_10202_GENERIC_v5.zip

    4. Test the new OPatch version, for example, by displaying the inventory.
    5. The installation is complete. The new OPatch version is ready for use.

Installing OPatch 10.2.0.4.3 for Release 10.2.0.4

Use OPatch Version 10.2.0.4.X only for Oracle Release 10.2.0.4!

    1. Download OPatch 10.2.0.4.3 (Opatch_10204_Generic_v3.zip) from SAP Service Marketplace from the directory ‘Oracle->Oracle 10.2.0.4->OPatch’, and copy this file to the ORACLE_HOME.

              UNIX: % cp Opatch_10204_Generic_v3.zip $ORACLE_HOME
Windows: C:\> copy Opatch_10204_Generic_v3.zip %ORACLE_HOME%

    2. Rename the previous OPatch directory.

              UNIX: % mv $ORACLE_HOME/OPatch \
              $ORACLE_HOME/OPatch.10204.ORIG
Windows: C:\> rename %ORACLE_HOME%\OPatch \
                    %ORACLE_HOME%\OPatch.10204.ORIG

    3. Unpack the new version of OPatch.

              UNIX: % unzip Opatch_10204_Generic_v3.zip -d $ORACLE_HOME
Windows: C:\> %ORACLE_HOME%\bin\unzip -d %ORACLE_HOME%
Opatch_10204_Generic_v3.zip

    4. Test the new OPatch version, for example, by displaying the inventory.
    5. The installation is complete. The new OPatch version is ready for use.
阅读(9861) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~