快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

GIPSU打补丁之opatchauto自动方式分别打GI_HOME和ORACLE_HOME

11.2.0.4 rac数据库打补丁:

环境说明:
[oracle@dbrac1 ~]$ cat /etc/issue
Red Hat Enterprise Linux Server release 6.7 (Santiago)
Kernel \r on an \m

[oracle@dbrac1 ~]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

192.168.56.2    dbrac1
192.168.56.3    dbrac1-vip
10.10.10.10     dbrac1-priv

192.168.56.4    dbrac2
192.168.56.5    dbrac2-vip
10.10.10.11     dbrac2-priv

192.168.56.8   rac-scan
[oracle@dbrac1 ~]$


要打的补丁为:p27107360_112040_Linux-x86-64.zip,opatch工具包:p6880880_112000_Linux-x86-64.zip

节点一二都把上述两包放在/tmp下,且赋权限为chmod 777 *.zip

[root@dbrac1 tmp]# ll *.zip
-rwxrwxrwx 1 root root 779304336 Apr  2 17:12 p27107360_112040_Linux-x86-64.zip
-rwxrwxrwx 1 root root  52733900 Mar 14  2016 p6880880_112000_Linux-x86-64.zip
[root@dbrac1 tmp]#


一:升级OPatch
下载最新的opatch程序并替换GI_HOME和ORACLE_HOME下的OPatch目录
注意:rac1和rac2两个节点的grid和oracle都要升级OPatch版本

[grid@dbrac1 ~]$ opatch version
OPatch Version: 11.2.0.3.4

OPatch succeeded.
[grid@dbrac1 ~]$

[oracle@dbrac1 ~]$ opatch version
OPatch Version: 11.2.0.3.4

OPatch succeeded.
[oracle@dbrac1 ~]$

oracle用户替换,备份之前的OPatch目录:
[oracle@dbrac1 ~]$ cd $ORACLE_HOME
[oracle@dbrac1 dbhome_1]$
[oracle@dbrac1 dbhome_1]$ mv OPatch/ OPatch.bak

--解压:
[oracle@dbrac1 tmp]$ unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
Archive:  p6880880_112000_Linux-x86-64.zip
   creating: /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/
  inflating: /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatchdiag  
  inflating: /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch.pl  
   creating: /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/jlib/
忽略..............................................................................

[oracle@dbrac1 dbhome_1]$ opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.
[oracle@dbrac1 dbhome_1]$

grid用户替换,备份之前的OPatch目录:
[grid@dbrac1 ~]$ env|grep ORACLE_HOME
ORACLE_HOME=/oracle/app/11.2.0/grid
[grid@dbrac1 ~]$ exit
logout
[root@dbrac1 tmp]#
[root@dbrac1 tmp]# cd /oracle/app/11.2.0/grid
[root@dbrac1 grid]#
[root@dbrac1 grid]# mv OPatch/ OPatch.bak
[root@dbrac1 grid]#

[root@dbrac1 tmp]# cd /tmp
[root@dbrac1 tmp]# ll *.zip
-rwxrwxrwx 1 root root 779304336 Apr  2 17:12 p27107360_112040_Linux-x86-64.zip
-rwxrwxrwx 1 root root  52733900 Mar 14  2016 p6880880_112000_Linux-x86-64.zip
[root@dbrac1 tmp]# unzip p6880880_112000_Linux-x86-64.zip -d /oracle/app/11.2.0/grid
Archive:  p6880880_112000_Linux-x86-64.zip
   creating: /oracle/app/11.2.0/grid/OPatch/
  inflating: /oracle/app/11.2.0/grid/OPatch/opatchdiag  
  inflating: /oracle/app/11.2.0/grid/OPatch/opatch.pl  
   creating: /oracle/app/11.2.0/grid/OPatch/jlib/
省略............................................................
[root@dbrac1 grid]#
[root@dbrac1 grid]# chown -R grid:oinstall OPatch/
[root@dbrac1 grid]#
[root@dbrac1 grid]# su - grid
[grid@dbrac1 ~]$ opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.
[grid@dbrac1 ~]$

