程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> Oracle數據庫 >> Oracle教程 >> Oracle 更新Opatch、打補丁

Oracle 更新Opatch、打補丁

編輯:Oracle教程

1.更新Opatch;
2.打補丁;

1.更新Opatch(實驗版本:oracle:11.2.0.3.0):
默認安裝數據庫後,在ORACLE_HOME 下會有個OPatch 文件夾,更新前先檢查當前Opatch 版本:

   1:  [oracle@sywu2 OPatch]$ ./opatch lsinventory
   2:   Invoking OPatch 11.2.0.1.7
   3:   
   4:  Oracle 中間補丁程序安裝程序版本 11.2.0.1.7
   5:  版權所有 (c) 2011, Oracle Corporation。保留所有權利。
   6:   
   7:   
   8:  Oracle Home       : /s01/app/oracle/product/11.2.0/dbhome_1
   9:  Central Inventory : /g01/oraInventory
  10:     from           : /etc/oraInst.loc
  11:  OPatch version    : 11.2.0.1.7
  12:  OUI version       : 11.2.0.3.0
  13:  Log file location : /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-06-27_23-03-26下午.log

注:有些時候產品清單加載失敗,會導致打補丁時出錯

   1:  [sywu@sywu OPatch]$ ./opatch lsinventory
   2:  Invoking OPatch 11.1.0.6.6
   3:   
   4:  Oracle 中間補丁程序安裝程序版本 11.1.0.6.6
   5:  版權所有 (c) 2009, Oracle Corporation。保留所有權利。
   6:   
   7:   
   8:  Oracle 主目錄       : /u01/app/product/11.2.0/db_1
   9:  主產品清單: /g01/oraInventory
  10:     從           : /etc/oraInst.loc
  11:  OPatch 版本    : 11.1.0.6.6
  12:  OUI 版本       : 11.2.0.1.0
  13:  OUI 位置      : /u01/app/product/11.2.0/db_1/oui
  14:  日志文件位置 : /u01/app/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-06-27_21-51-13下午.log
  15:   
  16:  Patch history file: /u01/app/product/11.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
  17:   
  18:  List of Homes on this system:
  19:   
  20:    Home name= Ora11g_gridinfrahome1, Location= "/g01/11ggrid/11.2.0/grid"
  21:    Home name= OraDb11g_home1, Location= "/s01/app/oracle/product/11.2.0/dbhome_1"
  22:  產品清單加載失敗... OPatch cannot load inventory for the given Oracle Home.
  23:  Possible causes are:
  24:     Oracle Home dir. path does not exist in Central Inventory
  25:     Oracle Home is a symbolic link
  26:     Oracle Home inventory is corrupted
  27:  LsInventorySession 失敗: OracleHomeInventory gets null oracleHomeInfo
  28:   
  29:  OPatch failed with error code 73

解決方法:
1)找到產品清單文件,默認安裝成功後會在 /etc/oraInst.loc 和oracle 根目錄 oraInventory 文件夾下,如果/etc/下沒有就到ORACLE 安裝根目錄找到文件夾:oraInventory,裡面有oraInst.loc;復制一個到 /etc下;
2)到$ORACLE_HOME/oui/bin/ 執行如下腳本加載清單:

   1:  ./runInstaller -silent -attachHome \
   2:   ORACLE_HOME=$ORACLE_HOME \
   3:   ORACLE_HOME_NAME="ORACLE_HOME"

3) 加載成功後再次到OPatch目錄下執行 ./opatch lsinventory 確認產品清單加載是否成功;
1.1 更新前先備份原來的Opatch:

   1:  [oracle@sywu2 dbhome_1]$ tar -cvf Opatch_20140627.tar OPatch

1.2 解壓新版Opatch 文件到$ORACLE_HOME 目錄下:

   1:  [oracle@sywu2 dbhome_1]$ /tmp/unzip p6880880_112000_Linux-x86-64.zip -d $ORACLE_HOME
   2:  Archive:  p6880880_112000_Linux-x86-64.zip
   3:     creating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/
   4:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/README.html  
   5:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/README.txt  
   6:     creating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/
   7:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/oplan.jar  
   8:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/oracle.oplan.classpath.jar  
   9:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/automation.jar  
  10:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/OsysModel.jar  
  11:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/EMrepoDrivers.jar  
  12:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/Validation.jar  
  13:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/ValidationRules.jar  
  14:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/osysmodel-utils.jar  
  15:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/CRSProductDriver.jar  
  16:     creating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/apache-commons/
  17:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/apache-commons/commons-cli-1.0.jar  
  18:     creating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/jaxb/
  19:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/jaxb/activation.jar  
  20:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/jaxb/jaxb-api.jar  
  21:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/jaxb/jaxb-impl.jar  
  22:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/jlib/jaxb/jsr173_1.0_api.jar  
  23:    inflating: /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/oplan/oplan  
  24:  replace /s01/app/oracle/product/11.2.0/dbhome_1/OPatch/docs/FAQ? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
  25:  .............
1.3 確認OPatch 更新是否成功:
   1:  [oracle@sywu2 OPatch]$ ./opatch version
   2:  OPatch Version: 11.2.0.3.3
   3:   
   4:  OPatch succeeded.

可能會有未知錯誤,如版本問題,操作前一定記得備份原來的OPatch;
 
2.打補丁:
打補丁前要關閉數據庫實例、監聽程序,補丁要與更新的OPatch對應:
2.1 解壓補丁文件到$ORACLE_HOME 目錄下:

   1:  [oracle@sywu2 OPatch]$ unzip /tmp/p14727310_112030_Linux-x86-64.zip -d $ORACLE_HOME 
   2:  [oracle@sywu2 dbhome_1]$ cd 14727310/
   3:  [oracle@sywu2 14727310]$ ls
   4:  13343438  13696216  13923374  14275605  14727310  patchmd.xml  README.html  README.txt

  README.html 文件上有介紹打補丁方法,打補丁前先查看一下;
開始打補丁:

   1:  [oracle@sywu2 14727310]$ $ORACLE_HOME/OPatch/opatch apply

2.2 將變更的 SQL Files 導入數據庫:

   1:  [oracle@sywu2 ~]$ cd $ORACLE_HOME/rdbms/admin
   2:  [oracle@sywu2 admin]$ sqlplus / as sysdba
   3:  SQL> @catbundle.sql psu apply
打補丁信息在 V$version 視圖中是查詢不到的,要通過 dba_registry_history 視圖查詢:
   1:  SQL>  select action_time,action,namespace,version,bundle_series,comments from dba_registry_history;
   2:   
   3:  ACTION_TIME                                                                 ACTION     NAMESPACE  VERSION
   4:  --------------------------------------------------------------------------- ---------- ---------- ------------------------------
   5:  BUNDLE_SERIES                  COMMENTS
   6:  ------------------------------ --------------------
   7:  02-MAY-14 11.12.11.444913 PM                                                APPLY      SERVER     11.2.0.3
   8:  PSU                            Patchset 11.2.0.2.0
   9:   
  10:  27-JUN-14 11.42.54.320914 PM                                                APPLY      SERVER     11.2.0.3
查詢具體的Opatch 版本信息和補丁信息
   1:  [oracle@sywu OPatch]$ cd $ORACLE_HOME/OPatch
   2:  [oracle@sywu OPatch]$ ./opatch lsinventory  
   3:   
   4:  Oracle 中間補丁程序安裝程序版本 11.2.0.3.3
   5:  版權所有 (c) 2012, Oracle Corporation。保留所有權利。
   6:   
   7:   
   8:  Oracle Home       : /s01/app/oracle/product/11.2.0/dbhome_1
   9:  Central Inventory : /g01/oraInventory
  10:     from           : /s01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
  11:  OPatch version    : 11.2.0.3.3
  12:  OUI version       : 11.2.0.3.0
  13:  Log file location : /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2014-06-28_00-03-04上午_1.log
  14:   
  15:  Lsinventory Output file location : /s01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2014-06-28_00-03-04上午.txt
  16:   
  17:  --------------------------------------------------------------------------------
  18:  已安裝的頂級產品 (1):
  19:   
  20:  Oracle Database 11g                                                  11.2.0.3.0
  21:  此 Oracle 主目錄中已安裝 1 個產品。
  22:   
  23:   
  24:  中間補丁程序 (1) :
  25:   
  26:  Patch  14727310     : applied on Fri Jun 27 22:35:15 CST 2014
  27:  Unique Patch ID:  15663328
  28:  Patch description:  "Database Patch Set Update : 11.2.0.3.5 (14727310)"
  29:     Created on 27 Dec 2012, 00:06:30 hrs PST8PDT
  30:  Sub-patch  14275605; "Database Patch Set Update : 11.2.0.3.4 (14275605)"
  31:  Sub-patch  13923374; "Database Patch Set Update : 11.2.0.3.3 (13923374)"
  32:  Sub-patch  13696216; "Database Patch Set Update : 11.2.0.3.2 (13696216)"
  33:  Sub-patch  13343438; "Database Patch Set Update : 11.2.0.3.1 (13343438)"
  34:     Bugs fixed:
  35:       13566938, 13593999, 10350832, 14138130, 12919564, 13624984, 13588248
  36:       13080778, 13804294, 14258925, 12873183, 13645875, 12880299, 14664355
  37:       14409183, 12998795, 14469008, 13719081, 13492735, 12857027, 14263036
  38:       14263073, 13742433, 13732226, 12905058, 13742434, 12849688, 12950644
  39:       13742435, 13464002, 12879027, 13534412, 14613900, 12585543, 12535346
  40:       12588744, 11877623, 12847466, 13649031, 13981051, 12582664, 12797765
  41:       14262913, 12923168, 13612575, 13384182, 13466801, 13484963, 11063191
  42:       13772618, 13070939, 12797420, 13041324, 12976376, 11708510, 13742437
  43:       13026410, 13737746, 13742438, 13326736, 13001379, 13099577, 14275605
  44:       13742436, 9873405, 9858539, 14040433, 12662040, 9703627, 12617123
  45:       12845115, 12764337, 13354082, 13397104, 12964067, 13550185, 12780983
  46:       12583611, 14546575, 13476583, 15862016, 11840910, 13903046, 15862017
  47:       13572659, 13718279, 13657605, 13448206, 13419660, 14480676, 13632717
  48:       14063281, 13430938, 13467683, 13420224, 14548763, 12646784, 14035825
  49:       12861463, 12834027, 15862021, 13377816, 13036331, 14727310, 13685544
  50:       13499128, 15862018, 12829021, 15862019, 12794305, 14546673, 12791981
  51:       13503598, 13787482, 10133521, 12718090, 13399435, 14023636, 12401111
  52:       13257247, 13362079, 12917230, 13923374, 14480675, 13524899, 13559697
  53:       14480674, 13916709, 14076523, 13773133, 13340388, 13366202, 13528551
  54:       12894807, 13343438, 13454210, 12748240, 14205448, 13385346, 15853081
  55:       12971775, 13035804, 13544396, 13035360, 14062795, 12693626, 13332439
  56:       14038787, 14062796, 12913474, 14841409, 14390252, 13370330, 14062797
  57:       13059165, 14062794, 12959852, 13358781, 12345082, 12960925, 9659614
  58:       13699124, 14546638, 13936424, 13338048, 12938841, 12658411, 12620823
  59:       12656535, 14062793, 12678920, 13038684, 14062792, 13807411, 12594032
  60:       13250244, 15862022, 9761357, 12612118, 13742464, 14052474, 13457582
  61:       13527323, 15862020, 12780098, 13502183, 13705338, 13696216, 10263668
  62:       15862023, 13554409, 15862024, 13103913, 13645917, 14063280, 13011409

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved