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

realkid4發表於2015-06-02

 

下面介紹opatchauto補丁方法。

 

3OPatch auto補丁策略

 

GI是複雜的,一些GI補丁不僅僅是給GI中介軟體本身補丁,而且設計到其上執行的databaseASM例項等多個元件。在進行這樣環境補丁的時候,一定要先進行GI補丁,之後補充驗證database例項的補丁。

OPatch auto策略是針對多個補丁合集(通常為PSU)進行的。最穩妥的方式首先將ListenerDatabase InstanceASM等元件關閉(依據補丁要求)。

 

 

[grid@XXX-Standby-Asm 19852360]$ srvctl stop database -d SYSTEMstb

PRCC-1016 : SYSTEMstb was already stopped

 [grid@XXX-Standby-Asm 19852360]$ srvctl stop asm -f

[grid@XXX-Standby-Asm 19852360]$ srvctl stop listener

[grid@XXX-Standby-Asm 19852360]$ crsctl stat res -t -init

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

NAME          TARGET  STATE        SERVER    STATE_DETAILS      

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

Local Resources

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

ora.DATA.dg

               ONLINE  OFFLINE      XXX-standby-asm                             

ora.LISTENER.lsnr

               OFFLINE OFFLINE      XXX-standby-asm                             

ora.RECO.dg

               ONLINE  OFFLINE      XXX-standby-asm                             

ora.asm

               OFFLINE OFFLINE      XXX-standby-asm          Instance Shutdown  

ora.ons

               OFFLINE OFFLINE      XXX-standby-asm                             

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

Cluster Resources

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

ora.cssd

      1        ONLINE  ONLINE       XXX-standby-asm                              

ora.diskmon

      1        OFFLINE OFFLINE                                                  

ora.evmd

      1        ONLINE  ONLINE       XXX-standby-asm                             

ora.SYSTEMstb.db

      1        OFFLINE OFFLINE                               Instance Shutdown 

 

 

解壓安裝包,到制定目錄。

 

 

[root@XXX-Standby-Asm gidir]# unzip p20485808_112040_Linux-x86-64.zip

  (篇幅原因,有省略……

  inflating: 20485808/20299019/files/bin/acfsrepl_monitor 

  inflating: 20485808/20299019/files/bin/acfsdriverstate 

  inflating: 20485808/20299019/files/bin/acfsreplcrs 

  inflating: 20485808/20299019/files/bin/acfsrepl_initializer 

  inflating: 20485808/20299019/files/bin/acfsreplcrs.pl 

  inflating: 20485808/20299019/files/bin/acfsregistrymount 

  inflating: 20485808/20299019/README.txt 

   creating: 20485808/20299019/custom/

   creating: 20485808/20299019/custom/scripts/

  inflating: 20485808/20299019/custom/scripts/prepatchverify.sh 

  inflating: 20485808/20299019/custom/scripts/pre.txt 

  inflating: 20485808/20299019/custom/scripts/post.txt 

  inflating: 20485808/bundle.xml    

  inflating: PatchSearch.xml 

 

[root@XXX-Standby-Asm gidir]# ls -l

total 1338920

drwxr-xr-x 5 root root      4096 Mar 27 23:33 20485808

 

--降低許可權

[root@XXX-Standby-Asm gidir]# chown -R grid:oinstall 20485808

[root@XXX-Standby-Asm gidir]# chmod -R 755 20485808/

[root@XXX-Standby-Asm gidir]# ls -l

total 1338920

drwxr-xr-x 5 grid oinstall      4096 Mar 27 23:33 20485808

 

[root@XXX-Standby-Asm gidir]# cd 20485808/

[root@XXX-Standby-Asm 20485808]# ls -l

total 136

drwxrwxr-x 8 root root  4096 Mar  4 18:30 20299013

drwxr-xr-x 5 root root  4096 Mar 27 23:26 20299019

drwxr-xr-x 5 root root  4096 Mar 27 23:19 20420937

-rw-r--r-- 1 root root   549 Mar 27 23:32 bundle.xml

-rw-rw-r-- 1 root root 61184 Mar  6 13:43 PatchSearch.xml

-rw-rw-r-- 1 root root 60655 Apr 13 15:17 README.html

-rw-r--r-- 1 root root     0 Mar 27 23:33 README.txt

 

 

使用OPatch auto功能,實際上就是進行自動化補丁安裝動作。OPatch自動進行使用者切換、補丁驗證和補丁批次動作。

 

這個過程中,是需要輸入一些使用者互動資訊,如Email AddressOracle建議使用OCMOracle Configuration Manager)生成配置檔案,作為OPatch工作的輸入。

 

 

[grid@XXX-Standby-Asm gidir]$ cd $ORACLE_HOME

[grid@XXX-Standby-Asm grid]$ cd OPatch

[grid@XXX-Standby-Asm OPatch]$ cd ocm/bin

[grid@XXX-Standby-Asm bin]$ ls -l

total 12

-rwxr-x--- 1 grid oinstall 9063 Nov 27  2009 emocmrsp

 

[grid@XXX-Standby-Asm bin]$ ./emocmrsp -no_banner -output /u01/unconfig.rsp

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

The OCM configuration response file (/u01/unconfig.rsp) was successfully created.

 