--节点2相同操作:
[root@dbrac2 tmp]# ll *.zip
-rwxrwxrwx 1 root root 779304336 May 15 09:45 p27107360_112040_Linux-x86-64.zip
-rwxrwxrwx 1 root root  52733900 May 15 09:45 p6880880_112000_Linux-x86-64.zip
[root@dbrac2 tmp]# su - oracle
[oracle@dbrac2 ~]$
[oracle@dbrac2 ~]$ cd $ORACLE_HOME
[oracle@dbrac2 dbhome_1]$ mv OPatch/ OPatch.bak
[oracle@dbrac2 dbhome_1]$
[oracle@dbrac2 dbhome_1]$ unzip /tmp/p6880880_112000_Linux-x86-64.zip
省略..........................................
[oracle@dbrac2 dbhome_1]$
[oracle@dbrac2 dbhome_1]$ opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.
[oracle@dbrac2 dbhome_1]$

[root@dbrac2 ~]# su - grid
[grid@dbrac2 ~]$ env|grep ORACLE_HOME
ORACLE_HOME=/oracle/app/11.2.0/grid
[grid@dbrac2 ~]$
[grid@dbrac2 ~]$ exit
logout
[root@dbrac2 ~]# cd /tmp
[root@dbrac2 tmp]# cd /oracle/app/11.2.0/grid
[root@dbrac2 grid]# mv OPatch/ OPatch.bak
[root@dbrac2 grid]#
[root@dbrac2 grid]# unzip /tmp/p6880880_112000_Linux-x86-64.zip -d /oracle/app/11.2.0/grid
省略.................................
[root@dbrac2 grid]#
[root@dbrac2 grid]# chown grid:oinstall -R OPatch/
[root@dbrac2 grid]# su - grid
[grid@dbrac2 ~]$
[grid@dbrac2 ~]$ opatch version
OPatch Version: 11.2.0.3.12

OPatch succeeded.
[grid@dbrac2 ~]$

二:生成ocm文件
在rac1和rac2分别生成ocm.rsp文件。
su - oracle
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /home/oracle/ocm.rsp

[oracle@dbrac1 ~]$ env|grep ORACLE_HOME
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
[oracle@dbrac1 ~]$
[oracle@dbrac1 ~]$ $ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /home/oracle/ocm.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 (/home/oracle/ocm.rsp) was successfully created.
[oracle@dbrac1 ~]$

[oracle@dbrac2 ~]$ $ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /home/oracle/ocm.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 (/home/oracle/ocm.rsp) was successfully created.
[oracle@dbrac2 ~]$ ll
total 4
-rw-r--r-- 1 oracle oinstall 623 May 15 20:15 ocm.rsp
[oracle@dbrac2 ~]$


三:给GRID_HOME安装补丁
注意:虽然,opatch auto命令必须使用root用户执行,但是其实还是需要通过root用户su到grid和oracle用户来执行相关的检查工作。

--执行前先备份inventory_loc目录和gird和oracle用户的软件目录即家目录:
[root@dbrac1 tmp]# cat /etc/oraInst.loc
inventory_loc=/oracle/app/oraInventory
inst_group=oinstall
[root@dbrac1 tmp]#

[root@dbrac1 tmp]# cat /etc/oratab
+ASM1:/oracle/app/11.2.0/grid:N         # line added by Agent
dbrac:/oracle/app/oracle/product/11.2.0/dbhome_1:N              # line added by Agent
[root@dbrac1 tmp]#

--再在打补丁前先检查状态:
[grid@dbrac1 ~]$  crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.FRA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER_WANG.lsnr
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.OCRVOTE.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.asm
               ONLINE  ONLINE       dbrac1                   Started             
               ONLINE  ONLINE       dbrac2                   Started             
ora.gsd
               OFFLINE OFFLINE      dbrac1                                       
               OFFLINE OFFLINE      dbrac2                                       
ora.net1.network
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.ons
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       dbrac2                                       
ora.cvu
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.abcde.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.db
      1        ONLINE  ONLINE       dbrac2                   Open                
      2        ONLINE  ONLINE       dbrac1                   Open                
ora.dbrac.dmmservice.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac1.vip
      1        ONLINE  ONLINE       dbrac1                                       
ora.dbrac2.vip
      1        ONLINE  ONLINE       dbrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       dbrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       dbrac2                                       
