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

ORACLEPSU升級總結

編輯:Oracle教程

ORACLEPSU升級總結


首先,進行PSU,首要的事情就是認真的看readme.html,從裡面我們可以知道很詳細的升級步驟已經回退的方案。並且避免了很多的坑
在進行PSU之前,要首先確認你准備升級的版本以及你自己系統數據庫的版本,就像我們這次,是從11.2.0.4.0升級到11.2.0.4.2版本,從MOS上去找到相應的PATCH
p18031668_112040_Linux-x86-64.zip

可以通過p後面的數字在mos上面很容易的查到該補丁包,從該版本的補丁包的readme.html 中。我們可以看到這樣要求

2.1 OPatch Utility
You must use the OPatch utility version 11.2.0.3.6 or later to apply this patch. Oracle recommends that you use the latest released OPatch version for 11.2, which is available for download from My Oracle Support patch 6880880 by selecting the 11.2.0.0.0 release.

由於我們是用的系統盤直接裝的,默認的版本是這個:

[oracle@storedb OPatch]$ ./opatch version
OPatch Version: 11.2.0.3.4
版本是11.2.0.3.4 夠不到PATCH的最低的安裝版本,所以我們需要一個另外的PATCH來更新opatch的版本
Oracle 提供了這樣的一個補丁包
p6880880_112000_Linux-x86-64.zip
用來把OPATCH提成到最新的版本
具體的單獨升級ORACLE PSU的步驟:
1.把Opatch的環境變量配置
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
2.查看數據庫的版本
opatch version
[oracle@<span style="font-family: Arial, Helvetica, sans-serif;">storedb</span> OPatch]$ opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
opatch lsinventory
[oracle@kadora4 OPatch]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.  All rights reserved.
Oracle Home       : /opt/app/oracle/product/11.2.0/db_1
Central Inventory : /opt/oraInventory
   from           : /opt/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version    : 11.2.0.3.4
OUI version       : 11.2.0.4.0
Log file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-07_10-44-39AM_1.log
Lsinventory Output file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-07-07_10-44-39AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g                                                  11.2.0.4.0
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
3.更新補丁工具包
cd $ORACLE_HOME/
mv OPatch OPath_bak
unzip p6880880_112000_LINUX.zip
cd OPatch
[oracle@racdb1 db_1]$ cd OPatch
[oracle@racdb1 OPatch]$ ls
crs  docs  emdpatch.pl  jlib  ocm  opatch  opatch.bat  opatchdiag  opatchdiag.bat  opatch.ini  opatch.pl  opatchprereqs  oplan  README.txt  version.txt
[oracle@racdb1 OPatch]$
[oracle@racdb1 OPatch]$ opatch version
OPatch Version: 11.2.0.3.6
OPatch succeeded.
4.檢查你需要打的補丁是否與現有的補丁有沖突
unzip p18031668_112040_Linux-x86-64.zip
cd 18031668
[oracle@racdb1 18031668]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.
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.6
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-09_01-59-50AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
5.關閉數據庫並更新最新的補丁
sqlplus / as sysdba
shutdown immediate
cd 18031668
opatch apply
opatch apply
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.
 
Oracle Home       : /u01/app/oracle/product/11.2/db_1
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/oracle/product/11.2/db_1/oraInst.loc
OPatch version    : 11.2.0.3.6
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/17478514_Apr_02_2014_15_38_28/apply2014-04-02_15-38-28PM_1.log
 
 
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
 
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2/db_1')
 
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
 
 
Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...
 
Patching component oracle.xdk.rsf, 11.2.0.4.0...
 
Patching component oracle.rdbms.rman, 11.2.0.4.0...
 
OPatch found the word "warning" in the stderr of the make command.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'
/u01/app/oracle/product/11.2/db_1/sysman/lib/ins_emagent.mk:113: warning: overriding commands for target `nmosudo'
/u01/app/oracle/product/11.2/db_1/sysman/lib/ins_emagent.mk:52: warning: ignoring old commands for target `nmosudo'
 
Verifying the update...
Patch 17478514 successfully applied
OPatch Session completed with warnings.
Log file location: /u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/17478514_Apr_02_2014_15_38_28/apply2014-04-02_15-38-28PM_1.log
 
OPatch completed with warnings.
6.查看補丁:
opatch lsinventory
oracle@racdb1 OPatch]$   opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.  All rights reserved.
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.6
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-09_02-10-23AM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-07-09_02-10-23AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g                                                  11.2.0.4.0
There are 1 product(s) installed in this Oracle Home.
Interim patches (1) :
Patch  18031668     : applied on Wed Jul 09 00:16:43 EDT 2014
Unique Patch ID:  17255543
Patch description:  "Database Patch Set Update : 11.2.0.4.2 (18031668)"
   Created on 20 Feb 2014, 05:15:58 hrs PST8PDT
