ITPub博客

首页 > 数据库 > Oracle > GI PSU滚动方式应用GI HOME和DB HOME(opatch auto together)

GI PSU滚动方式应用GI HOME和DB HOME(opatch auto together)

原创 Oracle 作者:不一样的天空w 时间:2018-05-16 02:21:41 0 删除 编辑
GI PSU补丁可以以滚动方式应用GI HOME和DB HOME。注意下载补丁的存放位置应该是GI和db共享的目录;

一、检查rac没法节点的opatch工具版本大于或等于11.2.0.3.6:rac每个节点都检查

更新db和GI下的opatch工具:
$ unzip <OPATCH-ZIP> -d <ORACLE_HOME>
$ <ORACLE_HOME>/OPatch/opatch version

二、配置响应文件:rac每个节点都操作
su - oracle
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /home/oracle/ocm.rsp
chmod 775 /home/oracle/ocm.rsp


三、验证有效期
-- Validation of Oracle Inventory(以GI和DB用户分别运行)
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh  $ORACLE_HOME

四、打补丁或回滚补丁前应停止EM进程(如果没有安装EM,则忽略)
su - oracle
<ORACLE_HOME>/bin/emctl stop dbconsole

五、升级PSU(As root user, execute the following command on each node of the cluster:不能并行执行)
--As root user, execute the following command on each node of the cluster:
以root用户身份,在集群的每个节点上执行以下命令:

注意:PSU补丁的存放位置应该是GI和db共享的目录,并以GI下的opatch工具去执行

$ cd <UNZIPPED_PATCH_LOCATION>
$ unzip p27475913_112040_<platform>.zip

# opatch auto /tmp/27475913 -ocmrf /home/oracle/ocm.rsp

--解压PSU补丁包
[oracle@dbrac2 ~]$ cd /tmp
[oracle@dbrac1 tmp]$ unzip p27475913_112040_Linux-x86-64.zip

--升级操作: /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
[root@dbrac1 tmp]# su - grid
[grid@dbrac1 ~]$ env|grep HOME
HOME=/home/grid
ORACLE_HOME=/oracle/app/11.2.0/grid
[grid@dbrac1 ~]$

[root@dbrac1 tmp]#  /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /tmp -patchn 27475913 -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-16_00-43-07.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-16_00-43-07.report.log

2018-05-16 00:43:07: 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/27475913/27338049  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1
 patch /tmp/27475913/27441052/custom/server/27441052  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1

Stopping CRS...
   Stopped CRS successfully

 patch /tmp/27475913/27338049  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27475913/27441052  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27475913/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.
 
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 tmp]#  

节点2操作如上.............
[root@dbrac2 tmp]#  /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
省略..........................


六、升级后数据库注册,跑脚本:对于rac只需在一个节点上操作即可
--执行脚本catbundle.sql
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

The catbundle.sql execution is reflected in the dba_registry_history view by a row associated with bundle series PSU.

--编译失效对象
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

--检查日志有无报错
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log

--如果在使用rman恢复目录,则执行如下:
$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;

--跑完后验证:
SQL> select * from dba_registry_history;

ACTION_TIME                    ACTION     NAMESPACE       VERSION                 ID BUNDLE_SERIES   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
16-MAY-18 02.00.48.476152 AM   APPLY      SERVER          11.2.0.4            180417 PSU             PSU 11.2.0.4.180417

6 rows selected.


七、回滚PSU
--root身份执行:
As root user, execute the following command on each node of the cluster.

# opatch auto <UNZIPPED_PATCH_LOCATION>/27475913 -rollback -ocmrf <ocm response file>

八、回滚后注册:在执行打补丁注册后的节点上执行回滚后注册
8.1 Start all database instances running from the Oracle home

8.2 执行脚本

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> QUIT

8.3 编译失效对象

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

8.4 Check the log file for any errors.

The log file is found in $ORACLE_BASE/cfgtoollogs/catbundle and is named catbundle_PSU_<database SID>_ROLLBACK_<TIMESTAMP>.log where TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS. If there are error.

8.5 检查

$ opatch lsinventory

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31397003/viewspace-2154540/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2016-09-22

  • 博文量
    916
  • 访问量
    1400370