Oracle 11g RAC 應用補丁簡明版


之前總結過《Oracle 11.2.0.4 RAC安裝最新PSU補丁》,
這次整理為簡明版,忽略一切輸出的顯示,引入一些官方的說明,增加OJVM PSU的補丁應用。

環境:RHEL6.5 + Oracle 11.2.0.4 RAC(4 nodes)
本次需求:應用最新的PSU,OJVM PSU補丁。
目前最新發布(2016-07-19)的PSU,OJVM PSU補丁文件分別為:
p23274134_112040_Linux-x86-64.zip
p23177551_112040_Linux-x86-64.zip

1.檢查OPatch版本

需要跟蹤對應補丁的README說明,確定當前環境的OPatch版本符合要求,如果不符合要求,需要下載符合要求的OPatch版本。

1.1 查詢OPatch版本

$ORACLE_HOME/OPatch/opatch version

1.2 替換為新版本OPatch

備份原來的OPatch,解壓/tmp下的新版本OPatch到$ORACLE_HOME下,檢查OPatch的版本:

mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_bak && cd /tmp && unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
$ORACLE_HOME/OPatch/opatch version 

2.解壓補丁文件

$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME 解壓補丁文件:賦權確定解壓的目錄/usr2有對應權限,然后解壓補丁文件
root:
chown oracle:oinstall /usr2 && chmod 775 /usr2 && mv /tmp/p23274134_112040_Linux-x86-64.zip /usr2/ 
grid:
cd /usr2 && unzip p23274134_112040_Linux-x86-64.zip

3.確認已停止OEM

Stop EM Agent Processes Prior to Patching and Prior to Rolling Back the Patch
查看em運行狀態:
$ORACLE_HOME/bin/emctl status dbconsole
如果狀態是運行,則需要關閉:
$ORACLE_HOME/bin/emctl stop dbconsole

一般是在Oracle用戶登錄1節點 停止em。

4.本次PSU補丁說明

23054359
DB PSU 11.2.0.4.160719 (INCLUDES CPUJUL2016)
Both DB Homes and Grid Home

23054319
OCW PSU 11.2.0.4.160719
Both DB Homes and Grid Home

22502505
ACFS PSU 11.2.0.4.160419
Only Grid Home

5.手動應用補丁

Manual Steps for Apply/Rollback Patch See My Oracle Support Document 1641136.1 for cases where opatch auto cannot be used. 文檔第5部分 5 Manual Steps for Apply/Rollback Patch

5.1 停止CRS

--1.Stop the CRS managed resources running from DB homes. If this is a GI Home environment, as the database home owner execute:
`$ <ORACLE_HOME>/bin/srvctl stop home -o <ORACLE_HOME> -s <status file location> -n <node name>`

$ORACLE_HOME/bin/srvctl stop home -o $ORACLE_HOME -s /tmp/stophome.log  -n xxx01

實際這一步沒成功,也沒看出對應用補丁什么影響.

5.2 運行rootcrs.pl

--2.Run the pre root script. If this is a GI Home, as the root user execute:
`# <GI_HOME>/crs/install/rootcrs.pl -unlock`

停止節點1的服務 
su - root 
$GRID_HOME/crs/install/rootcrs.pl -unlock

5.3 應用CRS補丁

--3.Apply the CRS patch using. As the GI home owner execute:
$ <GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>
As the GI home owner execute:
$ <GI_HOME>/OPatch/opatch napply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<ACFS Components_number>
As the GI home owner execute:
$ <GI_HOME>/OPatch/opatch apply -oh <GI_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<DB_PSU_number>

grid用戶登錄,打對應補丁:

su - grid
$GRID_HOME/OPatch/opatch napply -oh $GRID_HOME -local /usr2/23274134/23054319
$GRID_HOME/OPatch/opatch napply -oh $GRID_HOME -local /usr2/23274134/22502505
$GRID_HOME/OPatch/opatch apply -oh $GRID_HOME -local /usr2/23274134/23054359

5.4 補丁安裝前執行腳本

--4.Run the pre script for DB component of the patch. As the database home owner execute:
$ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/prepatch.sh -dbhome <ORACLE_HOME>

Oracle用戶登錄,補丁安裝前檢查:

su - oracle
$ /usr2/23274134/23054319/custom/server/23054319/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME

5.5 應用DB補丁

--5.Apply the DB patch. As the database home owner execute:
$ <ORACLE_HOME>/OPatch/opatch napply -oh <ORACLE_HOME> -local <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_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用戶登錄,打對應補丁:

$ORACLE_HOME/OPatch/opatch napply -oh $ORACLE_HOME -local /usr2/23274134/23054319/custom/server/23054319
$ORACLE_HOME/OPatch/opatch apply -oh $ORACLE_HOME -local /usr2/23274134/23054359

5.6 補丁安裝后執行腳本

--6.Run the post script for DB component of the patch. As the database home owner execute:
$ <UNZIPPED_PATCH_LOCATION>/<GI_PSU_number>/<OCW Components_number>/custom/server/<OCW Components_number>/custom/scripts/postpatch.sh -dbhome <ORACLE_HOME>

oracle用戶登錄,補丁修復完確定:

$ /usr2/23274134/23054319/custom/server/23054319/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME

5.7 root用戶執行腳本

--7.Run the post script. As the root user execute:
# <GI_HOME>/rdbms/install/rootadd_rdbms.sh
If this is a GI Home, as the root user execute:
# <GI_HOME>/crs/install/rootcrs.pl -patch
If this is an Oracle Restart Home, as the root user execute:
# <GI_HOME>/crs/install/roothas.pl -patch

