環境:Oracle RAC(GI 11.2.0.4 + DB 11.2.0.4)
本文應用補丁信息:
Patch 23615403 - Combo of OJVM Component 11.2.0.4.160719 DB PSU + GI PSU 11.2.0.4.160719 (Jul2016)
本文主要演示使用opatch auto自動應用補丁的過程。
1.更新OPatch版本
在所有節點的GI HOME和DB HOME下,都更新為符合應用補丁需求的OPatch版本。 將之前OPatch備份,解壓新版本的OPatch到$ORACLE_HOME目錄下,最后檢查OPatch版本。--更新OPatch版本 @all nodes including GI HOME and DB HOME
mv OPatch OPatch_bak
unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
$ORACLE_HOME/OPatch/opatch version
2.配置ocm.rsp文件
在各個節點的grid用戶下OPatch下,配置ocm.rsp文件。--生成ocm響應文件 @all nodes
[grid@jyrac2 ~]$ cd /opt/app/11.2.0/grid/OPatch/ocm/bin/
[grid@jyrac2 bin]$ ls
emocmrsp
[grid@jyrac2 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@jyrac2 bin]$ ls
emocmrsp ocm.rsp
[grid@jyrac2 bin]$ pwd
/opt/app/11.2.0/grid/OPatch/ocm/bin
3.使用opatch auto應用補丁
使用opatch auto應用補丁,具體需要參照補丁包中附帶的readme來操作。 根據readme中描述,對於GI HOME和DB HOME都不共享的情況下,使用root用戶在每個節點執行opatch auto的具體命令即可實現自動應用補丁。Case 1: GI Home and the Database Homes that are not shared and ACFS file system is not configured.
As root user, execute the following command on each node of the cluster:
opatch auto UNZIPPED_PATCH_LOCATION/23615403 -ocmrf ocm response file
先確認補丁包的解壓目錄(各節點保持一致,方便操作):
[grid@jyrac2 bin]$ cd /opt/app/media/
[grid@jyrac2 media]$ ls
23615403 p23615403_112040_Linux-x86-64.zip PatchSearch.xml
然后使用opatch auto應用補丁,
--opatch auto @all nodes
[root@jyrac1 23615403]# /opt/app/11.2.0/grid/OPatch/opatch auto /opt/app/media/23615403 -ocmrf /opt/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
正常應用補丁的輸出類似下面這樣:
[root@jyrac1 23615403]# /opt/app/11.2.0/grid/OPatch/opatch auto /opt/app/media/23615403 -ocmrf /opt/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
Executing /opt/app/11.2.0/grid/perl/bin/perl /opt/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /opt/app/media -patchn 23615403 -ocmrf /opt/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -paramfile /opt/app/11.2.0/grid/crs/install/crsconfig_params
This is the main log file: /opt/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-28_04-40-15.log
This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/opt/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-28_04-40-15.report.log
2017-06-28 04:40:15: Starting Clusterware Patch Setup
Using configuration parameter file: /opt/app/11.2.0/grid/crs/install/crsconfig_params
Stopping RAC /opt/app/oracle/product/11.2.0/dbhome_1 ...
Stopped RAC /opt/app/oracle/product/11.2.0/dbhome_1 successfully
patch /opt/app/media/23615403/23054359 apply successful for home /opt/app/oracle/product/11.2.0/dbhome_1
patch /opt/app/media/23615403/23054319/custom/server/23054319 apply successful for home /opt/app/oracle/product/11.2.0/dbhome_1
patch /opt/app/media/23615403/23177551 apply successful for home /opt/app/oracle/product/11.2.0/dbhome_1
Stopping CRS...
Stopped CRS successfully
patch /opt/app/media/23615403/23054359 apply successful for home /opt/app/11.2.0/grid
patch /opt/app/media/23615403/23054319 apply successful for home /opt/app/11.2.0/grid
patch /opt/app/media/23615403/22502505 apply successful for home /opt/app/11.2.0/grid
Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.
Starting RAC /opt/app/oracle/product/11.2.0/dbhome_1 ...
Started RAC /opt/app/oracle/product/11.2.0/dbhome_1 successfully
opatch auto succeeded.
這個opatch auto的過程會自動關閉數據庫和集群,打完補丁之后自動啟動集群和數據庫。
同樣,第一個節點成功后,在第二個節點應用補丁,輸出基本一樣,不再演示。
4.數據庫修改
最后就是根據readme具體說明,在數據庫執行:cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql
Check the following log files in $ORACLE_BASE/cfgtoollogs/catbundle for any errors:
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
SQL > @dbmsjdev.sql
SQL > exec dbms_java_dev.disable
最后,可以通過 select * from dba_registry_history; 查詢一下補丁應用的情況:
SQL> set lines 1000
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-AUG-16 03.26.07.674544 AM APPLY SERVER 11.2.0.4 0 PSU Patchset 11.2.0.2.0
28-JUN-17 07.54.40.436948 AM jvmpsu.sql SERVER 11.2.0.4.160719OJVMPSU 0 RAN jvmpsu.sql
28-JUN-17 07.55.44.682881 AM APPLY SERVER 11.2.0.4 160719 PSU PSU 11.2.0.4.160719
4 rows selected.
總的來說,這個opatch auto不出問題的情況下,操作上要比手工打補丁簡單的多。
若是想更可控的手工打補丁的話,可以參考之前的文章:《Oracle 11g RAC 應用補丁簡明版》