Sub-patch  17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
   Bugs fixed:
     17288409, 16399083, 17205719, 17811429, 10136473, 16472716, 17614227
     17050888, 17040764, 17865671, 17325413, 14010183, 17726838, 13364795
     17389192, 17612828, 17080436, 16613964, 17284817, 17441661, 17761775
     17721717, 16721594, 17390431, 18203837, 17551709, 17344412, 16043574
     17446237, 16863422, 18139690, 17071721, 17501491, 17610798, 17239687
     17752121, 17468141, 17602269, 18203835, 17375354, 17313525, 17811456
     16731148, 14133975, 18203838, 16956380, 17385178, 17235750, 13866822
     17394950, 17478514, 17027426, 12905058, 14338435, 16450169, 13944971
     18094246, 16929165, 16785708, 17265217, 17465741, 16220077, 16180763
     16069901, 17546973, 16285691, 17323222, 18180390, 17088068, 16875449
     17016369, 17443671, 16228604, 17811438, 17811447, 16837842, 18031668
     16912439, 17332800, 17393683, 17622427, 17545847, 17186905, 16943711
     16850630, 17082359, 17346671, 14852021, 17783588, 17437634, 16618694
     17341326, 17296856, 17546761, 17716305
--------------------------------------------------------------------------------
7.執行catbundle.sql將補丁信息反射到數據庫中,使數據庫知道你最後一次打了什麼補丁或者回滾了哪些補丁:
SQL> @?/rdbms/admin/catbundle.sql psu apply
SQL> Rem
SQL>
SQL> SET TERMOUT on
SQL> SET ECHO off
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
1 row selected.
1 row selected.
Generating apply and rollback scripts...
Check the following file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_FTDB_GENERATE_2014Apr02_17_20_18.log
Apply script: /u01/app/oracle/product/11.2/db_1/rdbms/admin/catbundle_PSU_FTDB_APPLY.sql
Rollback script: /u01/app/oracle/product/11.2/db_1/rdbms/admin/catbundle_PSU_FTDB_ROLLBACK.sql
 
PL/SQL procedure successfully completed.
 
Executing script file...
 
1 row selected.
 
SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/u01/app/oracle/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;
 
1 row selected.
 
SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')
 
PL/SQL procedure successfully completed.
 
SQL> PROMPT Skipping Spatial because it is not installed or versions mismatch...
Skipping Spatial because it is not installed or versions mismatch...
SQL> ALTER SESSION SET current_schema = SYS;
 
Session altered.
 
SQL> PROMPT Updating registry...
Updating registry...
SQL> INSERT INTO registry$history
  2    (action_time, action,
  3     namespace, version, id,
  4     bundle_series, comments)
  5  VALUES
  6    (SYSTIMESTAMP, 'APPLY',
  7     SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
  8     '11.2.0.4',
  9     1,
 10     'PSU',
 11     'PSU 11.2.0.4.1');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
這個是手動升級db的方法,對於有grid結構的數據庫,我們可以通過OPATCH AUTO的方式來進行數據庫的自動升級
1,更新gird和oracle用戶的Opatch文件
unzip p6880880_112000_Linux-x86-64.zip -d /oracle/11.2.0/grid
unzip p6880880_112000_Linux-x86-64.zip -d /oracle/app/oracle/product/11.2.0/db_1

2.生成響應文件
cd /oracle/11.2.0/grid/OPatch/ocm/bin
./emocmrsp

3,自動打補丁,打補丁的時候grid會自動重啟
數據庫啟動狀態 su -root
/oracle/11.2.0/grid/OPatch/opatch auto /oracle/media/psu -ocmrf /oracle/11.2.0/grid/OPatch/ocm/bin/ocm.rsp

此步操作我們需要注意幾個問題
(1) 補丁集的屬組需要為oracle:oinstall
(2) 我們需要斷開一切的數據庫的連接,不然的話在進行升級的時候會報錯
optach auto的過程中我們是看不到具體的錯誤內容的
它的安裝日志在/u01/app/11.2.0/grid/cfgtoollogs這個文件夾下來,如果遇到錯誤,我們可以看到詳細的錯誤日志,從而分析出錯誤的原因
(3) 進行opatch auto的時候我們需要關閉掉數據庫,grid可以不用關閉,在升級的時候會自動的進行關閉

4. 安裝完成進行驗證

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