ITPub博客

首页 > Linux操作系统 > Linux操作系统 > opatch CPU的一次折腾

opatch CPU的一次折腾

原创 Linux操作系统 作者:JohnTam10 时间:2011-03-15 10:44:08 0 删除 编辑
先摘一段简介:
 CPU(Critical Patch Update)
         一个CPU内包含了对多个安全漏洞的修复,并且也包括相应必需的非安全漏洞的补丁。CPU是累积型的,只要安装最新发布的CPU即可,其中包括之前发布的所有CPU的内容。事实上,在CPU之前的安全漏洞修改除去个别例外也被包括在CPU中。Oracle公司只对处于标准技术支持和延长支持期间的产品提供CPU更新,对处于维持支持范围的产品不提供新的CPU.(对于9.2以前的版本,只对处于ECS和EMS期间的版本提供CPU更新。)
        要打上CPU,当然要先找到最新的可用CPU下载:
可以在以下网址中找到CPU发布的信息,只要在Oracle 免费注册一个用户,就可以收到这些补丁的信息。但是,只有技术支持签约用户才可以从MOS下载补丁文件。
      http://www.oracle.com/technology/deploy/security/alerts.htm

      我下载的是今年最新发布的CPU集10249540,解压包里的README.html里有CPU使用的详细说明。

打CPU的准备:
      首先查看本机opatch版本和README列举的必须的版本(为oracle database10.2.0.4打补丁),从网上下载opatch新版本并解压覆盖原OPatch目录,将opatch的路径添加进PATH中。
      非RAC环境下,关闭数据库实例和监听器。
       确保make, ar, ld, nm命令路径在$PATH中,可用$which * 查看。
       
进行:
      本来被要求好好研究CPU中的子patch的特性,有选择的安装测试,但会错意了,直接在测试库上体验补丁包安装,进入CPU目录,直接将整个CPU打上,中途却出现问题,执行两次apply, 两次中途退出:
$ CD software/10249540
$ opatch napply -skip_subset -skip_duplicate

。。。

ApplySession applying interim patch '9678695' to OH '/opt/oracle/10g'
Backing up files affected by the patch '9678695' for rollback. This might take a while...

Patching component oracle.network.rsf, 10.2.0.4.0...
Updating archive file "/opt/oracle/10g/lib/libnro10.a" with "lib/libnro10.a/ncrfgp.o"
Updating archive file "/opt/oracle/10g/lib/libnro10.a" with "lib/libnro10.a/ncrfidsa.o"
Updating archive file "/opt/oracle/10g/lib32/libnro10.a" with "lib32/libnro10.a/ncrfgp.o"
Updating archive file "/opt/oracle/10g/lib32/libnro10.a" with "lib32/libnro10.a/ncrfidsa.o"

Patching component oracle.network.listener, 10.2.0.4.0...
ApplySession adding interim patch '9678695' to inventory

OPatch failed with error code 130
安装日志上并没有说明有什么问题,但就是遇到问题终止了。

第二次:
[oracle@enmou1 software]$opatch apply 10249540      
Invoking OPatch 10.2.0.5.1
。。。
Oracle Home : /opt/oracle/10g
Central Inventory : /opt/oracle/oraInventory
   from : /etc/oraInst.loc
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.4.0
OUI location : /opt/oracle/10g/oui
Log file location : /opt/oracle/10g/cfgtoollogs/opatch/opatch2011-03-12_18-19-57PM.log

Patch history file: /opt/oracle/10g/cfgtoollogs/opatch/opatch_history.txt

Failed to load the patch object. Possible causes are:
  The specified path is not an interim Patch shiphome
  Meta-data files are missing from the patch area
  Patch location = /software/10249540(apply应用子补丁,因此路径应为software/10249540/10249540/)
  Details = PatchObject constructor: Input file "/software/10249540/etc/config/actions" or "/software/10249540/etc/config/inventory" does not exist.

ApplySession failed: PatchObject constructor: Input file "/software/10249540/etc/config/actions" or "/software/10249540/etc/config/inventory" does not exist.
System intact, OPatch will not attempt to restore the system

