Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6547504
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: Oracle

2014-02-04 20:26:37

环境:
os: Red Hat Linux As 5
DB:10.2.0.5

1.下载补丁号12419392
这个需要下载,下载完成后上传到服务器并解压到相应的目录,同时修改目录属主。
[root@node1 soft]#mkdir 12419392
[root@node1 soft]# unzip -d ./12419392 p12419392_10205_LINUX.zip
[root@node1 soft]# chown -R oracle:oinstall ./12419392


2.查看该补丁能否采用rolling方式升级
采用这种方法对应用系统没有影响的,升级一个节点的同时,其他节点不需要停机.
node1-> ./opatch query -all  /soft/12419392/12419392|grep rolling
 Patch is a rolling patch: true

返回true说明该补丁可以采用滚动方式升级

3.升级节点1
我这里是两个节点的rac,这里先升级节点1
关闭节点1
node1-> srvctl stop instance -d racdb -i racdb1
node1-> srvctl stop listener -n node1
node1-> srvctl stop asm -n node1

node1-> cd 12419392/
node1-> /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply
Invoking OPatch 10.2.0.4.9

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


Oracle Home       : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.4.9
OUI version       : 10.2.0.5.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/opatch2014-02-04_07-54-40AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

ApplySession applying interim patch '12419392' to OH '/u01/app/oracle/product/10.2.0/db_1'
ApplySession failed: ApplySession failed to prepare the system.

Patch 12419392 requires OPatch version 10.2.0.5.0.
The OPatch version being used (10.2.0.4.9) doesn't meet the minimum version required by the patch(es). Please download latest OPatch from My Oracle Support.

System intact, OPatch will not attempt to restore the system

OPatch failed with error code 73

这里是因为opatch版本过低的原因,这个时候需要升级opatch,具体升级步骤可以查看
http://blog.chinaunix.net/uid-77311-id-4096341.html


4.opatch升级完成后重新重新执行如下命令
node1-> /u01/app/oracle/product/10.2.0/db_1/OPatch/opatch apply

Running prerequisite checks...
Patch 12419392: Optional component(s) missing : [ oracle.rdbms.dv, 10.2.0.5.0 ] , [ oracle.rdbms.dv.oc4j, 10.2.0.5.0 ]


Patching component oracle.rdbms.rman, 10.2.0.5.0...
Running make for target client_sharedlib
Running make for target ioracle
Running make for target iwrap
Running make for target client_sharedlib
Running make for target proc
Running make for target irman
ApplySession adding interim patch '12419392' to inventory

Verifying the update...
Inventory check OK: Patch ID 12419392 is registered in Oracle Home inventory with proper meta-data.
Files check OK: Files from Patch ID 12419392 are present in Oracle Home.

The local system has been patched.  You can restart Oracle instances on it.


Patching in rolling mode.


The node 'node2' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'node2'.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')

Is the node ready for patching? [y|n]

这个时候打开不要输入任何内容,打开另外一个窗口启动实例1
node1-> srvctl start asm -n node1
node1-> srvctl start instance -d racdb -i racdb1
node1-> srvctl start listener -n node1


关闭实例2

node2-> srvctl stop instance -d racdb -i racdb2
node2-> srvctl stop listener -n node2
node3-> srvctl stop asm -n node2

等待实例2关闭完成后,回到刚才升级的窗口,在提升下输入'Y',升级节点2
User Responded with: Y
Updating nodes 'node2'
   Apply-related files are:
     FP = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/copy_files.txt"
     DP = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/copy_dirs.txt"
     MP = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/make_cmds.txt"
     RC = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/remote_cmds.txt"

Instantiating the file "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...

...

The node 'node2' has been patched.  You can restart Oracle instances on it.

There were relinks on remote nodes.  Remember to check the binary size and timestamp on the nodes 'node2' .
The following make commands were invoked on remote nodes:
'cd /u01/app/oracle/product/10.2.0/db_1/rdbms/lib; /usr/bin/make -f ins_rdbms.mk client_sharedlib ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
cd /u01/app/oracle/product/10.2.0/db_1/rdbms/lib; /usr/bin/make -f ins_rdbms.mk ioracle ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
cd /u01/app/oracle/product/10.2.0/db_1/plsql/lib; /usr/bin/make -f ins_plsql.mk iwrap ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
cd /u01/app/oracle/product/10.2.0/db_1/network/lib; /usr/bin/make -f ins_net_client.mk client_sharedlib ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
cd /u01/app/oracle/product/10.2.0/db_1/precomp/lib; /usr/bin/make -f ins_precomp.mk proc ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
cd /u01/app/oracle/product/10.2.0/db_1/rdbms/lib; /usr/bin/make -f ins_rdbms.mk irman ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1


按照提示启动实例2
node1-> srvctl start asm -n node2
node1-> srvctl start instance -d racdb -i racdb2
node1-> srvctl start listener -n node2

到这里节点1和节点2都升级完成.

5.执行脚本
注意rac环境,该脚本只在一个节点上执行即可,所数据库已经启动的情况下,不需要再启动数据库,直接执行脚本即可。

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> @utlrp.sql
SQL> QUIT

6.验证升级情况
node1->cd /u01/app/oracle/product/10.2.0/db_1/OPatch
node1-> ./opatch lsinv
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       : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.5.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/opatch2014-02-04_11-11-59AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-02-04_11-11-59AM.txt

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

Oracle Database 10g                                                  10.2.0.1.0
Oracle Database 10g Release 2 Patch Set 4                           10.2.0.5.0a
There are 2 products installed in this Oracle Home.


Interim patches (1) :

Patch  12419392     : applied on Tue Feb 04 11:00:13 CST 2014
Unique Patch ID:  13710478
   Created on 25 May 2011, 01:06:08 hrs PST8PDT
   Bugs fixed:
     6402302, 10269717, 10327190, 8865718, 10017048, 9024850, 8394351, 8546356
     9360157, 9770451, 9020537, 9772888, 8664189, 10091698, 12551710, 7519406
     10132870, 8771916, 9109487, 10173237, 10068982, 8350262, 11792865
     11724962, 11725006, 9184754, 8544696, 9320130, 7026523, 8277300, 9726739
     8412426, 12419392, 6651220, 9150282, 9659614, 9949948, 10327179, 8882576
     7612454, 9711859, 9714832, 10248542, 9952230, 9469117, 9952270, 8660422
     10324526, 12419258, 9713537, 10010310, 9390484, 9963497, 12551700
     12551701, 10249537, 12551702, 12551703, 8211733, 12551704, 9548269
     12551705, 12551706, 9337325, 12551707, 7602341, 12551708, 9308296
     10157402, 11737047

 

Rac system comprising of multiple nodes
  Local node = node1
  Remote node = node2

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

OPatch succeeded.

SQL>Select t.Action, t.Namespace, t.Version, t.Id, t.Bundle_Series, t.Comments
  From Dba_Registry_History t




node1-> ./opatch lsinventory -bugs_fixed|grep -i 'PSU'
9952230    12419392  Tue Feb 04 11:00:13 CST 2014   DATABASE PSU 10.2.0.5.1 (INCLUDES CPUOCT2010)
10248542   12419392  Tue Feb 04 11:00:13 CST 2014   DATABASE PSU 10.2.0.5.2 (INCLUDES CPUJAN2011)
11724962   12419392  Tue Feb 04 11:00:13 CST 2014   DATABASE PSU 10.2.0.5.3 (INCLUDES CPUAPR2011)
12419392   12419392  Tue Feb 04 11:00:13 CST 2014   DATABASE PSU 10.2.0.5.4 (INCLUDES CPUJUL2011)


若是发现打过补丁后,数据库出现问题,可以采用如下的方式进行回顾

1.确定如下回滚文件存在
文件名:$ORACLE_HOME/rdbms/admin/catbundle_PSU__ROLLBACK.sql
在刚才升级的节点1上查找
node1-> cd /u01/app/oracle/product/10.2.0/db_1/rdbms/admin
node1-> ls -1|grep catbundle_PSU
catbundle_PSU_RACDB_APPLY.sql
catbundle_PSU_RACDB_ROLLBACK.sql

2.在节点1上做回滚,关闭实例1
node1-> srvctl stop listener -n node1
node1-> srvctl stop asm -n node1
node1-> srvctl stop instance -d racdb -i racdb1


3.回滚
node1-> cd /u01/app/oracle/product/10.2.0/db_1/OPatch
node1->./opatch rollback -id 12419392
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       : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
   from           : /etc/oraInst.loc
OPatch version    : 10.2.0.5.1
OUI version       : 10.2.0.5.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/opatch2014-02-05_04-57-26AM.log

Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt

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

Running prerequisite checks...

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: 'node2'
Local node: 'node1'
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? [y|n]

...

Patching component oracle.xdk.rsf, 10.2.0.5.0...
Updating archive file "/u01/app/oracle/product/10.2.0/db_1/lib/libxml10.a"  with "lib/libxml10.a/lpxpar.o"

Patching component oracle.precomp.common, 10.2.0.5.0...

Patching component oracle.rdbms.rman, 10.2.0.5.0...
Running make for target client_sharedlib
Running make for target ioracle
Running make for target iwrap
Running make for target client_sharedlib
Running make for target proc
Running make for target irman
RollbackSession removing interim patch '12419392' from inventory

Patching in rolling mode.


The node 'node2' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'node2'.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')

Is the node ready for patching? [y|n]

实例1已经回滚完成,这个时候启动实例1,同时关闭实例2

node1-> srvctl start asm -n node1
node1-> srvctl start instance -d racdb -i racdb1
node1-> srvctl start listener -n node1

node1-> srvctl stop listener -n node2
node1-> srvctl stop asm -n node2
node1-> srvctl stop instance -d racdb -i racdb2

关闭实例2后,回到刚才的回滚的窗口输入Y
The node 'node2' will be patched next.


Please shutdown Oracle instances running out of this ORACLE_HOME on 'node2'.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')

Is the node ready for patching? [y|n]
y
User Responded with: Y
Updating nodes 'node2'
   Rollback-related files are:
     FR = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/remove_files.txt"
     DR = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/remove_dirs.txt"
     FP = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/copy_files.txt"
     MP = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/make_cmds.txt"
     RC = "/u01/app/oracle/product/10.2.0/db_1/.patch_storage/12419392_May_25_2011_01_06_08/rac/remote_cmds.txt"

回滚完成后,启动实例2.

node1-> srvctl start asm -n node2
node1-> srvctl start instance -d racdb -i racdb2
node1-> srvctl start listener -n node2


4.执行回滚SQL
执行脚本只在一个节点上执行即可,这里在节点1上执行.
node1-> cd $ORACLE_HOME/rdbms/admin
node1-> sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @catbundle_PSU_RACDB_ROLLBACK.sql
SQL> @utlrp.sql

5.检查回滚情况
node1-> cd /u01/app/oracle/product/10.2.0/db_1/OPatch
node1-> ./opatch lsinventory -bugs_fixed|grep -i 'PSU'


--The End --

阅读(2721) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~