[grid@dbrac1 ~]$

--正式打补丁,先打节点一GI_HOME
[grid@dbrac1 ~]$ env|grep ORACLE_HOME
ORACLE_HOME=/oracle/app/11.2.0/grid
[grid@dbrac1 tmp]$ which opatch
/oracle/app/11.2.0/grid/OPatch/opatch
[grid@dbrac1 tmp]$
[grid@dbrac1 tmp]$ exit
logout
[root@dbrac1 grid]#
[root@dbrac1 grid]# cd /tmp
[root@dbrac1 tmp]# unzip p27107360_112040_Linux-x86-64.zip
省略....................................................................
[root@dbrac1 tmp]#chown oracle:oinstall  -R 27107360/
[root@dbrac1 tmp]# ll
total 812916
drwxr-xr-x  5 oracle oinstall      4096 Dec  6 16:59 27107360
-rwxrwxrwx  1 root   root     779304336 Apr  2 17:12 p27107360_112040_Linux-x86-64.zip
-rwxrwxrwx  1 root   root      52733900 Mar 14  2016 p6880880_112000_Linux-x86-64.zip
[root@dbrac1 tmp]#

--grid下打补丁:
/oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/11.2.0/grid -ocmrf /home/oracle/ocm.rsp  

[root@dbrac1 tmp]# /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/11.2.0/grid -ocmrf /home/oracle/ocm.rsp  
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/11.2.0/grid/OPatch/crs/patch21203.pl -patchdir /tmp -patchn 27107360 -oh /oracle/app/11.2.0/grid -ocmrf /home/oracle/ocm.rsp -paramfile /oracle/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-15_17-26-36.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-15_17-26-36.report.log

2018-05-15 17:26:36: Starting Clusterware Patch Setup
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
 
Stopping CRS...
Stopped CRS successfully

patch /tmp/27107360/26925576  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27107360/26609929  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27107360/22502505  apply successful for home  /oracle/app/11.2.0/grid

Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.
 
opatch auto succeeded.
[root@dbrac1 tmp]#       


