(本文原创,转载请注明出处。)
一、首先应根据README文件里的要求下载相应的OPatch包,然后进行解压安装。
步骤:
(1) 备份oracle和grid用户的 $ORACLE_HOME/OPatch
(2) 删除oracle和grid用户的 $ORACLE_HOME/OPatch
(3) 将下载的OPATCH软件解压到oracle和grid的 ORACLE_HOMe
unzip<OPATCH-ZIP> -d <ORACLE_HOME>
(4) 检查OPatch版本。
$ <ORACLE_HOME>/OPatch/opatch lsinventory -detail -oh <ORACLE_HOME>
此次打补丁要求的OPatch版本为11.2.0.3.6 or later,本机安装版本为11.2.0.3.17,如图:
二检查grid ,oracle家目录下安装产品的一致性:
$ $ORACLE_HOME/OPatch/opatchlsinventory -detail -oh $ORACLE_HOME
…….
OPatch succeeded.
显示OPatchsucceeded为成功。若失败应联系oracle支持解决。
三停止EM代理(打补丁和回滚前)oracle用户执行。
$ $ORACLE_HOME/bin/emctl stop dbconsole
(以上一、二、三需在每个节点上都执行)
四关闭集群和数据库服务。(说明$GI_HOME(<GI_HOME>)代表grid用户下的$ORACLE_HOME)
oracle用户:
srvctl stop database -d racdb
srvctl status database -d racdb
节点1和2 root run:
$GI_HOME/bin/crsctl stop crs
$GI_HOME /bin/crsctl stop crs
备份ORACLE和crs:
tar-zcvf oracle2017.tar.gz $ORACLE_HOME/*
tar-zcvf grid2017.tar.gz $GI_HOME /*
tar-zcvf oracle2017.tar.gz /u01/app/oraInventory/*
五解锁grid家目录,root用户执行:
#<GI_HOME>/crs/install/rootcrs.pl -unlock
解锁ORACLE家目录
#<GI_HOME>/crs/install/roothas.pl -unlock
六应用PSU
Table 3 PatchNumbers Getting Installed as Part of this GI PSU Patch
Patch Number | Description | Applicable Homes |
26609445 | DB PSU 11.2.0.4.170814 (INCLUDES CPUJUL2017) | Both DB Homes and Grid Home |
26609929 | OCW PSU 11.2.0.4.170814 | Both DB Homes and Grid Home |
22502505 | ACFS PSU 11.2.0.4.160419 | Only Grid Home |
6.1 grid 用户,使用CRS补丁。
$ <GI_HOME>/OPatch/opatch napply -oh<GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCWComponents_number>
$ <GI_HOME>/OPatch/opatch napply -oh<GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<ACFSComponents_number>
$ <GI_HOME>/OPatch/opatch apply -oh<GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<DB_PSU_number>
说明:<UNZIPPED_PATCH_LOCATION> ——psu解压后的路径
<GI_PSU_number>——psu解压后的目录
<OCW Components_number>——OCW对应的Patch号
<ACFS Components_number>——ACFS对应的Patch号
<DB_PSU_number>——DB PSU对应的Patch号
查询README文件可以获得,如上Table 3。
本机如下:
依次顺序执行以下语句:
$/u01/app/11.2.0/grid_11204/OPatch/opatch napply -oh /u01/app/11.2.0/grid_11204-local /tmp/26610246/26609929
$/u01/app/11.2.0/grid_11204/OPatch/opatch napply -oh/u01/app/11.2.0/grid_11204 -local/tmp/26610246/22502505
$/u01/app/11.2.0/grid_11204/OPatch/opatch apply -oh/u01/app/11.2.0/grid_11204 -local/tmp/26610246/26609445
6.2. ORACLE用户运行补丁的DB组件的pre脚本
<UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCWComponents_number>/custom/server/<OCWComponents_number>/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>
$ /tmp/26610246/26609929/custom/server/26609929/custom/scripts/prepatch.sh-dbhome $ORACLE_HOME
6.3. ORACLE用户-运行补丁的DB patch
$ <ORACLE_HOME>/OPatch/opatch napply -oh<ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCWComponents_number>/custom/server/<OCW Components_number>
$ <ORACLE_HOME>/OPatch/opatch apply -oh<ORACLE_HOME> -local<UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<DB_PSU_number>
$ORACLE_HOME/OPatch/opatch napply -oh$ORACLE_HOME -local /tmp/26610246/26609929/custom/server/26609929
$ORACLE_HOME/OPatch/opatch napply -oh$ORACLE_HOME -local /tmp/26610246/26609445
6.4 ORACLE运行补丁的DB组件的后脚本
$<UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCWComponents_number>/custom/server/<OCWComponents_number>/custom/scripts/postpatch.sh-dbhome <ORACLE_HOME>
$/tmp/26610246/26609929/custom/server/26609929/custom/scripts/postpatch.sh-dbhome $ORACLE_HOME
6.5 root用户:
# <GI_HOME>/rdbms/install/rootadd_rdbms.sh
# <GI_HOME>/crs/install/rootcrs.pl-patch
注意:如果显示“使用ACFS”之前建议使用系统重新启动的消息,则在继续之前必须重新启动,否则将导致使用未打补丁的ACFS \ ADVM \ OKS驱动程序运行。
(6.1-6.5需要在rac集群的每个节点上都执行一遍)
6.6启动集群和数据库:
节点1和2 root run:
/u01/app/11.2.0/grid/bin/crsctlstart crs
/u01/app/11.2.0/grid/bin/crsctlstart crs
oracle用户:
srvctlstart nodeapps
srvctlstart database -d racdb
七.在某一个实例是上行下面的操作,以下步骤将修改后的SQL文件加载到数据库中,
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
如果将OJVM PSU应用于先前的GI PSU补丁,则在上一步中执行catbundle.sql脚本后,可能会看到无效的Java类。如果是这种情况,运行utlrp.sql来重新验证这些Java类。
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
八.检查PSU安装情况
setpages 100 lines 120
colaction format a15
colnamespace format a10
colversion format a18
colcomments format a25
colaction_time format a30
colbundle_series format a15
alter session set nls_timestamp_format ='yyyy-mm-dd hh24:mi:ss.ff';
select * from dba_registry_history;
(说明:文章中斜体字为通用模板命令,可以根据自己实际情况更改,摘自MOSDoc ID 1641136.1)