你好,游客 登录 注册 搜索
背景:
阅读新闻

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

下

[日期:2015-06-04] 来源:Linux社区  作者:realkid4 [字体:大 中 小]

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

3、OPatch auto补丁策略

GI是复杂的,一些GI补丁不仅仅是给GI中间件本身补丁,而且设计到其上运行的database和ASM实例等多个组件。在进行这样环境补丁的时候,一定要先进行GI补丁,之后补充验证database实例的补丁。

OPatch auto策略是针对多个补丁合集(通常为PSU)进行的。最稳妥的方式首先将Listener、Database Instance和ASM等组件关闭(依据补丁要求)。

[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 Address。Oracle建议使用OCM(Oracle 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 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

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、结论

数据库补丁是我们经常遇到的运维场景,严格遵守操作流程、步步为营,小心求证是我们解决问题的根本出发点。

更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址:http://www.linuxidc.com/Linux/2015-06/118362.htm

linux
【内容导航】
第1页:上 第2页:下
相关资讯       Grid Infrastructure 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款