详述两种给Grid Infrastructure打补丁的方法


升级打补丁是系统管理员重要的工作内容。Oracle Grid Infrastructure是目前比较复杂的集群管理中间件,当出现各种奇怪问题的时候,寻求官方服务支持(MOS)和打补丁是最常见的做法。

同简单单实例文件系统数据库database补丁有所不同的是,GI(Grid Infrastructure)打补丁过程要涉及到其上ASM、Listener和Database Instance的各种关系。同时,一些关键骨架后台进程,如ohasd等还需要root权限的参与。

本篇笔者主要针对两种OPatch补丁策略,演示常见的两种给GI打补丁的方法,即Apply和Auto策略。

1、实验环境介绍

笔者选择Oracle 11gR2进行测试,GI版本为11.2.0.4。

[grid@NCR-Standby-Asm ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed May 27 09:32:18 2015

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

SQL> conn / as sysasm

Connected.

SQL> select * from v$version;

BANNER

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

Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

PL/SQL Release 11.2.0.4.0 - Production

CORE    11.2.0.4.0      Production

TNS for Linux: Version 11.2.0.4.0 - Production

NLSRTL Version 11.2.0.4.0 – Production

注意:根据Oracle官方意见,OPatch是进行补丁的重要工具。每个补丁解决故障问题不同,安装方式也有所差异。严格按照安装步骤、做好备份工作和预定好回退措施是确保补丁安装的重要步骤。另外,每次打补丁的时候,要从MOS上下载最新版本的OPatch程序包,替换$ORACLE_HOME下的程序包。

2、OPatch Apply策略补丁

和Oracle Instance不同,GI的工作机制更加复杂,基础进行ohasd等都是绑定在操作系统init级别的进程。使用OPatch Apply策略进行补丁的时候,要注意操作前提和步骤、确保相关进程服务关闭。

首先解压补丁文件包。

[root@NCR-Standby-Asm upload]# ls -l

total 282780

drwxr-xr-x 4 oracle oinstall      4096 Oct 20  2014 19852360

-rw-r--r-- 1 oracle oinstall    407030 May 25 09:06 p19852360_112040_Generic.zip

注意:要参考补丁安装文档,确定使用哪个用户进行补丁执行操作。一般Apply方式进行GI补丁,使用grid用户比较常见。同时要注意权限问题,最好将补丁文件包权限“人为降低”,避免出现麻烦。

[root@NCR-Standby-Asm upload]# chown -R grid:oinstall 19852360/

[root@NCR-Standby-Asm upload]# ls -l 

total 282780

drwxr-xr-x 4 grid  oinstall      4096 Oct 20  2014 19852360

进行补丁前,要通过opatch的prereq方法检查补丁兼容性,尽早发现问题,避免回退。

[grid@NCR-Standby-Asm upload]$ cd 19852360/

[grid@NCR-Standby-Asm 19852360]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

Oracle Interim Patch Installer version 11.2.0.3.10

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

PREREQ session

Oracle Home      : /u01/app/grid/product/11.2.0/grid

Central Inventory : /u01/app/oraInventory

  from          : /u01/app/grid/product/11.2.0/grid/oraInst.loc

OPatch version    : 11.2.0.3.10

OUI version      : 11.2.0.4.0

Log file location : /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/opatch2015-05-25_09-57-08AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

根据补丁要求,关闭监听器、数据库服务器和一切与JDBC相关的组件。

[grid@NCR-Standby-Asm ~]$ crsctl stat res -t -init

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

NAME  TARGET  STATE        SERVER      STATE_DETAILS       

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

Local Resources

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

ora.DATA.dg

              ONLINE  OFFLINE      ncr-standby-asm                             

ora.LISTENER.lsnr

              OFFLINE OFFLINE      ncr-standby-asm                             

ora.RECO.dg

              ONLINE  OFFLINE      ncr-standby-asm                             

ora.asm

              OFFLINE OFFLINE      ncr-standby-asm          Instance Shutdown   

ora.ons

              OFFLINE OFFLINE      ncr-standby-asm                             

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE      ncr-standby-asm                             

ora.diskmon

      1        OFFLINE OFFLINE                                                   

ora.evmd

      1        ONLINE  ONLINE      ncr-standby-asm                             

ora.sicsstb.db

      1        OFFLINE OFFLINE                              Instance Shutdown   

执行锁定脚本,由于GI部分进程工作原理,所以进行apply补丁之前要执行特殊的root脚本,对进程继续锁定(RAC和Non-RAC GI架构下脚本有差异,请注意)。

[grid@NCR-Standby-Asm 19852360]$ env | grep ORACLE_HOME

ORACLE_HOME=/u01/app/grid/product/11.2.0/grid

[root@NCR-Standby-Asm ~]# cd /u01/app/grid/product/11.2.0/grid

[root@NCR-Standby-Asm grid]# cd crs/install/

[root@NCR-Standby-Asm install]# ./roothas.pl -unlock

Using configuration parameter file: ./crsconfig_params

Successfully unlock /u01/app/grid/product/11.2.0/grid

进行补丁动作。

[grid@NCR-Standby-Asm 19852360]$ opatch apply

Oracle Interim Patch Installer version 11.2.0.3.10

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

Oracle Home      : /u01/app/grid/product/11.2.0/grid

Central Inventory : /u01/app/oraInventory

  from          : /u01/app/grid/product/11.2.0/grid/oraInst.loc

OPatch version    : 11.2.0.3.10

OUI version      : 11.2.0.4.0

Log file location : /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/19852360_May_25_2015_10_02_26/apply2015-05-25_10-02-26AM_1.log

Applying interim patch '19852360' to OH '/u01/app/grid/product/11.2.0/grid'

Verifying environment and performing prerequisite checks...

All checks passed.

Provide your email address to be informed of security issues, install and

initiate Oracle Configuration Manager. Easier for you if you use your My

Oracle Support Email address/User Name.

Visit http://www.oracle.com/support/policies.html for details.

Email address/User Name: 

You have not provided an email address for notification of security issues.

Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y

Backing up files...

Patching component oracle.dbjava.jdbc, 11.2.0.4.0...

Patching component oracle.dbjava.ic, 11.2.0.4.0...

Verifying the update...

Patch 19852360 successfully applied

Log file location: /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/19852360_May_25_2015_10_02_26/apply2015-05-25_10-02-26AM_1.log

OPatch succeeded.

执行脚本锁定GI进程。

 [root@NCR-Standby-Asm install]# ./roothas.pl -patch

Using configuration parameter file: ./crsconfig_params

CRS-4123: Oracle High Availability Services has been started

使用opatch程序验证补丁操作成功。

[grid@NCR-Standby-Asm 19852360]$ opatch lsinventory

Oracle Interim Patch Installer version 11.2.0.3.10

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

Oracle Home      : /u01/app/grid/product/11.2.0/grid

Central Inventory : /u01/app/oraInventory

  from          : /u01/app/grid/product/11.2.0/grid/oraInst.loc

OPatch version    : 11.2.0.3.10

OUI version      : 11.2.0.4.0

Log file location : /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/opatch2015-05-25_10-03-07AM_1.log

Lsinventory Output file location : /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2015-05-25_10-03-07AM.txt

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

Local Machine Information::

Hostname: localhost

ARU platform id: 226

ARU platform description:: Linux x86-64

Installed Top-level Products (1): 

Oracle Grid Infrastructure 11g                                      11.2.0.4.0

There are 1 products installed in this Oracle Home.

Interim patches (1) :

Patch  19852360    : applied on Mon May 25 10:02:48 CST 2015

Unique Patch ID:  18170553

  Created on 20 Oct 2014, 08:17:43 hrs PST8PDT

  Bugs fixed:

    19852360

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

OPatch succeeded.

补丁安装成功。

下面介绍opatch的auto补丁方法。

更多详情见请继续阅读下一页的精彩内容:

  • 1
  • 2
  • 下一页
【内容导航】
第1页:上 第2页:下

相关内容