之前整理过一篇Oracle Patch的文章,参考:
Oracle补丁体系及opatch工具介绍
http://blog.youkuaiyun.com/xujinyang/article/details/6832671
关于Oracle Patch的知识,参考之前的文章。这篇主要是演示下RAC平台下Patch的安装与卸载。
一.Path安装说明
在metalink上下了个Path:5689937,在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.2Patch安装的后续操作
选择一个节点,执行如下操作即可。在这个操作期间,用户可以访问数据库。
(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.3Patch卸载
(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.4Patch卸载的后续操作
在其中一个节点上执行如下操作:
(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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
我这里配置了Server-side TAF.所以net service name(tnsnames.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.youkuaiyun.com/xujinyang/article/details/6829647
测试:
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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
[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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instOFFLINEOFFLINE
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEOFFLINE
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmOFFLINEOFFLINE
ora.rac1.LISTENER_RAC1.lsnrOFFLINEOFFLINE
ora.rac1.gsdOFFLINEOFFLINE
ora.rac1.onsOFFLINEOFFLINE
ora.rac1.vipOFFLINEOFFLINE
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
[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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
[oracle@rac1 u01]$ scp -r 5689937 192.168.2.43:/u01
在节点2上进行操作:
[oracle@rac2 u01]$ sh crs_stat.sh
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
[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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instOFFLINEOFFLINE
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEOFFLINE
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmOFFLINEOFFLINE
ora.rac2.LISTENER_RAC2.lsnrOFFLINEOFFLINE
ora.rac2.gsdOFFLINEOFFLINE
ora.rac2.onsOFFLINEOFFLINE
ora.rac2.vipOFFLINEOFFLINE
[oracle@rac2 OPatch]$ cd /u01/5689937/
[oracle@rac2 5689937]$ ls
custometcfilesREADME.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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
后续操作:
[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 10g10.2.0.1.0
There are 1 products installed in this Oracle Home.
Interim patches (1) :
Patch5689937: 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
5689937backuprman_backup.shsoftware
appcrs_stat.shrman_backup.sh.outsw
[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
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac2
ora.dave.taf.csONLINEONLINErac2
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
后续操作:
看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.sqljavcpu.sqlprvtcr.plbxdbcpu.sql
catcpu.sqlMODPLSQLsdocpu.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 10g10.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
---------------------------------------------------------------------------------------------------