OPatch failed with error code 73
后来发现 apply参数用的不对,它只是打单个临时补丁用的。当系统找不到/software/10249540/etc的路径(刚好子补丁名称跟cpu的一样),就退出opatch程序。


没办法,试着手工将剩余的打上吧。
查看已经打上的临时补丁:
[oracle@enmou1 10g]$opatch lsinventory
Invoking OPatch 10.2.0.5.1

Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation. All rights reserved.


Oracle Home : /opt/oracle/10g
Central Inventory : /opt/oracle/oraInventory
   from : /etc/oraInst.loc
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.4.0
OUI location : /opt/oracle/10g/oui
Log file location : /opt/oracle/10g/cfgtoollogs/opatch/opatch2011-03-12_20-41-16PM.log

Patch history file: /opt/oracle/10g/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /opt/oracle/10g/cfgtoollogs/opatch/lsinv/lsinventory2011-03-12_20-41-16PM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (2):

Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 3 10.2.0.4.0
There are 2 products installed in this Oracle Home.


Interim patches (42) :

Patch 9678695 : applied on Sat Mar 12 18:11:58 CST 2011
Unique Patch ID: 13296338
   Created on 17 May 2010, 15:18:49 hrs PST8PDT
   Bugs fixed:
     9678695, 9173248

Patch 9678690 : applied on Sat Mar 12 18:11:53 CST 2011
Unique Patch ID: 13296338
   Created on 17 May 2010, 15:18:49 hrs PST8PDT
   Bugs fixed:
     8309642, 9678690

Patch 9442339 : applied on Sat Mar 12 18:11:49 CST 2011
Unique Patch ID: 13296338
   Created on 18 Mar 2010, 11:29:52 hrs PST8PDT
   Bugs fixed:
     8210889, 8479537, 9442339, 6923450

Patch 9442331 : applied on Sat Mar 12 18:11:44 CST 2011
Unique Patch ID: 13296338
   Created on 18 Mar 2010, 11:29:48 hrs PST8PDT
   Bugs fixed:
     9442331

Patch 9442328 : applied on Sat Mar 12 18:11:39 CST 2011
Unique Patch ID: 13296338
   Created on 18 Mar 2010, 11:29:46 hrs PST8PDT
   Bugs fixed:
     9442328

Patch 9173253 : applied on Sat Mar 12 18:11:35 CST 2011
Unique Patch ID: 13296338
   Created on 2 Dec 2009, 22:44:53 hrs PST8PDT
   Bugs fixed:
     9173253

Patch 9173244 : applied on Sat Mar 12 18:11:31 CST 2011
Unique Patch ID: 13296338
   Created on 2 Dec 2009, 22:44:50 hrs PST8PDT
   Bugs fixed:
     9173244

Patch 8836686 : applied on Sat Mar 12 18:11:26 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:13 hrs PST8PDT
   Bugs fixed:
     8836686

Patch 8836684 : applied on Sat Mar 12 18:11:22 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:11 hrs PST8PDT
   Bugs fixed:
     8836684

Patch 8836683 : applied on Sat Mar 12 18:11:18 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:09 hrs PST8PDT
   Bugs fixed:
     8309623, 8836683

Patch 8836681 : applied on Sat Mar 12 18:11:13 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:07 hrs PST8PDT
   Bugs fixed:
     8836681, 8309587

Patch 8836678 : applied on Sat Mar 12 18:11:08 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:06 hrs PST8PDT
   Bugs fixed:
     8836678

Patch 8836677 : applied on Sat Mar 12 18:11:03 CST 2011
Unique Patch ID: 13296338
   Created on 11 Sep 2009, 01:14:30 hrs PST8PDT
   Bugs fixed:
     8836677

Patch 8836675 : applied on Sat Mar 12 18:10:58 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:01 hrs PST8PDT
   Bugs fixed:
     8309637, 8836675

Patch 8836671 : applied on Sat Mar 12 18:10:54 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:39:01 hrs PST8PDT
   Bugs fixed:
     8836671

Patch 8836667 : applied on Sat Mar 12 18:10:50 CST 2011
Unique Patch ID: 13296338
   Created on 1 Sep 2009, 10:38:59 hrs PST8PDT
   Bugs fixed:
     8836667

