【Oracle】RAC 11.2.0.4.0 PSU 11.2.0.4.170418

dmcatding發表於2017-06-15
作業系統:Red Hat Enterprise Linux Server release 6.4 (Santiago)
資料庫版本:Release 11.2.0.4.0 + RAC + ASM
GI PSU:25476126 (11.2.0.4.170418)


一、升級OPatch工具
1、 OPatch 必須是 11.2.0.3.6 或之後的版本;


2、檢查grid,oracle軟體 OPatch工具版本:
su - grid
[grid@rac1 ~]$ $ORACLE_HOME/OPatch/opatch version
OPatch Version: 11.2.0.3.4


OPatch succeeded.


3、登入MOS, 查詢patch 6880880 ,下載 11.2.0.0.0檔案p6880880_112000_Linux-x86-64.zip;


4、升級OPatch
4.1 備份OPatch目錄:分別對grid和oracle使用者下的OPatch目錄進行備份:
[root@rac1 ~]# su - grid
[grid@rac1 ~]$ cd $ORACLE_HOME/
[grid@rac1 grid]$mv OPatch OPatch_bak
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ cd $ORACLE_HOME/
[oracle@rac1 grid]$mv OPatch OPatch_bak


4.2、上傳檔案到/tmp
[root@rac1 tmp]# chmod grid:oinstall p6880880_112000_Linux-x86-64.zip
[root@rac1 tmp]# su - grid
[grid@rac1 ~]$ cd /tmp
[grid@rac1 tmp]$ unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME/
[grid@rac1 tmp]$ /u01/app/11.2.0/grid/OPatch/opatch version
OPatch Version: 11.2.0.3.16


OPatch succeeded.


[root@rac1 tmp]# chmod oracle:oinstall p6880880_112000_Linux-x86-64.zip
[root@rac1 tmp]# su - oracle
[oracle@rac1 ~]$ cd /tmp
[oracle@rac1 tmp]$ unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME/
[oracle@rac1 ~]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch version
OPatch Version: 11.2.0.3.16


OPatch succeeded.




二、建立OEM響應檔案
2.1、如果沒有配置OCM,按照下面的步驟執行:
[root@rac1 tmp]#su -grid
[grid@rac1 ~]$ $ORACLE_HOME/OPatch/ocm/bin/OPatch/ocm/bin/emocmrsp
#提示輸入郵箱,可直接按回車,然後輸入Y,即可在當前目錄下生成ocm.rsp檔案。


[root@rac1 tmp]#su - oracle
[oracle@rac1 ~]$ $ORACLE_HOME/OPatch/ocm/bin/emocmrsp
#提示輸入郵箱,可直接按回車,然後輸入Y,即可在當前目錄下生成ocm.rsp檔案。



三、開始升級GI 的PSU軟體包
3.1、上傳GI包p25476126_112040_Linux-x86-64.zip 到/home/grid,並解壓
chmod grid:oinstall p25476126_112040_Linux-x86-64.zip
unzip p25476126_112040_Linux-x86-64.zip


3.2、在安裝或者回滾PSU前必須用資料庫的屬主(一般為oracle)把EM agent停止
1、su - oracle
[oracle@rac1 ~]$ $ORACLE_HOME/bin/emctl stop dbconsole


3.3、檢視grid軟體補丁版本,輸出儲存,以便升級後對比;
su - grid
[grid@rac1 OPatch]$ $ORACLE_HOME/OPatch/opatch lsinventory




Oracle 中間補丁程式安裝程式版本 11.2.0.3.16
版權所有 (c) 2017, Oracle Corporation。保留所有權利。




Oracle Home       : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/11.2.0/grid/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-06-14_22-32-23下午_1.log


Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-06-14_22-32-23下午.txt


--------------------------------------------------------------------------------
Local Machine Information::
Hostname: rac2
ARU platform id: 226
ARU platform description:: Linux x86-64


已安裝的頂級產品 (1):


Oracle Grid Infrastructure 11g                                       11.2.0.4.0
此 Oracle 主目錄中已安裝 1 個產品。




此 Oracle 主目錄中未安裝任何中間補丁程式。




--------------------------------------------------------------------------------


OPatch succeeded.


3.4、檢視oracle軟體補丁版本
su - oracle
[oracle@rac2 ~]$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle 中間補丁程式安裝程式版本 11.2.0.3.16
版權所有 (c) 2017, Oracle Corporation。保留所有權利。




Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-14_16-59-32下午_1.log


Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-06-14_16-59-32下午.txt