Validation of Oracle Inventory

 

 

檢查兩個$ORACLE_HOME目錄是否對應。

 

 

Oracle Home       : /u02/app/oracle/product/11.2.0/dbhome_1

Central Inventory : /u01/app/oraInventory

   from           : /u02/app/oracle/product/11.2.0/dbhome_1/oraInst.loc

OPatch version    : 11.2.0.3.10

OUI version       : 11.2.0.4.0

Log file location : /u02/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-05-25_14-51-28PM_1.log

 

Lsinventory Output file location : /u02/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2015-05-25_14-51-28PM.txt

 

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

Local Machine Information::

Hostname: localhost

ARU platform id: 226

ARU platform description:: Linux x86-64

 

Installed Top-level Products (1):

 

Oracle Database 11g                                                  11.2.0.4.0

(篇幅原因,有省略……

     /u02/app/oracle/product/11.2.0/dbhome_1/inventory/oneoffs/19852360

   Patch Location in Storage area:

     /u02/app/oracle/product/11.2.0/dbhome_1/.patch_storage/19852360_Oct_20_2014_08_17_43

 

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

 

OPatch succeeded.

 

 

進行補丁動作。

 

 

[root@XXX-Standby-Asm OPatch]# ./opatch auto /upload/gidir/20485808 -ocmrf /u01/unconfig.rsp

Executing /u01/app/grid/product/11.2.0/grid/perl/bin/perl ./crs/patch11203.pl -patchdir /upload/gidir -patchn 20485808 -ocmrf /u01/unconfig.rsp -paramfile /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params

 

This is the main log file: /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatchauto2015-05-25_15-22-24.log

 

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:

/u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatchauto2015-05-25_15-22-24.report.log

 

2015-05-25 15:22:24: Starting Oracle Restart Patch Setup

Using configuration parameter file: /u01/app/grid/product/11.2.0/grid/crs/install/crsconfig_params

 

 

Stopping RAC /u02/app/oracle/product/11.2.0/dbhome_1 ...

Stopped RAC /u02/app/oracle/product/11.2.0/dbhome_1 successfully

 

patch /upload/gidir/20485808/20299013  apply successful for home  /u02/app/oracle/product/11.2.0/dbhome_1

patch /upload/gidir/20485808/20420937/custom/server/20420937  apply successful for home  /u02/app/oracle/product/11.2.0/dbhome_1

 

Stopping CRS...

Stopped CRS successfully

 

patch /upload/gidir/20485808/20299013  apply successful for home  /u01/app/grid/product/11.2.0/grid

 

patch /upload/gidir/20485808/20420937  apply successful for home  /u01/app/grid/product/11.2.0/grid

patch /upload/gidir/20485808/20299019  apply successful for home  /u01/app/grid/product/11.2.0/grid

 

Starting CRS...

 

CRS-4123: Oracle High Availability Services has been started.

 

Starting RAC /u02/app/oracle/product/11.2.0/dbhome_1 ...

Started RAC /u02/app/oracle/product/11.2.0/dbhome_1 successfully

 

opatch auto succeeded.

 

 

補丁驗證。

 

 

[root@XXX-Standby-Asm OPatch]# ./opatch lsinventory

The user is root. OPatch cannot continue if the user is root.

 

OPatch failed with error code 255

 

 

[grid@XXX-Standby-Asm ~]$ 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_15-36-53PM_1.log

 

Lsinventory Output file location : /u01/app/grid/product/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2015-05-25_15-36-53PM.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 (4) :

 

Patch  20299019     : applied on Mon May 25 15:30:25 CST 2015

Unique Patch ID:  18573450

Patch description:  "ACFS Patch set update : 11.2.0.4.6 (20299019)"

   Created on 27 Mar 2015, 15:26:30 hrs

   Bugs fixed:

     17510275, 17172303, 16318126, 19690653, 17203009, 17376318, 17503605

     20140148, 17611362, 17721778, 17164243, 19053182, 17696547, 17699423

(篇幅原因,有刪減……

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.

 

 

事後使用SQL指令碼進行更新。

 

 

[oracle@XXX-Standby-Asm ~]$ cd $ORACLE_HOME/rdbms/admin

[oracle@XXX-Standby-Asm admin]$ sqlplus /nolog

 

SQL*Plus: Release 11.2.0.4.0 Production on Mon May 25 16:14:00 2015

 

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

 

SQL> conn / as sysdba

Connected.

SQL> select open_mode from v$database;

 

OPEN_MODE

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

READ WRITE

 

(事後檢查)

 

SQL> @catbundle.sql psu apply

 

 

1 row created.

 

SQL> COMMIT;

 

Commit complete.

 

SQL> SPOOL off

SQL> SET echo off

Check the following log file for errors:

/u02/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_SYSTEMSTB_APPLY_2015May25_16_15_53.log

 

 

SQL> @utlrp.sql  

1 row selected.

 

 

Function created.

 

 

PL/SQL procedure successfully completed.

 

 

Function dropped.

 

 

PL/SQL procedure successfully completed.

 

 

升級補丁完成!

 

4、結論

 

資料庫補丁是我們經常遇到的運維場景,嚴格遵守操作流程、步步為營,小心求證是我們解決問題的根本出發點。


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

相關文章