GI PSU滾動方式應用GI HOME和DB HOME(opatch auto together)

不一樣的天空w發表於2018-05-16
GI PSU補丁可以以滾動方式應用GI HOME和DB HOME。注意下載補丁的存放位置應該是GI和db共享的目錄;

一、檢查rac沒法節點的opatch工具版本大於或等於11.2.0.3.6:rac每個節點都檢查

更新db和GI下的opatch工具:
$ unzip <OPATCH-ZIP> -d <ORACLE_HOME>
$ <ORACLE_HOME>/OPatch/opatch version

二、配置響應檔案:rac每個節點都操作
su - oracle
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /home/oracle/ocm.rsp
chmod 775 /home/oracle/ocm.rsp


三、驗證有效期
-- Validation of Oracle Inventory(以GI和DB使用者分別執行)
$ORACLE_HOME/OPatch/opatch lsinventory -detail -oh  $ORACLE_HOME

四、打補丁或回滾補丁前應停止EM程式(如果沒有安裝EM,則忽略)
su - oracle
<ORACLE_HOME>/bin/emctl stop dbconsole

五、升級PSU(As root user, execute the following command on each node of the cluster:不能並行執行)
--As root user, execute the following command on each node of the cluster:
以root使用者身份,在叢集的每個節點上執行以下命令:

注意:PSU補丁的存放位置應該是GI和db共享的目錄,並以GI下的opatch工具去執行

$ cd <UNZIPPED_PATCH_LOCATION>
$ unzip p27475913_112040_<platform>.zip

# opatch auto /tmp/27475913 -ocmrf /home/oracle/ocm.rsp

--解壓PSU補丁包
[oracle@dbrac2 ~]$ cd /tmp
[oracle@dbrac1 tmp]$ unzip p27475913_112040_Linux-x86-64.zip

--升級操作: /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
[root@dbrac1 tmp]# su - grid
[grid@dbrac1 ~]$ env|grep HOME
HOME=/home/grid
ORACLE_HOME=/oracle/app/11.2.0/grid
[grid@dbrac1 ~]$

[root@dbrac1 tmp]#  /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
Executing /oracle/app/11.2.0/grid/perl/bin/perl /oracle/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir /tmp -patchn 27475913 -ocmrf /home/oracle/ocm.rsp -paramfile /oracle/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-16_00-43-07.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/oracle/app/11.2.0/grid/cfgtoollogs/opatchauto2018-05-16_00-43-07.report.log

2018-05-16 00:43:07: Starting Clusterware Patch Setup
Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params
 
 
Stopping RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
Stopped RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

 patch /tmp/27475913/27338049  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1
 patch /tmp/27475913/27441052/custom/server/27441052  apply successful for home  /oracle/app/oracle/product/11.2.0/dbhome_1

Stopping CRS...
   Stopped CRS successfully

 patch /tmp/27475913/27338049  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27475913/27441052  apply successful for home  /oracle/app/11.2.0/grid
patch /tmp/27475913/22502505  apply successful for home  /oracle/app/11.2.0/grid

Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.
 
Starting RAC /oracle/app/oracle/product/11.2.0/dbhome_1 ...
 Started RAC /oracle/app/oracle/product/11.2.0/dbhome_1 successfully

opatch auto succeeded.
[root@dbrac1 tmp]#  

節點2操作如上.............
[root@dbrac2 tmp]#  /oracle/app/11.2.0/grid/OPatch/opatch auto /tmp/27475913/ -ocmrf /home/oracle/ocm.rsp
省略..........................


六、升級後資料庫註冊,跑指令碼:對於rac只需在一個節點上操作即可
--執行指令碼catbundle.sql
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.

--編譯失效物件
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> @utlrp.sql

--檢查日誌有無報錯
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log

--如果在使用rman恢復目錄,則執行如下:
$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;

--跑完後驗證:
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-OCT-17 10.12.28.771351 PM   APPLY      SERVER          11.2.0.4                 0 PSU             Patchset 11.2.0.2.0
07-MAR-18 06.07.41.694205 AM   APPLY      SERVER          11.2.0.4            161018 PSU             PSU 11.2.0.4.161018
30-MAR-18 03.39.07.129649 PM   APPLY      SERVER          11.2.0.4            170718 PSU             PSU 11.2.0.4.170718
15-MAY-18 11.32.57.424765 PM   APPLY      SERVER          11.2.0.4            180116 PSU             PSU 11.2.0.4.180116
16-MAY-18 02.00.48.476152 AM   APPLY      SERVER          11.2.0.4            180417 PSU             PSU 11.2.0.4.180417

6 rows selected.


七、回滾PSU
--root身份執行:
As root user, execute the following command on each node of the cluster.

# opatch auto <UNZIPPED_PATCH_LOCATION>/27475913 -rollback -ocmrf <ocm response file>

八、回滾後註冊:在執行打補丁註冊後的節點上執行回滾後註冊
8.1 Start all database instances running from the Oracle home

8.2 執行指令碼

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU_<database SID PREFIX>_ROLLBACK.sql
SQL> QUIT

8.3 編譯失效物件

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

8.4 Check the log file for any errors.

The log file is found in $ORACLE_BASE/cfgtoollogs/catbundle and is named catbundle_PSU_<database SID>_ROLLBACK_<TIMESTAMP>.log where TIMESTAMP is of the form YYYYMMMDD_HH_MM_SS. If there are error.

8.5 檢查

$ opatch lsinventory

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

相關文章