--------------------------------------------------------------------------------
Local Machine Information::
Hostname: rac1
ARU platform id: 226
ARU platform description:: Linux x86-64


已安裝的頂級產品 (1):


Oracle Database 11g                                                  11.2.0.4.0
此 Oracle 主目錄中已安裝 1 個產品。




此 Oracle 主目錄中未安裝任何中間補丁程式。




--------------------------------------------------------------------------------


OPatch succeeded.


3.5、檢查補丁衝突
3.5.1用grid使用者:
$ cd
[grid@rac1 grid]$ cd 25476126/
[grid@rac1 25476126]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail  -phBaseDir ./
Oracle 中間補丁程式安裝程式版本 11.2.0.3.16
版權所有 (c) 2017, Oracle Corporation。保留所有權利。


PREREQ session


Oracle Home       : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/11.2.0/grid/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-06-14_17-02-55下午_1.log


Invoking prereq "checkconflictagainstohwithdetail"


Prereq "checkConflictAgainstOHWithDetail" passed.


OPatch succeeded.


3.5.2用oracle使用者:
$ cd
[oracle@rac1 grid]$ cd 25476126/
[oracle@rac1 25476126]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail  -phBaseDir ./


Oracle 中間補丁程式安裝程式版本 11.2.0.3.16
版權所有 (c) 2017, Oracle Corporation。保留所有權利。


PREREQ session


Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-14_17-09-34下午_1.log


Invoking prereq "checkconflictagainstohwithdetail"


Prereq "checkConflictAgainstOHWithDetail" passed.


OPatch succeeded.


3.6、升級前的PSU(oracle)
[oracle@rac1 ~]$ opatch lsinventory -bugs_fixed | grep 'PSU'
[oracle@rac1 OPatch]$ opatch lspatches
此 Oracle 主目錄中未安裝任何中間補丁程式 "/u01/app/oracle/product/11.2.0/db_1".


OPatch succeeded.


[oracle@rac1 ~]$ sqlplus / as sysdba
set line 9999
col action_time   for a30
col action       for a10
col namespace     for a10
col version       for a10
col bundle_series for a10
col comments    for a30
 
SELECT to_char(action_time, 'YYYY-MM-DD HH24:MI:SS') action_time,
       action,
       namespace,
       version,
       id,
       bundle_series,
       comments
  FROM dba_registry_history D;


ACTION_TIME                    ACTION     NAMESPACE  VERSION            ID BUNDLE_SER COMMENTS
------------------------------ ---------- ---------- ---------- ---------- ---------- ------------------------------
2013-08-24 12:03:45            APPLY      SERVER     11.2.0.4            0 PSU        Patchset 11.2.0.2.0
2016-09-26 03:02:19            APPLY      SERVER     11.2.0.4            0 PSU        Patchset 11.2.0.2.0


四、開始升級GI (GI PSU中包括了DB的PSU)
4.1、Case 1:: 適用於GI和DB的ORACLE_HOME都在本地盤,不在共享盤,而且沒有使用ACFS
#使用AUTO升級方式:必須用root身份安裝補丁(不需要停止GI)
[root@rac1 ~]# /u01/app/11.2.0/grid/OPatch/opatch auto /home/grid/25476126/ -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /home/grid -patchn 25476126 -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params


This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-14_17-25-24.log


This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-14_17-25-24.report.log


2017-06-14 17:25:24: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params


Stopping RAC /u01/app/oracle/product/11.2.0/db_1 ...
Stopped RAC /u01/app/oracle/product/11.2.0/db_1 successfully


patch /home/grid/25476126/24732075  apply successful for home  /u01/app/oracle/product/11.2.0/db_1 
patch /home/grid/25476126/23054319/custom/server/23054319  apply successful for home  /u01/app/oracle/product/11.2.0/db_1 


Stopping CRS...
Stopped CRS successfully


patch /home/grid/25476126/24732075  apply successful for home  /u01/app/11.2.0/grid 
patch /home/grid/25476126/23054319  apply successful for home  /u01/app/11.2.0/grid 
patch /home/grid/25476126/22502505  apply successful for home  /u01/app/11.2.0/grid 


Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.


Starting RAC /u01/app/oracle/product/11.2.0/db_1 ...
Started RAC /u01/app/oracle/product/11.2.0/db_1 successfully


opatch auto succeeded.
執行了這個命令後,會自動停止這個節點上的GI和所有資源;
然後在GI和DB的ORACLE_HOME下都安裝GI 和DB的PSU;
最後會將這個節點上的GI和資源都啟動。
##上面的所有步驟在一臺節點執行完後,在其他節點依次執行。千萬不要同時在兩個節點執行opatch auto 命令。


五、資料庫資料字典
5.1、在任意一臺節點用oracle使用者連線到資料庫上(只需在一臺節點執行一次,不需要所有節點都執行):
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT


5.2、OJVM PSU如果應用過之前的PSU,執行catbundle.sql指令碼會看到無效的JAVA類。如果這樣執行utlrp.sql指令碼,重新驗證這些java類。
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:


5.3、檢查$ORACLE_BASE/cfgtoollogs/catbundle 下任何錯誤日誌檔案:
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log


5.4 這個補丁包含OJVM Mitigation patch (Patch:19721304),如果OJVM補丁已經安裝或計劃安裝,沒有必要在進行下一步操作。
否則,需要啟用OJVM補丁工作,需要以SYSDBA從admin目錄中執行以下操作:
SQL > @dbmsjdev.sql
SQL > exec dbms_java_dev.disable


5.5、如果您使用了RMAN,需要將您的RMAN catalog庫升級一下,執行:
$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;


六、升級後的版本檢查
6.1、檢查gi軟體版本(第五位)
[root@rac1 ~]# su - grid
[grid@rac1 OPatch]$ /u01/app/11.2.0/grid/OPatch/opatch lspatches
22502505;ACFS Patch Set Update : 11.2.0.4.160419 (22502505)
23054319;OCW Patch Set Update : 11.2.0.4.160719 (23054319)
24732075;Database Patch Set Update : 11.2.0.4.170418 (24732075)


6.2、檢查oracle軟體版本(第五位)
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ /u01/app/11.2.0/grid/OPatch/opatch lspatches
23054319;OCW Patch Set Update : 11.2.0.4.160719 (23054319)
24732075;Database Patch Set Update : 11.2.0.4.170418 (24732075)


OPatch succeeded.
到此,GI、Oracle軟體版本完成更新,同樣檢查rac2節點;


6.3、檢查資料字典
[oracle@rac1 ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 15 16:52:38 2017


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 line 9999
SQL> col action_time   for a30
SQL> col action       for a10
SQL> col namespace     for a10
SQL> col version       for a10
SQL> col bundle_series for a10
SQL> col comments    for a30
  
SQL> SELECT to_char(action_time, 'YYYY-MM-DD HH24:MI:SS') action_time,
  2         action,
  3         namespace,
  4         version,
  5         id,
  6         bundle_series,
  7         comments
  8    FROM dba_registry_history D;


ACTION_TIME                    ACTION     NAMESPACE  VERSION            ID BUNDLE_SER COMMENTS
------------------------------ ---------- ---------- ---------- ---------- ---------- ------------------------------
2013-08-24 12:03:45            APPLY      SERVER     11.2.0.4            0 PSU        Patchset 11.2.0.2.0
2016-09-26 03:02:19            APPLY      SERVER     11.2.0.4            0 PSU        Patchset 11.2.0.2.0
2017-06-14 23:24:26            APPLY      SERVER     11.2.0.4       170418 PSU        PSU 11.2.0.4.170418


資料字典更新完成,至此,RAC 11.2.0.4.0 完成PSU更新。






###補丁解除安裝: 
案例1:GI、Database 不是共享檔案系統
1、使用root使用者在叢集的每個節點執行以下命令:
/u01/app/11.2.0/grid/OPatch/opatch auto /home/grid/25476126/ -rollback -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp


2、啟動所有資料庫例項:以下步驟都在5.1執行的節點執行
2.1、依次進入每個資料庫例項的oracle_home,以SYSDBA身份連線SQL*Plus
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> QUIT


2.2、執行utlrp.sql重新驗證這些java類
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql


3、檢查回退日誌中是否是報錯
cd $ORACLE_BASE/cfgtoollogs/catbundle
atbundle_PSU_<database SID>_ROLLBACK_<TIMESTAMP>.log


4、驗證回滾結果
$ opatch lsinventory


###遇到問題
報錯:unable to get oracle owner for
解決:export LANG=C

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30327022/viewspace-2140798/,如需轉載,請註明出處,否則將追究法律責任。

相關文章