聊聊兩種給Grid Infrastructure打補丁的方法(上)

realkid4發表於2015-06-01

 

升級打補丁是系統管理員重要的工作內容。Oracle Grid Infrastructure是目前比較複雜的叢集管理中介軟體,當出現各種奇怪問題的時候,尋求官方服務支援(MOS)和打補丁是最常見的做法。

同簡單單例項檔案系統資料庫database補丁有所不同的是,GIGrid Infrastructure)打補丁過程要涉及到其上ASMListenerDatabase Instance的各種關係。同時,一些關鍵骨架後臺程式,如ohasd等還需要root許可權的參與。

本篇筆者主要針對兩種OPatch補丁策略,演示常見的兩種給GI打補丁的方法,即ApplyAuto策略。

 

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下的程式包。

 

2OPatch 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

 

 

進行補丁前,要透過opatchprereq方法檢查補丁相容性,儘早發現問題,避免回退。

 

 

[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指令碼,對程式繼續鎖定(RACNon-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 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.

 

 

補丁安裝成功。

 

下面介紹opatchauto補丁方法。


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17203031/viewspace-1680451/,如需轉載,請註明出處,否則將追究法律責任。

相關文章