ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RAC环境ROLLING UPGRADE方式应用PATCH

RAC环境ROLLING UPGRADE方式应用PATCH

原创 Linux操作系统 作者:yangtingkun 时间:2009-04-15 16:39:15 0 删除 编辑

OracleRAC环境支持ROLLING UPGRADE方式安装PATCH

 

 

所谓ROLLING UPGRADE安装补丁或升级是指高可用环境中一个节点先安装补丁或升级版本,由其他的节点提供服务,随后升级或安装补丁后的节点启动提供服务,然后其他的节点再安装补丁或升级。整个安装补丁或升级过程中不停止对外提供服务。

OracleDATA GUARDSTREAMRAC等高可用环境都支持ROLLING UPGRADE,不过RAC环境仅支持补丁的ROLLING UPGRADE,不支持补丁集的安装以及版本的升级。

昨天碰到了一个Solaris上的bughttp://yangtingkun.itpub.net/post/468/482352。这里描述在RAC环境中,使用ROLLING UPGRADE方式来应用PATCH,修正这个bug

首先在本机通过sqlplus登陆数据库:

SQL> conn test/test@test
已连接。
SQL> set pages 100 lines 120
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
test1

SQL> select name from v$database;

NAME
---------
TEST

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
PL/SQL Release 11.1.0.6.0 - Production
CORE    11.1.0.6.0      Production
TNS for Solaris: Version 11.1.0.6.0 - Production
NLSRTL Version 11.1.0.6.0 - Production

现在登陆到数据库的实例1

下面在实例1所在的节点解开补丁:

bash-3.00$ mkdir $ORACLE_HOME/patch
bash-3.00$ mv p5885301_111060_SOLARIS64.zip $ORACLE_HOME/patch
bash-3.00$ cd $ORACLE_HOME/patch
bash-3.00$ ls
p5885301_111060_SOLARIS64.zip
bash-3.00$ unzip p5885301_111060_SOLARIS64.zip
Archive:  p5885301_111060_SOLARIS64.zip
   creating: 5885301/
   creating: 5885301/files/
   creating: 5885301/files/lib/
   creating: 5885301/files/lib/libcommon11.a/
  inflating: 5885301/files/lib/libcommon11.a/slspool.o 
   creating: 5885301/files/lib32/
   creating: 5885301/files/lib32/libcommon11.a/
  inflating: 5885301/files/lib32/libcommon11.a/slspool.o 
   creating: 5885301/etc/
   creating: 5885301/etc/config/
  inflating: 5885301/etc/config/inventory.xml 
  inflating: 5885301/etc/config/actions.xml 
   creating: 5885301/etc/xml/
  inflating: 5885301/etc/xml/GenericActions.xml 
  inflating: 5885301/etc/xml/ShiphomeDirectoryStructure.xml 
  inflating: 5885301/README.txt     

现在要关闭节点1上所有的实例,当然也包括ASM实例:

bash-3.00$ srvctl stop inst -d test -i test1
bash-3.00$ srvctl stop asm -n ser1
bash-3.00$ srvctl stop listener -n ser1

检查客户端的连接:

SQL> select * from dual;
select * from dual
*
1 行出现错误:
ORA-12571: TNS:
包写入程序失败


SQL> conn test/test@test
已连接。
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
test2

SQL> select name from v$database;

NAME
---------
TEST

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
test2

由于实例1已经关闭,所以会话被断开,再次连接会话连接到实例2上。

下面开始节点1上的patch操作:

bash-3.00$ cd 5885301/
bash-3.00$ $ORACLE_HOME/Opatch/opatch apply
bash: /data/oracle/product/11.1/database/Opatch/opatch: No such file or directory
bash-3.00$ /data/oracle/product/11.1/database/OPatch/opatch apply
Invoking OPatch 11.1.0.6.0

Oracle Interim Patch Installer version 11.1.0.6.0
Copyright (c) 2007, Oracle Corporation.  All rights reserved.


