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

2015-07-16 12:08:04 · 作者: · 浏览: 10

同简单单实例文件系统数据库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