最近測試了一下在Oracle 10g下面(單實例下面)升級、應用補丁PSU 10.2.0.5.180717,打這個補丁的主要原因是 Oracle 將於 2019年6月啟用新的SCN兼容性,並且由於BigSCN的作用,96K每秒的SCN增速,都可能會使得通過DB Link的訪問產生SCN過度拉升,所以新的補丁需要被應用。最近(2018年8月份)Oracle 提供了針對 Oracle 10g 最終版本 10.2.0.5 的修正補丁,為低版本用戶提供了一個解決方案。更多這方面的相關知識,可以參考這篇文章升級更新:Oracle關於DB Link在2019年升級的10g版本兼容性。下面按照官方文檔從Patch Pre-Installation Instructions,Patch Installation Instructions,Post Installation Instructions這三個方面來測試、驗證一下。
Patch Pre-Installation Instructions
安裝這個補丁對OPatch Utility的版本有要求,要求OPatch 10.2 version 10.2.0.5.0 或之后的版本,否則在應用補丁的過程就會遇到一些錯誤,后面例子會介紹這個具體錯誤,以及如何升級OPatch Utility(此處不展開,后面展開)
檢查opatch版本
不符合要求的版本的例子:
#$ORACLE_HOME/OPatch/opatch version
Invoking OPatch 10.2.0.4.9
OPatch Version: 10.2.0.4.9
OPatch succeeded.
符合要求的版本的例子:
#$ORACLE_HOME/OPatch/opatch version
Invoking OPatch 10.2.0.5.1
OPatch Version: 10.2.0.5.1
OPatch succeeded.
注意事項:
To install the PSU 10.2.0.5.180717 patch, the Oracle home must have the 10.2.0.5.0 Database installed. Subsequent PSU patches can be installed on Oracle Database 10.2.0.5.0 or any PSU with a lower 5th numeral version than the one being installed.
首先要去meatalink上下載Patch 26493118 也就是 Oracle Database Patch Set Update 10.2.0.5.171017。當然下載這個補丁是需要口令。不過我們下載的是補丁程序26493118: DATABASE PATCH SET UPDATE 10.2.0.5.171017, 因為我去下載的時候,這個補丁程序集已經被取代(Patch 26925212 is a super set of patch 26493118)。
關閉監聽、ORACLE實例等。
如下所示:
$ lsnrctl stop
SQL> shutdown immediate
$ emctl status dbconsole
TZ set to PRC
OC4J Configuration issue. /u01/app/oracle/product/10.2.0/db_1/oc4j/j2ee/OC4J_DBConsole_getlnx14uat.esquel.com_SCM2 not found.
如果EM服務是運行狀態,就必須關閉
$ emctl stop dbconsole
$ unzip p26925212_10205_Linux-x86-64.zip
解壓后,我們最好檢查一下當前環境是否存在補丁沖突
Determine whether any currently installed one-off patches conflict with the PSU patch as follows:
opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./26925212
正常情況:
[oracle@mylnx01 klb]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./26925212/
Invoking OPatch 10.2.0.4.9
Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2018-11-01_22-35-10PM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
沖突情況:
[oracle@mylnx02 tmp]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./26925212/
Invoking OPatch 10.2.0.5.1
Oracle Interim Patch Installer version 10.2.0.5.1
Copyright (c) 2010, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.5.1
OUI version : 10.2.0.5.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2018-11-04_14-44-35PM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
Invoking prereq "checkconflictagainstohwithdetail"
ZOP-47: The patch(es) has supersets with other patches installed in the Oracle Home (or) among themselves.
Prereq "checkConflictAgainstOHWithDetail" failed.
Summary of Conflict Analysis:
Patches that can be applied now without any conflicts are :
26925212
Following patches are not required, as they are subset of the patches in Oracle Home or subset of the patches in the given list :
9949948, 7612454
Following patches will be rolled back from Oracle Home on application of the patches in the given list :
9949948, 7612454
Conflicts/Supersets for each patch are:
Patch : 26925212
Bug Superset of 9949948
Super set bugs are:
9949948
Bug Superset of 7612454
Super set bugs are:
7612454
OPatch succeeded.
卸載沖突補丁:
$ $ORACLE_HOME/OPatch/opatch rollback -id 9949948
$ $ORACLE_HOME/OPatch/opatch rollback -id 7612454
Patch Installation Instructions
預演補丁安裝的正常情況:
$ORACLE_HOME/OPatch/opatch apply -report
預演補丁安裝的非正常情況:
[oracle@getlnx01uat 26925212]$ $ORACLE_HOME/OPatch/opatch apply -report
Invoking OPatch 10.2.0.4.9
Oracle Interim Patch Installer version 10.2.0.4.9
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /etc/oraInst.loc
OPatch version : 10.2.0.4.9
OUI version : 10.2.0.5.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2018-11-01_22-36-06PM.log
Patch history file: /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
ApplySession applying interim patch '26925212' to OH '/u01/app/oracle/product/10.2.0/db_1'
ApplySession failed: ApplySession failed to prepare the system.
Patch 26925212 requires OPatch version 10.2.0.5.0.
The OPatch version being used (10.2.0.4.9) doesn't meet the minimum version required by the patch(es). Please download latest OPatch from My Oracle Support.
System intact, OPatch will not attempt to restore the system
OPatch failed with error code 73
如上所示,這個是因為OPatch的版本低於10.2.0.5.0,所以必須必須先升級 OPatch的版本,可以下載p6880880_1020000_Linux-x86-64.zip安裝包,具體步驟如下:
[oracle@mylnx01 tmp]$ unzip p6880880_1020000_Linux-x86-64.zip
[oracle@mylnx01 tmp]$ cd OPatch/
[oracle@mylnx01 OPatch]$ cd $ORACLE_HOME
[oracle@mylnx01 db_1]$ mv OPatch OPatch.bak
[oracle@mylnx01 db_1]$
[oracle@mylnx01 db_1]$ cp -rf /tmp/OPatch/ ./
[oracle@mylnx01 db_1]$ ls -lrt ./OPatch
total 80
-rw-r--r-- 1 oracle oinstall 2417 Nov 1 23:09 README.txt
drwxr-xr-x 4 oracle oinstall 4096 Nov 1 23:09 opatchprereqs
-rw-r--r-- 1 oracle oinstall 2576 Nov 1 23:09 opatch.pl
-rw-r--r-- 1 oracle oinstall 49 Nov 1 23:09 opatch.ini
-rwxr-xr-x 1 oracle oinstall 8085 Nov 1 23:09 opatch.bat
-r-x--x--- 1 oracle oinstall 13252 Nov 1 23:09 opatch
drwxr-xr-x 4 oracle oinstall 4096 Nov 1 23:09 ocm
drwxr-xr-x 2 oracle oinstall 4096 Nov 1 23:09 jlib
-rw-r--r-- 1 oracle oinstall 23695 Nov 1 23:09 emdpatch.pl
drwxr-xr-x 2 oracle oinstall 4096 Nov 1 23:09 docs
drwxr-xr-x 3 oracle oinstall 4096 Nov 1 23:09 crs
[oracle@mylnx01 db_1]$ $ORACLE_HOME/OPatch/opatch version
Invoking OPatch 10.2.0.5.1
OPatch Version: 10.2.0.5.1
OPatch succeeded.
[oracle@mylnx01 26925212]$ $ORACLE_HOME/OPatch/opatch apply -report
[oracle@mylnx01 26925212]$ $ORACLE_HOME/OPatch/opatch apply
檢查補丁安裝情況:
$ORACLE_HOME/OPatch/opatch lsinventory
Post Installation Instructions
打完補丁后,啟動Oracle實例,然后運行一些腳本,如下所示,也可以參考補丁里面的相關文件README.html
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> -- Execute the next statement only if this is the first PSU applied for 10.2.0.5 or this is the first PSU applied since 10.2.0.5.3.
SQL> @utlrp.sql
SQL> QUIT
檢查$ORACLE_HOME/cfgtoollogs/catbundle 或 $ORACLE_BASE/cfgtoollogs/catbundle 目錄下的日志里面是否有任何錯誤。
catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log
catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log
例如,測試案例當中生成的日志:
/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/catbundle/catbundle_PSU_SCM2_APPLY_2018Nov04_15_07_27.log
/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/catbundle/catbundle_PSU_EPPS_GENERATE_2018Nov01_23_23_46.log