root用戶登錄,執行腳本:

su - root
# $GRID_HOME/rdbms/install/rootadd_rdbms.sh
# $GRID_HOME/crs/install/rootcrs.pl -patch

5.8 可能的報錯

--8.If the message, "A system reboot is recommended before using ACFS??? is shown, then a reboot must be issued before continuing. Failure to do so will result in running with an unpatched ACFS\ADVM\OKS driver.

5.9 呼應5.1步驟,這里也沒做

--9.Start the CRS managed resources that were earlier running from DB homes. If this is a GI Home environment, as the database home owner execute:
$ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> -n <node name>
If this is an Oracle Restart Home environment, as the database home owner execute:
$ <ORACLE_HOME>/bin/srvctl start home -o <ORACLE_HOME> -s <status file location> 

6.數據庫應用PSU

6.1 關閉數據庫然后應用PSU

srvctl stop database -d lrnop 

6.2 根據下面文檔的內容操作

2.5.2 Loading Modified SQL Files into the Database

The following steps load modified SQL files into the database. For an Oracle RAC environment, perform these steps on only one node.

For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the catbundle.sql script as follows:

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.

For information about the catbundle.sql script, see My Oracle Support Document 605795.1 Introduction to Oracle Database catbundle.sql.

If the OJVM PSU was applied for a previous GI PSU patch, you may see invalid Java classes after execution of the catbundle.sql script in the previous step. If this is the case, run utlrp.sql to re-validate these Java classes.

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
where TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS. If there are errors, see Section 3, "Known Issues".

This patch now includes the OJVM Mitigation patch (Patch:19721304). If an OJVM PSU is installed or planned to be installed, no further actions are necessary. Otherwise, the workaround of using the OJVM Mitigation patch can be activated. As SYSDBA do the following from the admin directory:

SQL > @dbmsjdev.sql
SQL > exec dbms_java_dev.disable
For more information on the OJVM mitigation patch, see Document 1929745.1 Oracle Recommended Patches -- "Oracle JavaVM Component Database PSU" (OJVM PSU) Patches.

2.5.3 Upgrade Oracle Recovery Manager Catalog

If you are using the Oracle Recovery Manager, the catalog needs to be upgraded. Enter the following command to upgrade it:

$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;

7.應用OJVM PSU

7.1 打OJVM PSU

p23177551_112040_Linux-x86-64.zip

7.2 應用OJVM PSU

su - oracle
cp /tmp/p23177551_112040_Linux-x86-64.zip /usr2 && cd /usr2 && unzip p23177551_112040_Linux-x86-64.zip


$ cd <PATCH_TOP_DIR>/23177551
$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

cd /usr2/23177551 && opatch apply

7.3 數據庫應用OJVM PSU

--1.For an Oracle RAC environment, reload the packages on one of the nodes using the following commands. Make sure no other instance of the database is up on the remote nodes.

cd $ORACLE_HOME/sqlpatch/23177551
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> alter system set cluster_database=false scope=spfile;
SQL> SHUTDOWN
SQL> STARTUP UPGRADE
SQL> @postinstall.sql
SQL> alter system set cluster_database=true scope=spfile;
SQL> SHUTDOWN
SQL> STARTUP 
--2.After installing the SQL portion of the patch, some packages could become INVALID. This will get recompiled upon access or you can run utlrp.sql to get them back into a VALID state.

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

8.應用補丁結果

最終驗證應用補丁的結果: 各節點的$GRID_HOME,$ORACLE_HOME,都可以使用opatch lspatches查看補丁應用的情況:
[root@db02 tmp]# su - grid
[grid@db02 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
23054359;Database Patch Set Update : 11.2.0.4.160719 (23054359)
22502505;ACFS Patch Set Update : 11.2.0.4.160419 (22502505)
23054319;OCW Patch Set Update : 11.2.0.4.160719 (23054319)

OPatch succeeded.
[grid@db02 ~]$ exit
logout
[root@db02 tmp]# su - oracle
[oracle@lrnopdb02 ~]$ $ORACLE_HOME/OPatch/opatch lspatches
23177551;OJVM PATCH SET UPDATE 11.2.0.4.160719
23054359;Database Patch Set Update : 11.2.0.4.160719 (23054359)
23054319;OCW Patch Set Update : 11.2.0.4.160719 (23054319)

OPatch succeeded.
[oracle@db02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 18 17:39:41 2016

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set linesize 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
28-JUN-16 12.36.13.876461 PM                                                APPLY                          SERVER  11.2.0.4                                0 PSU                            Patchset 11.2.0.2.0
18-AUG-16 03.49.29.881506 PM                                                APPLY                          SERVER  11.2.0.4                           160719 PSU                            PSU 11.2.0.4.160719
18-AUG-16 05.20.06.098533 PM                                                jvmpsu.sql                     SERVER  11.2.0.4.160719OJVMPSU                  0                                RAN jvmpsu.sql
18-AUG-16 05.20.06.213324 PM                                                APPLY                          SERVER  11.2.0.4.160719OJVMPSU                  0                                OJVM PSU post-install
18-AUG-16 05.20.06.245501 PM                                                APPLY   23177551                                Patch 23177551 applied

6 rows selected.

SQL> select count(1) from gv$instance;

  COUNT(1)
----------
         4

SQL> 

至此,Oracle 11g RAC 應用補丁簡明版整個過程的示例完畢。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM