Oracle RAC 平台下 Patch 安装与卸载 步骤

 

 

之前整理过一篇Oracle Patch 的文章,参考:

       Oracle 补丁体系 opatch 工具 介绍

       http://blog.csdn.net/tianlesoftware/archive/2010/08/13/5809526.aspx

 

       关于Oracle Patch 的知识,参考之前的文章。 这篇主要是演示下RAC 平台下Patch 的安装与卸载。

 

.  Path 安装说明

       metalink 上下了个Path5689937,在readme 文档里有RAC下的安装方法。

 

1.1 安装Patch

(1).      关闭其中一个节点上的DB实例。

(2).      关闭在第一步操作节点上的nodeapps services

       srvctl stop nodeapps -n <node-name>

(3).      在第一步操作的节点上应用patch

       进入Patch的目录,然后运行opatch命令,注意加上-local 参数。    

              cd 5689937

              opatch apply -local

(4).      启动该节点的nodeapps ASM服务。

              srvctl start nodeapps -n <node-name>

              srvctl start asm -n rac1 -i +ASM1

(5).      启动该节点上的DB实例。

              srvctl start instance -d sid -i sid1

6  在其他节点上,重复以上步骤来安装Patch

 

1.2  Patch 安装的后续操作

       选择一个节点,执行如下操作即可 在这个操作期间,用户可以访问数据库。

 

1)启动所有实例

2)在其中一个节点上用SYSDBA 连接并执行catcpu.sql脚本:

 

              cd $ORACLE_HOME/cpu/CPUJan2007 --必须进入这个目录

              sqlplus /nolog

              sql> connect /as sysdba

              sql> startup

              sql> @catcpu.sql

              sql> quit

      

       运行完该脚本之后, 注意查看alert log,有无错误信息,并检查有无无效对象。

可以通过如下SQL,来查看无效对象:

       sql> select object_name from dba_objects where status= 'INVALID';

 

如果有无效对象,执行utlrp.sql 来编译这些对象:

       cd $oracle_home/rdbms/admin

       sqlplus /nolog

       sql> connect /as sysdba

       sql> startup

       sql> @utlrp.sql

 

1.3  Patch 卸载

1 在其中一个节点上关闭DB 实例

2 在第一步的节点上关闭nodeapps 服务。

              srvctl stop nodeapps -n <node-name>

3 回滚Patch,进入Patch 文件的目录,执行命令

              cd 5689937

              opatch rollback -id 5689937

       如果出现什么错误,对照readme 文档,该文档里有一些常见错误的处理方法。

4)启动该节点上的nodeapps ASM服务

              srvctl start nodeapps -n <node-name>

5 启动该节点上的DB实例

6 在其他节点上重复上述操作

 

       因为在打patch 期间,每次只对一个实例进行操作,所以DB 还可以对外提供访问。

 

1.4  Patch卸载的后续操作

       在其中一个节点上执行如下操作:

1)执行如下脚本:

       cd $ORACLE_HOME/cpu/CPUJan2007

       sqlplus /nolog

       SQL> CONNECT / AS SYSDBA

       SQL> STARTUP

       SQL> @catcpu_rollback.sql

       SQL> QUIT

2)如果在第一步脚本结束时报有无效对象,则执行如下脚本,编译这些无效对象:

       cd $ORACLE_HOME/rdbms/admin

       sqlplus /nolog

       SQL> CONNECT / AS SYSDBA

       SQL> STARTUP

       SQL> @utlrp.sql 

 

查看无效对象

       SQL> SELECT OBJECT_NAME FROM DBA_OBJECTS WHERE STATUS = 'INVALID'; 

 

      

 

. RAC 情况

[oracle@rac1 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2     

 

我这里配置了Server-side TAF. 所以net service nametnsnames.ora)配置:

RAC =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.82)(PORT = 1521))

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.83)(PORT = 1521))   

    (LOAD_BALANCE = yes)

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = dave)

    )

  )

 

Oracle RAC Failover 详解

http://blog.csdn.net/tianlesoftware/archive/2010/03/04/5340788.aspx

 

测试:

C:/Users/Administrator.DavidDai>sqlplus sys/oracle@rac as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期六 4 2 23:03:47 2011

 

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

 

 

连接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

SQL> select instance_name from v$instance;

 

INSTANCE_NAME

--------------------------------

dave1

 

SQL>

 

 

. 安装Patch 示例

 

节点1操作:

[oracle@rac1 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2     

[oracle@rac1 u01]$ srvctl stop instance -d dave -i dave1

[oracle@rac1 u01]$ srvctl stop nodeapps -n rac1

[oracle@rac1 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            OFFLINE    OFFLINE             

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     OFFLINE             

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              OFFLINE    OFFLINE             

ora.rac1.LISTENER_RAC1.lsnr    OFFLINE    OFFLINE             

ora.rac1.gsd                   OFFLINE    OFFLINE             

ora.rac1.ons                   OFFLINE    OFFLINE             

ora.rac1.vip                   OFFLINE    OFFLINE             

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2

 

[oracle@rac1 u01]$ cd 5689937/

[oracle@rac1 5689937]$ opatch apply -local

Invoking OPatch 10.2.0.1.0

 

Oracle interim Patch Installer version 10.2.0.1.0

Copyright (c) 2005, Oracle Corporation.  All rights reserved..

 

 

Oracle Home       : /u01/app/oracle/product/10.2.0/db_1

Central Inventory : /u01/app/oraInventory

   from           : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc

OPatch version    : 10.2.0.1.0

OUI version       : 10.2.0.1.0

OUI location      : /u01/app/oracle/product/10.2.0/db_1/oui

Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2011_Apr_03_15-47-59-CST_Sun.log

 

ApplySession applying interim patch '5689937' to OH '/u01/app/oracle/product/10.2.0/db_1'

ApplySession: Optional component(s) [ oracle.sdo.companion, 10.2.0.1.0 ] , [ oracle.isearch.client, 10.2.0.1.0 ] , [ oracle.ons, 10.2.0.1.0 ]  not present in the Oracle Home or a higher version is found.

Invoking fuser to check for active processes.

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/genezi"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/oracle"

 

You selected -local option, hence OPatch will patch the local system only.

 

 

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.

(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')

 

Is the local system ready for patching?

 

Do you want to proceed? [y|n]

y

User Responded with: Y

Backing up files and inventory (not for auto-rollback) for the Oracle Home

Backing up files affected by the patch '5689937' for restore. This might take a while...

Backing up files affected by the patch '5689937' for rollback. This might take a while...

Command invocation returned Error... 'touch: cannot touch `/bin/genoccish': Permission denied

chmod: cannot access `/bin/genoccish': No such file or directory

', Return Code = 1

Execution of PRE script failed, with return value = 1

Do you want to proceed? [y|n]

y

User Responded with: Y

 

Patching component oracle.rdbms.rsf, 10.2.0.1.0...

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcpi4.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcs.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libgeneric10.a"  with "lib/libgeneric10.a/qcsj.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libcommon10.a"  with "lib/libcommon10.a/ttcbur.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libcommon10.a"  with "lib/libcommon10.a/ttcdrv.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libcommon10.a"  with "lib/libcommon10.a/ttcpip.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libcommon10.a"  with "lib/libcommon10.a/ttccdf.o"

Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libcommon10.a"  with "lib/libcommon10.a/ttcclr.o"

Copying file to "/u01/app/oracle/product/10.2.0/db_1/rdbms/lib/genezi.o"

...

Copying file to "/u01/app/oracle/product/10.2.0/db_1/cpu/CPUJan2007/MODPLSQL/check.sh"

Copying file to "/u01/app/oracle/product/10.2.0/db_1/cpu/CPUJan2007/MODPLSQL/modplsqlcpu.sql"

Copying file to "/u01/app/oracle/product/10.2.0/db_1/cpu/CPUJan2007/MODPLSQL/owadummy.sql"

Running make for target igenezi

Running make for target client_sharedlib

Running make for target install

Running make for target libnmemso

Running make for target ioracle

Running make for target itnslsnr

Running make for target ilsnrctl

ApplySession adding interim patch '5689937' to inventory

 

--------------------------------------------------------------------------------

*********************************************************************

**                ATTENTION                                   **

**                                                                            **

** Please note that the Security Patch Installation (Patch Deinstallation) is **

** not complete until all the Post Installation (Post Deinstallation)         **

** instructions noted in the Readme accompanying this patch, have been        **

** successfully completed.                                                    **

**                                                                            **

*********************************************************************

 

--------------------------------------------------------------------------------

 

Execution of 'sh /u01/5689937/custom/scripts/post -apply 5689937 ':

 

Return Code = 0

 

The local system has been patched and can be restarted.

 

 

OPatch succeeded.

[oracle@rac1 5689937]$

 

[oracle@rac1 u01]$ srvctl start nodeapps -n rac1

[oracle@rac1 u01]$ srvctl start asm -n rac1 -i +ASM1

[oracle@rac1 u01]$ srvctl start instance -d dave -i dave1

 

[oracle@rac1 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2  

 

[oracle@rac1 u01]$ scp -r 5689937 192.168.2.43:/u01

 

在节点2上进行操作:

[oracle@rac2 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2     

[oracle@rac2 u01]$ srvctl stop instance -d dave -i dave2

[oracle@rac2 u01]$ srvctl stop nodeapps -n rac2

[oracle@rac2 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            OFFLINE    OFFLINE              

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     OFFLINE              

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              OFFLINE    OFFLINE             

ora.rac2.LISTENER_RAC2.lsnr    OFFLINE    OFFLINE             

ora.rac2.gsd                   OFFLINE    OFFLINE              

ora.rac2.ons                   OFFLINE    OFFLINE             

ora.rac2.vip                   OFFLINE    OFFLINE    

 

 

 

[oracle@rac2 OPatch]$ cd /u01/5689937/

[oracle@rac2 5689937]$ ls

custom  etc  files  README.txt

[oracle@rac2 5689937]$ opatch apply -local

....

The local system has been patched and can be restarted.

 

OPatch succeeded.

 

[oracle@rac2 u01]$ srvctl start nodeapps -n rac2

[oracle@rac2 u01]$ srvctl start asm -n rac2 -i +ASM2

[oracle@rac2 u01]$ srvctl start instance -d dave -i dave2

[oracle@rac2 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2   

 

后续操作:

 

[oracle@rac2 u01]$ cd /u01/app/oracle/product/10.2.0/db_1/cpu/CPUJan2007 

[oracle@rac2 CPUJan2007]$ sqlplus / as sysdba;

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Apr 3 16:17:38 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

 

SQL> @catcpu.sql

........

No errors.

No. of Invalid Objects is :18

Please refer to README.html to for instructions on validating these objects

Logfile for the current catcpu.sql session is : APPLY_DAVE_03Apr2011_16_17_56.log

not spooling currently

SQL> select count(*) from dba_objects where status= 'INVALID';

  COUNT(*)

----------

        18

SQL> @?/rdbms/admin/utlrp.sql

.....

 

DOC> The following query reports the number of errors caught during

DOC> recompilation. If this number is non-zero, please query the error

DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors

DOC> are due to misconfiguration or resource constraints that must be

DOC> fixed before objects can compile successfully.

DOC>#

 

ERRORS DURING RECOMPILATION

---------------------------

                          0

 

 

最后确认下Patch 的安装情况:

[oracle@rac2 u01]$ opatch lsinventory

Invoking OPatch 10.2.0.1.0

 

Oracle interim Patch Installer version 10.2.0.1.0

Copyright (c) 2005, Oracle Corporation.  All rights reserved..

 

 

Oracle Home       : /u01/app/oracle/product/10.2.0/db_1

Central Inventory : /u01/app/oraInventory

   from           : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc

OPatch version    : 10.2.0.1.0

OUI version       : 10.2.0.1.0

OUI location      : /u01/app/oracle/product/10.2.0/db_1/oui

Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2011_Apr_03_16-24-11-CST_Sun.log

 

Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory-2011_Apr_03_16-24-11-CST_Sun.txt

 

--------------------------------------------------------------------------------

Installed Top-level Products (1):

 

Oracle Database 10g                                                  10.2.0.1.0

There are 1 products installed in this Oracle Home.

 

 

Interim patches (1) :

 

Patch  5689937      : applied on Sun Apr 03 16:12:59 CST 2011

   Created on 8 Jan 2007, 11:48:31 hrs US/Eastern

   Bugs fixed:

     4671216, 4925103, 4604970, 4616376, 5689937, 4288876, 5225798, 5694720

     4754888, 4750469, 4369235, 4751931, 4966716, 5049080, 5242648, 4348230

     5490846, 4630549, 5490936, 5049088

 

 

Rac system comprising of multiple nodes

  Local node = rac2

  Remote node = rac1

 

--------------------------------------------------------------------------------

 

OPatch succeeded.

 

 

RAC 平台下 Patch 的安装到此结束。

 

 

. Patch 卸载示例

 

节点1操作:

[oracle@rac1 u01]$ srvctl stop instance -d dave -i dave1

[oracle@rac1 u01]$ srvctl stop nodeapps -n rac1

[oracle@rac1 u01]$ cd 5689937/

[oracle@rac1 5689937]$ opatch rollback -id 5689937 -local

--注意这里的local,如果不加local,在节点1上操作完了,会继续操作节点2.

Invoking OPatch 10.2.0.1.0

 

Oracle interim Patch Installer version 10.2.0.1.0

Copyright (c) 2005, Oracle Corporation.  All rights reserved..

 

 

Oracle Home       : /u01/app/oracle/product/10.2.0/db_1

Central Inventory : /u01/app/oraInventory

   from           : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc

OPatch version    : 10.2.0.1.0

OUI version       : 10.2.0.1.0

OUI location      : /u01/app/oracle/product/10.2.0/db_1/oui

Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2011_Apr_03_17-02-32-CST_Sun.log

 

RollbackSession rolling back interim patch '5689937' from OH '/u01/app/oracle/product/10.2.0/db_1'

Invoking fuser to check for active processes.

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/genezi"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/lsnrctl"

Invoking fuser on "/u01/app/oracle/product/10.2.0/db_1/bin/oracle"

 

OPatch detected the node list and the local node from the inventory.  OPatch will patch the local system then propagate the patch to the remote nodes.

 

 

This node is part of an Oracle Real Application Cluster.

Remote nodes: 'rac2'

Local node: 'rac1'

Please shut down Oracle instances running out of this ORACLE_HOME on all the nodes.

(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')

 

Are all the nodes ready for patching?

 

Do you want to proceed? [y|n]

y

User Responded with: Y

Backing up files affected by the patch '5689937' for restore. This might take a while...

Command invocation returned Error... 'touch: cannot touch `/bin/genoccish': Permission denied

chmod: cannot access `/bin/genoccish': No such file or directory

', Return Code = 1

Execution of PRE script failed, with return value = 1

Do you want to proceed? [y|n]

y

User Responded with: Y

 

Patching component oracle.rdbms.rsf, 10.2.0.1.0...

 

 

[oracle@rac1 5689937]$ srvctl start nodeapps -n rac1

[oracle@rac1 5689937]$ srvctl start asm -n rac1 -i +ASM1

[oracle@rac1 5689937]$ srvctl start instance -d dave -i dave1

 

 

节点2操作:

[oracle@rac2 u01]$ srvctl stop instance -d dave -i dave2

[oracle@rac2 u01]$ srvctl stop nodeapps -n rac2

[oracle@rac2 u01]$ ls   

5689937  backup       rman_backup.sh      software

app      crs_stat.sh  rman_backup.sh.out  sw

[oracle@rac2 u01]$ cd 5689937/

[oracle@rac2 5689937]$ opatch rollback -id 5689937 -local

 

[oracle@rac2 5689937]$ srvctl start nodeapps -n rac2

[oracle@rac2 5689937]$ srvctl start asm -n rac2 -i +ASM2

[oracle@rac2 5689937]$ srvctl start instance -d dave -i dave2

 

[oracle@rac2 u01]$ sh crs_stat.sh

Name                           Target     State      Host     

------------------------------ ---------- ---------  -------  

ora.dave.dave1.inst            ONLINE     ONLINE     rac1     

ora.dave.dave2.inst            ONLINE     ONLINE     rac2     

ora.dave.db                    ONLINE     ONLINE     rac2     

ora.dave.taf.cs                ONLINE     ONLINE     rac2     

ora.dave.taf.dave1.srv         ONLINE     ONLINE     rac1     

ora.dave.taf.dave2.srv         ONLINE     ONLINE     rac2     

ora.rac1.ASM1.asm              ONLINE     ONLINE     rac1     

ora.rac1.LISTENER_RAC1.lsnr    ONLINE     ONLINE     rac1     

ora.rac1.gsd                   ONLINE     ONLINE     rac1     

ora.rac1.ons                   ONLINE     ONLINE     rac1     

ora.rac1.vip                   ONLINE     ONLINE     rac1     

ora.rac2.ASM2.asm              ONLINE     ONLINE     rac2     

ora.rac2.LISTENER_RAC2.lsnr    ONLINE     ONLINE     rac2     

ora.rac2.gsd                   ONLINE     ONLINE     rac2     

ora.rac2.ons                   ONLINE     ONLINE     rac2     

ora.rac2.vip                   ONLINE     ONLINE     rac2  

 

 

后续操作:

       Patch readme里说的catcpu_rollback.sql脚本是在$ORACLE_HOME/cpu/CPUJan2007/目录里,但是patch 一旦rollback 之后,对应的文件就被删除掉了。

 

Find 搜了一下,这个文件在备份的目录还是有的:

[oracle@rac1 db_1]$ find . -name catcpu_rollback.sql

./.patch_storage/5689937_Jan_8_2007_11_48_31/original_patch/files/cpu/CPUJan2007/catcpu_rollback.sql

./.patch_storage/5689937_Jan_8_2007_11_48_31/backup/cpu/CPUJan2007/catcpu_rollback.sql

 

同时,在patch的安装目录里也有这个文件:

[oracle@rac1 CPUJan2007]$ pwd

/u01/5689937/files/cpu/CPUJan2007

[oracle@rac1 CPUJan2007]$ ls

catcpu_rollback.sql  javcpu.sql  prvtcr.plb  xdbcpu.sql

catcpu.sql           MODPLSQL    sdocpu.sql

 

所以,这里进Patch的安装目录来执行这个脚本:

 

[oracle@rac1 CPUJan2007]$ pwd

/u01/5689937/files/cpu/CPUJan2007

[oracle@rac1 CPUJan2007]$ sqlplus / as sysdba;

 

SQL*Plus: Release 10.2.0.1.0 - Production on Sun Apr 3 17:35:33 2011

 

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, OLAP and Data Mining options

 

SQL> @catcpu_rollback.sql

...

No. of Invalid Objects is :18

Please refer to README.html to for instructions on validating these objects

Logfile for the current catcpu_rollback.sql session is : ROLLBACK_DAVE_03Apr2011_17_35_41.log

not spooling currently

 

同样有18个无效对象。 编译一下:

SQL> @?/rdbms/admin/utlrp.sql

...

DOC> The following query reports the number of errors caught during

DOC> recompilation. If this number is non-zero, please query the error

DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors

DOC> are due to misconfiguration or resource constraints that must be

DOC> fixed before objects can compile successfully.

DOC>#

 

ERRORS DURING RECOMPILATION

---------------------------

                          0

 

最后确认一下:

[oracle@rac1 u01]$ opatch lsinventory

Invoking OPatch 10.2.0.1.0

 

Oracle interim Patch Installer version 10.2.0.1.0

Copyright (c) 2005, Oracle Corporation.  All rights reserved..

 

 

Oracle Home       : /u01/app/oracle/product/10.2.0/db_1

Central Inventory : /u01/app/oraInventory

   from           : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc

OPatch version    : 10.2.0.1.0

OUI version       : 10.2.0.1.0

OUI location      : /u01/app/oracle/product/10.2.0/db_1/oui

Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2011_Apr_03_17-41-23-CST_Sun.log

 

Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory-2011_Apr_03_17-41-23-CST_Sun.txt

 

--------------------------------------------------------------------------------

Installed Top-level Products (1):

 

Oracle Database 10g                                                  10.2.0.1.0

There are 1 products installed in this Oracle Home.

 

 

There are no Interim patches installed in this Oracle Home.

 

Rac system comprising of multiple nodes

  Local node = rac1

  Remote node = rac2

 

--------------------------------------------------------------------------------

 

OPatch succeeded.

 

这里已经没有了我们patch的信息了。patch的卸载到此结束。

 

 

.  Patch 安装脚本

       如果Path多的话,可以使用如下脚本来执行,不过还是需要手工的输入确定Y 这个脚本是Jin 同学给我的。 感谢他的辛勤劳动。

#!/bin/sh

# sh run.sh | tee -a log

# before run,check the dir

 

PATCHNUM='

5898210

5065418

'

export PATH=$PATH:/usr/ccs/bin

for numdir in $PATCHNUM

do

cd ${numdir}

$ORACLE_HOME/ OPatch/opatch apply -silent -local

--注意:silent 默认会选择n

$ORACLE_HOME/ OPatch/opatch apply -local

echo ${numdir} ok

echo ---------------------OK-----------------------

echo ---------------------NEXT---------------------

cd ..

done

exit 0

 

 

 

 

 

 

---------------------------------------------------------------------------------------------------

Blog http://blog.csdn.net/tianlesoftware

网上资源: http://tianlesoftware.download.csdn.net

相关视频:http://blog.csdn.net/tianlesoftware/archive/2009/11/27/4886500.aspx

DBA1 群:62697716(); DBA2 群:62697977() DBA3 群:62697850()  

DBA 超级群:63306533(); DBA4 群: 83829929 DBA5群: 142216823

聊天 群:40132017  聊天2群:69087192

--加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

你可能感兴趣的:(oracle,File,平台,patch,installer,archive)