--在打补丁期间在节点2上查询集群状态:发现打补丁时把节点1的db和crs停了;
[grid@dbrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       dbrac2                                       
ora.FRA.dg
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER_WANG.lsnr
               ONLINE  ONLINE       dbrac2                                       
ora.OCRVOTE.dg
               ONLINE  ONLINE       dbrac2                                       
ora.asm
               ONLINE  ONLINE       dbrac2                   Started             
ora.gsd
               OFFLINE OFFLINE      dbrac2                                       
ora.net1.network
               ONLINE  ONLINE       dbrac2                                       
ora.ons
               ONLINE  ONLINE       dbrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       dbrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       dbrac2                                       
ora.cvu
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.abcde.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.db
      1        ONLINE  ONLINE       dbrac2                   Open                
      2        ONLINE  OFFLINE                               Instance Shutdown   
ora.dbrac.dmmservice.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac1.vip
      1        ONLINE  INTERMEDIATE dbrac2                   FAILED OVER         
ora.dbrac2.vip
      1        ONLINE  ONLINE       dbrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       dbrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       dbrac2                                       
[grid@dbrac2 ~]$

--检查
[root@dbrac1 tmp]# su - grid
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$
[grid@dbrac1 ~]$ opatch lspatches
22502505;ACFS Patch Set Update : 11.2.0.4.160419 (22502505)
26609929;OCW Patch Set Update : 11.2.0.4.170814 (26609929)
26925576;Database Patch Set Update : 11.2.0.4.180116 (26925576)

OPatch succeeded.
[grid@dbrac1 ~]$  

三:给ORACLE_HOME安装补丁
--给节点1的oracle用户的ORACLE_HOME打补丁:

[oracle@dbrac1 ~]$ env|grep HOME
HOME=/home/oracle
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1
[oracle@dbrac1 ~]$
[oracle@dbrac1 ~]$ exit
logout
[root@dbrac1 soft]#

--执行操作:
/oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp

[root@dbrac1 soft]# /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/crs/patch21203.pl -patchdir /tmp -patchn 27107360 -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp -paramfile /oracle/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatchauto2018-05-15_17-56-39.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatchauto2018-05-15_17-56-39.report.log

2018-05-15 17:56:39: Starting Clusterware Patch Setup
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
 
Stopping RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
Stopped RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

 patch /tmp/27107360/26925576  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1
  patch /tmp/27107360/26609929/custom/server/26609929  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1

Starting RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
 Started RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

opatch auto succeeded.
[root@dbrac1 soft]#       


[grid@dbrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.FRA.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER.lsnr
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.LISTENER_WANG.lsnr
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.OCRVOTE.dg
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.asm
               ONLINE  ONLINE       dbrac1                   Started             
               ONLINE  ONLINE       dbrac2                   Started             
ora.gsd
               OFFLINE OFFLINE      dbrac1                                       
               OFFLINE OFFLINE      dbrac2                                       
ora.net1.network
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.ons
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
ora.registry.acfs
               ONLINE  ONLINE       dbrac1                                       
               ONLINE  ONLINE       dbrac2                                       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       dbrac2                                       
ora.cvu
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.abcde.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac.db
      1        ONLINE  ONLINE       dbrac2                   Open                
      2        OFFLINE OFFLINE                               Instance Shutdown   
ora.dbrac.dmmservice.svc
      1        ONLINE  ONLINE       dbrac2                                       
ora.dbrac1.vip
      1        ONLINE  ONLINE       dbrac1                                       
ora.dbrac2.vip
      1        ONLINE  ONLINE       dbrac2                                       
ora.oc4j
      1        ONLINE  ONLINE       dbrac2                                       
ora.scan1.vip
      1        ONLINE  ONLINE       dbrac2                                       
[grid@dbrac2 ~]$

--检查:
[root@dbrac1 soft]# su - oracle
[oracle@dbrac1 ~]$ opatch lspatches
26609929;OCW Patch Set Update : 11.2.0.4.170814 (26609929)
26925576;Database Patch Set Update : 11.2.0.4.180116 (26925576)

OPatch succeeded.
[oracle@dbrac1 ~]$

四:给节点2的GI_HOME和ORACLE_HOME分别打补丁,步骤同二三步骤
[root@dbrac2 tmp]# ll
drwxr-xr-x  5 oracle oinstall      4096 Dec  6 16:59 27107360
-rwxrwxrwx  1 root   root     779304336 May 15 09:45 p27107360_112040_Linux-x86-64.zip
-rwxrwxrwx  1 root   root      52733900 May 15 09:45 p6880880_112000_Linux-x86-64.zip
[root@dbrac2 tmp]#
[root@dbrac2 tmp]#

--给GI_HOME打补丁:
用ORACLE用户生成的ocm.rsp相应文件报错:Argument(s) Error... Given 'ocmrf' file does not exists. Please check the arguments and try again. OPatch failed with error code 135

--再使用grid用户生成ocm.rsp响应文件,如下:
[grid@dbrac2 ~]$ /oracle/app/11.2.0/grid/OPatch/ocm/bin/emocmrsp
OCM Installation Response Generator 10.3.7.0.0 - Production
Copyright (c) 2005, 2012, Oracle and/or its affiliates.  All rights reserved.

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 (ocm.rsp) was successfully created.
[grid@dbrac2 ~]$ ll
total 8
-rw-r--r-- 1 grid oinstall  621 May 15 23:02 ocm.rsp
[grid@dbrac2 ~]$
[grid@dbrac2 ~]$

--打补丁:
/oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/11.2.0/grid -ocmrf /home/grid/ocm.rsp

[root@dbrac2 ~]# /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27107360/ -oh /oracle/app/11.2.0/grid -ocmrf /home/grid/ocm.rsp
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/11.2.0/grid/OPatch/crs/patch21203.pl -patchdir /tmp -patchn 27107360 -oh /oracle/app/11.2.0/grid -ocmrf /home/grid/ocm.rsp -paramfile /oracle/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-15_23-04-01.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-15_23-04-01.report.log

2018-05-15 23:04:01: Starting Clusterware Patch Setup
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
 
Stopping CRS...
Stopped CRS successfully

patch /tmp/27107360/26925576  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27107360/26609929  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27107360/22502505  apply successful for home  /oracle/app/11.2.0/grid

Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.
 
opatch auto succeeded.
[root@dbrac2 ~]#                 

--检查:
[root@dbrac2 ~]# su - grid
[grid@dbrac2 ~]$ opatch lspatches
22502505;ACFS Patch Set Update : 11.2.0.4.160419 (22502505)
26609929;OCW Patch Set Update : 11.2.0.4.170814 (26609929)
26925576;Database Patch Set Update : 11.2.0.4.180116 (26925576)

OPatch succeeded.
[grid@dbrac2 ~]$


--给ORACLE_HOME打补丁
/oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch auto /tmp/27107360 -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp

[root@dbrac2 27107360]# /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch auto /tmp/27107360 -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/crs/patch21203.pl -patchdir /tmp -patchn 27107360 -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -ocmrf /home/oracle/ocm.rsp -paramfile /oracle/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatchauto2018-05-15_22-15-50.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatchauto2018-05-15_22-15-50.report.log

2018-05-15 22:15:50: Starting Clusterware Patch Setup
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
 
Stopping RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
Stopped RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

patch /tmp/27107360/26925576  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1
patch /tmp/27107360/26609929/custom/server/26609929  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1
 
Starting RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
Started RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

opatch auto succeeded.
[root@dbrac2 27107360]#

--检查:                      
[root@dbrac2 27107360]# su - oracle
[oracle@dbrac2 ~]$ opatch lspatches
26609929;OCW Patch Set Update : 11.2.0.4.170814 (26609929)
26925576;Database Patch Set Update : 11.2.0.4.180116 (26925576)

OPatch succeeded.
[oracle@dbrac2 ~]$    


五:更新dba_registry_history视图信息
--执行脚本@?/rdbms/admin/catbundle.sql psu apply ,只在一个节点上运行

--跑脚本前查看:
SQL> select * from dba_registry_history;

ACTION_TIME                         ACTION          NAMESPACE       VERSION            ID BUNDLE_SER COMMENTS
----------------------------------- --------------- --------------- ---------- ---------- ---------- --------------------
24-AUG-13 12.03.45.119862 PM        APPLY           SERVER          11.2.0.4            0 PSU        Patchset 11.2.0.2.0
16-OCT-17 10.12.28.771351 PM        APPLY           SERVER          11.2.0.4            0 PSU        Patchset 11.2.0.2.0
07-MAR-18 06.07.41.694205 AM        APPLY           SERVER          11.2.0.4       161018 PSU        PSU 11.2.0.4.161018
30-MAR-18 03.39.07.129649 PM        APPLY           SERVER          11.2.0.4       170718 PSU        PSU 11.2.0.4.170718

SQL>

--跑脚本@?/rdbms/admin/catbundle.sql psu apply

SQL> @?/rdbms/admin/prvtblin.plb
SQL> CREATE OR REPLACE PACKAGE BODY dbms_logrep_exp wrapped
  2  a000000
  3  1
  4  abcd
  5  abcd
  6  abcd
  7  abcd
  8  abcd
省略...........................................
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/oracle/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_DBRAC_APPLY_2018May15_23_32_19.log
SQL>  

--再次查询:
SQL> select * from dba_registry_history;

ACTION_TIME                         ACTION          NAMESPACE       VERSION            ID BUNDLE_SER COMMENTS
----------------------------------- --------------- --------------- ---------- ---------- ---------- --------------------
24-AUG-13 12.03.45.119862 PM        APPLY           SERVER          11.2.0.4            0 PSU        Patchset 11.2.0.2.0
16-OCT-17 10.12.28.771351 PM        APPLY           SERVER          11.2.0.4            0 PSU        Patchset 11.2.0.2.0
07-MAR-18 06.07.41.694205 AM        APPLY           SERVER          11.2.0.4       161018 PSU        PSU 11.2.0.4.161018
30-MAR-18 03.39.07.129649 PM        APPLY           SERVER          11.2.0.4       170718 PSU        PSU 11.2.0.4.170718
15-MAY-18 11.32.57.424765 PM        APPLY           SERVER          11.2.0.4       180116 PSU        PSU 11.2.0.4.180116

SQL>















网页标题:GIPSU打补丁之opatchauto自动方式分别打GI_HOME和ORACLE_HOME
转载来于:http://6mz.cn/article/pcpjhc.html

其他资讯