Oracle Home       : /data/oracle/product/11.1/database
Central Inventory : /data/oraInventory
   from           : /var/opt/oracle/oraInst.loc
OPatch version    : 11.1.0.6.0
OUI version       : 11.1.0.6.0
OUI location      : /data/oracle/product/11.1/database/oui
Log file location : /data/oracle/product/11.1/database/cfgtoollogs/opatch/opatch2009-04-15_16-13-03PM.log

ApplySession applying interim patch '5885301' to OH '/data/oracle/product/11.1/database'

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.

Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '5885301' for restore. This might take a while...
Backing up files affected by the patch '5885301' for rollback. This might take a while...

Patching component oracle.rdbms, 11.1.0.6.0...
Updating archive file "/data/oracle/product/11.1/database/lib/libcommon11.a"  with "lib/libcommon11.a/slspool.o"
Updating archive file "/data/oracle/product/11.1/database/lib32/libcommon11.a"  with "lib32/libcommon11.a/slspool.o"
Running make for target client_sharedlib
ApplySession adding interim patch '5885301' to inventory

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

Patching in rolling mode.

Updating nodes 'ser2'
   Apply-related files are:
     FP = "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt"
     DP = "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_dirs.txt"
     MP = "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/make_cmds.txt"
     RC = "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/remote_cmds.txt"

Instantiating the file "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated" by replacing $ORACLE_HOME in "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt" with actual path.
Propagating files to remote nodes...

OPatch failed to copy files to remote nodes 'ser2' .  Detail: Error while copying files inside directory '/data/oracle/product/11.1/database' based on listed file '/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated' to nodes 'ser2'. [PRKC-1073 : Failed to transfer directory "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated" to any of the given nodes "ser2 ".
Error on node ser2:PRKC-1044 : Failed to check remote command execution setup for node ser2 using shells /usr/bin/ssh and /usr/bin/rsh
permission denied]

OPatch failed to copy files to remote nodes 'ser2' .
Do you want to proceed? [y|n]
n
User Responded with: N
OPatch failed to propagate the patch to the remote node(s).
Run the patch again on each of the remote node(s) using -local option.
Details: Error while copying files inside directory '/data/oracle/product/11.1/database' based on listed file '/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated' to nodes 'ser2'. [PRKC-1073 : Failed to transfer directory "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated" to any of the given nodes "ser2 ".
Error on node ser2:PRKC-1044 : Failed to check remote command execution setup for node ser2 using shells /usr/bin/ssh and /usr/bin/rsh
permission denied]
ApplySession failed: OUI-67081:OPatch failed to propagate the patch to the remote node(s).
Run the patch again on each of the remote node(s) using -local option.
Details: Error while copying files inside directory '/data/oracle/product/11.1/database' based on listed file '/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated' to nodes 'ser2'. [PRKC-1073 : Failed to transfer directory "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated" to any of the given nodes "ser2 ".
Error on node ser2:PRKC-1044 : Failed to check remote command execution setup for node ser2 using shells /usr/bin/ssh and /usr/bin/rsh
permission denied]
System intact, OPatch will not attempt to restore the system
--------------------------------------------------------------------------------
The following warnings have occurred during OPatch execution:
1) OUI-67187:
OPatch failed to copy files to remote nodes 'ser2' .  Detail: Error while copying files inside directory '/data/oracle/product/11.1/database' based on listed file '/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated' to nodes 'ser2'. [PRKC-1073 : Failed to transfer directory "/data/oracle/product/11.1/database/.patch_storage/5885301_Oct_6_2008_22_40_42/rac/copy_files.txt.instantiated" to any of the given nodes "ser2 ".
Error on node ser2:PRKC-1044 : Failed to check remote command execution setup for node ser2 using shells /usr/bin/ssh and /usr/bin/rsh
permission denied]
--------------------------------------------------------------------------------

OPatch failed with error code 73

远端节点操作失败,这是正常的,因为远端节点还在运行。下面启动本地实例:

bash-3.00$ srvctl start asm -n ser1
bash-3.00$ srvctl start inst -d test -i test1
bash-3.00$ srvctl start listener -n ser1

检查实例1bug是否已经解决:

bash-3.00$ export ORACLE_SID=test1
bash-3.00$ sqlplus test/test

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 4 15 16:20:31 2009

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


连接到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> spo /export/home/oracle/result.txt
SQL> select 1 from dual;

         1
----------
         1

SQL> spo out
_default: unknown printer
SQL>

节点1上的bug已经解决,且数据库一直对外提供服务,下面在节点2上执行相同的操作:

bash-3.00$ srvctl stop inst -d test -i test2
bash-3.00$ srvctl stop asm -n ser2
bash-3.00$ srvctl stop listener -n ser2

检查客户端的连接:

SQL> select * from dual;
select * from dual
*
1 行出现错误:
ORA-12571: TNS:
包写入程序失败


SQL> conn test/test@test
已连接。
SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
test1

SQL> select name from v$database;

NAME
---------
TEST

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
test1

同样在节点2应用PATCH的时候,节点1上的实例可以对外提供服务。

下面在节点2上打PATCH,为了避免打PATCH的时候出现类似节点1上的错误,在应用PATCH的时候指定-LOCAL参数:

bash-3.00$ cd 5885301/
bash-3.00$ $ORACLE_HOME/OPatch/opatch apply -local
Invoking OPatch 11.1.0.6.0

Oracle Interim Patch Installer version 11.1.0.6.0
Copyright (c) 2007, Oracle Corporation.  All rights reserved.


Oracle Home       : /data/oracle/product/11.1/database
Central Inventory : /data/oraInventory
   from           : /var/opt/oracle/oraInst.loc
OPatch version    : 11.1.0.6.0
OUI version       : 11.1.0.6.0
OUI location      : /data/oracle/product/11.1/database/oui
Log file location : /data/oracle/product/11.1/database/cfgtoollogs/opatch/opatch2009-04-15_16-32-03PM.log

ApplySession applying interim patch '5885301' to OH '/data/oracle/product/11.1/database'

Running prerequisite checks...

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

Backing up files and inventory (not for auto-rollback) for the Oracle Home
Backing up files affected by the patch '5885301' for restore. This might take a while...
Backing up files affected by the patch '5885301' for rollback. This might take a while...

Patching component oracle.rdbms, 11.1.0.6.0...
Updating archive file "/data/oracle/product/11.1/database/lib/libcommon11.a"  with "lib/libcommon11.a/slspool.o"
Updating archive file "/data/oracle/product/11.1/database/lib32/libcommon11.a"  with "lib32/libcommon11.a/slspool.o"
Running make for target client_sharedlib
ApplySession adding interim patch '5885301' to inventory

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

OPatch succeeded.

PATCH应用成功,启动节点2上的服务:

bash-3.00$ srvctl start asm -n ser2
bash-3.00$ srvctl start inst -d test -i test2
bash-3.00$ srvctl start listener -n ser2

节点2上的实例已经启动,下面检查客户端的连接是否正常:

SQL> select instance_name from gv$instance;

INSTANCE_NAME
----------------
test1
test2

可以看到节点1上的连接正常,且数据库的两个实例都已经启动。虽然在应用补丁的过程中,两个实例都重启过,但是数据库对外的服务一直没有停止。

至此ROLLING UPGRADE方式应用补丁的操作已经完成,本文只是为了说明ROLLING UPGRADE与普通应用PATCH的区别,所以没有在节点1上使用-LOCAL选项应用补丁。真正ROLLING UPGRADE操作应该在RAC的每个节点上已-LOCAL方式应用补丁。

 

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

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10455860