天天看點

Oracle 11g RAC 自動應用PSU更新檔簡明版

環境: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版本
  • 2.配置ocm.rsp檔案
  • 3.使用opatch auto應用更新檔
  • 4.資料庫修改

在所有節點的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
           

在各個節點的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
           

使用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.
           

最後就是根據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
           
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.