Patch 8568405 : applied on Sat Mar 12 18:10:45 CST 2011
Unique Patch ID: 13296338
   Created on 8 Jun 2009, 20:04:47 hrs PST8PDT
   Bugs fixed:
     8568405

Patch 8568404 : applied on Sat Mar 12 18:10:40 CST 2011
Unique Patch ID: 13296338
   Created on 8 Jun 2009, 20:04:46 hrs PST8PDT
   Bugs fixed:
     8568404

Patch 8568402 : applied on Sat Mar 12 18:10:36 CST 2011
Unique Patch ID: 13296338
   Created on 8 Jun 2009, 20:04:44 hrs PST8PDT
   Bugs fixed:
     6870937, 8568402

Patch 8568398 : applied on Sat Mar 12 18:10:29 CST 2011
Unique Patch ID: 13296338
   Created on 25 Jun 2009, 12:05:00 hrs PST8PDT
   Bugs fixed:
     6392076, 8568398

Patch 8568397 : applied on Sat Mar 12 18:10:24 CST 2011
Unique Patch ID: 13296338
   Created on 8 Jun 2009, 20:04:39 hrs PST8PDT
   Bugs fixed:
     8568397

Patch 8568395 : applied on Sat Mar 12 18:10:19 CST 2011
Unique Patch ID: 13296338
   Created on 8 Jun 2009, 20:04:38 hrs PST8PDT
   Bugs fixed:
     8309639, 8568395

Patch 8309632 : applied on Sat Mar 12 18:10:15 CST 2011
Unique Patch ID: 13296338
   Created on 24 Mar 2009, 12:34:37 hrs PST8PDT
   Bugs fixed:
     8309632

Patch 8309592 : applied on Sat Mar 12 18:10:11 CST 2011
Unique Patch ID: 13296338
   Created on 24 Mar 2009, 12:34:34 hrs PST8PDT
   Bugs fixed:
     8309592

Patch 7609057 : applied on Sat Mar 12 18:10:06 CST 2011
Unique Patch ID: 13296338
   Created on 31 Dec 2008, 04:17:07 hrs PST8PDT
   Bugs fixed:
     7609057

Patch 7375617 : applied on Sat Mar 12 18:10:02 CST 2011
Unique Patch ID: 13296338
   Created on 16 Sep 2008, 01:15:59 hrs PST8PDT
   Bugs fixed:
     7375617

Patch 7375613 : applied on Sat Mar 12 18:09:57 CST 2011
Unique Patch ID: 13296338
   Created on 16 Sep 2008, 01:15:57 hrs PST8PDT
   Bugs fixed:
     7375613

Patch 7375611 : applied on Sat Mar 12 18:09:53 CST 2011
Unique Patch ID: 13296338
   Created on 16 Sep 2008, 01:15:53 hrs PST8PDT
   Bugs fixed:
     7375611

Patch 7197583 : applied on Sat Mar 12 18:09:48 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:11:22 hrs PST8PDT
   Bugs fixed:
     7197583

Patch 7155254 : applied on Sat Mar 12 18:09:45 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:57 hrs PST8PDT
   Bugs fixed:
     7155254

Patch 7155253 : applied on Sat Mar 12 18:09:21 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:55 hrs PST8PDT
   Bugs fixed:
     7155253

Patch 7155252 : applied on Sat Mar 12 18:08:57 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:54 hrs PST8PDT
   Bugs fixed:
     7155252

Patch 7155251 : applied on Sat Mar 12 18:08:52 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:52 hrs PST8PDT
   Bugs fixed:
     7155251

Patch 7155250 : applied on Sat Mar 12 18:08:47 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:51 hrs PST8PDT
   Bugs fixed:
     7155250

Patch 7155249 : applied on Sat Mar 12 18:08:42 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:48 hrs PST8PDT
   Bugs fixed:
     7155249

Patch 7155248 : applied on Sat Mar 12 18:08:38 CST 2011
Unique Patch ID: 13296338
   Created on 3 Jul 2008, 02:10:38 hrs PST8PDT
   Bugs fixed:
     7155248

Patch 10325878 : applied on Sat Mar 12 18:08:33 CST 2011
Unique Patch ID: 13296338
   Created on 29 Dec 2010, 01:17:01 hrs PST8PDT
   Bugs fixed:
     10325878

Patch 10249540 : applied on Sat Mar 12 18:08:29 CST 2011
Unique Patch ID: 13296338
   Created on 29 Dec 2010, 01:16:15 hrs PST8PDT
   Bugs fixed:
     8534387, 8290506, 7375644, 9352191, 9655017, 7150470, 7592346, 9952272
     9119226, 8836308, 10249540

Patch 10014015 : applied on Sat Mar 12 18:08:25 CST 2011
Unique Patch ID: 13296338
   Created on 6 Oct 2010, 02:14:50 hrs PST8PDT
   Bugs fixed:
     10014015, 9442335

Patch 10014012 : applied on Sat Mar 12 18:08:21 CST 2011
Unique Patch ID: 13296338
   Created on 6 Oct 2010, 02:14:48 hrs PST8PDT
   Bugs fixed:
     10014012, 7609058

Patch 10014009 : applied on Sat Mar 12 18:08:15 CST 2011
Unique Patch ID: 13296338
   Created on 6 Oct 2010, 02:14:47 hrs PST8PDT
   Bugs fixed:
     10014009

Patch 10013975 : applied on Sat Mar 12 18:08:09 CST 2011
Unique Patch ID: 13296338
   Created on 6 Oct 2010, 02:14:46 hrs PST8PDT
   Bugs fixed:
     10013975

手动添加最后的两个补丁:
9678697和10325885

发现补丁9678697能正常打上:
进入补丁9678697目录
$opatch apply
。。。

lsinventory信息:

Patch 9678697 : applied on Sat Mar 12 21:45:38 CST 2011
Unique Patch ID: 13296338
   Created on 1 Jul 2010, 12:22:45 hrs PST8PDT
   Bugs fixed:
     9678697
。。。

而10325885却因内容缺失,成为no-op patch:
ApplySession applying interim patch '10325885' to OH '/opt/oracle/10g'

Running prerequisite checks...
Patch 10325885: Optional component(s) missing : [ oracle.rdbms.dv.oc4j, 10.2.0.4.0 ]
Prerequisite check "CheckApplicable" failed.
The details are:
Patch "10325885" is a no-op patch.
ApplySession failed during prerequisite checks: Prerequisite check "CheckApplicable" failed.
System intact, OPatch will not attempt to restore the system

OPatch failed with error code 74
暂时不管此补丁了。

注:之后并未进行步骤“Loading Modified SQL Files into the Database”,如果要完成CPU的安装,必须执行该步骤;由于是第一次安装CPU,按照文档提示,当用napply命令打上CPU后,为了完成子补丁7155248的安装,必须以root身份进入7155248目录,执行#sh cpu_root.sh。

好了,现在如之前所说方向错了,又要测试怎么将CPU给回滚掉,汗~~
准备删除CPU,查看文档发现,安装CPU的过程还没有完成(就是前述的“Loading Modified SQL Files into the Database"没搞),必须执行该步骤,完成installation过程,才能rollback。
Verify that an $ORACLE_HOME/rdbms/admin/catbundle_CPU__ROLLBACK.sql file exists,目录里很显然没有,因此先做安装步骤Loading Modified SQL Files into the Database。
For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script. as follows:

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql cpu apply
SQL> -- Execute the next statement only if this is the first 10.2.0.4 CPU applied in the Oracle home.
SQL> @utlrp.sql     
SQL> QUIT

将catbundle_CPU__ROLLBACK.sql 加载到admin目录下,回到CPU的Deinstallation步骤继续:
关闭数据库实例和监听。
$opatch nrollback -idFile $ORACLE_HOME/cpu/CPUJan2011/rollback_all.lst
因为是第一次为10.2.0.4打CPU,所以执行上述sql,对所有patch的list中的patch执行nrollback。
最后补丁都被Deinstalled了。
 

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

请登录后发表评论 登录
全部评论

注册时间:2010-09-10

  • 博文量
    40
  • 访问量
    88694