注意:无论DBA经验多丰富,在进行补丁的时候,一定要参考每个补丁的readme.txt文件,遵循官方步骤进行操作。用成熟技术、用官方步骤是我们确保成功的重要原则。
首先,进行补丁先决条件检查。
[oracle@XXX-PROD-DB 19852360]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-22-39AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
没有发现问题,可以直接进行补丁。
[oracle@XXX-PROD-DB 19852360]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/19852360_Aug_04_2015_10_21_09/apply2015-08-04_10-21-09AM_1.log
Applying interim patch '19852360' to OH '/u01/app/oracle/product/11.2.0/dbhome_1'
Verifying environment and performing prerequisite checks...
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Email address/User Name:
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
Backing up files...
Patching component oracle.dbjava.jdbc, 11.2.0.4.0...
Patching component oracle.dbjava.ic, 11.2.0.4.0...
Verifying the update...
Patch 19852360 successfully applied
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/19852360_Aug_04_2015_10_21_09/apply2015-08-04_10-21-09AM_1.log
OPatch succeeded.
3、补丁20299013_112040
解压补丁文件:
[root@XXX-PROD-DB patch]# unzip p20299013_112040_Linux-x86-64.zip
inflating: 20299013/18522509/files/lib/libserver11.a/qerel.o
inflating: 20299013/18522509/files/lib/libserver11.a/knahs.o
(篇幅原因,有省略……)
inflating: 20299013/18522509/etc/config/actions.xml
inflating: 20299013/18522509/etc/config/inventory.xml
inflating: PatchSearch.xml
设置owner权限。
[root@XXX-PROD-DB patch]# chown -R oracle:oinstall 20299013/
[root@XXX-PROD-DB patch]# ls -l
total 282840
drwxr-xr-x. 4 oracle oinstall 4096 Oct 20 2014 19852360
drwxrwxr-x. 8 oracle oinstall 4096 Mar 4 18:30 20299013
补丁20299013_112040是一个补丁集合,多个经过验证的安全补丁集合防止,是可以统一进行补丁操作的。
[oracle@XXX-PROD-DB 20299013]$ ls -l
total 88
drwxr-xr-x. 4 oracle oinstall 4096 Mar 4 18:30 17478514
drwxr-xr-x. 4 oracle oinstall 4096 Mar 4 18:30 18031668
drwxr-xr-x. 4 oracle oinstall 4096 Mar 4 18:30 18522509
drwxr-xr-x. 4 oracle oinstall 4096 Mar 4 18:30 19121551
drwxrwxr-x. 4 oracle oinstall 4096 Mar 4 18:30 19769489
drwxrwxr-x. 4 oracle oinstall 4096 Mar 4 18:30 20299013
-rw-r--r--. 1 oracle oinstall 3068 Mar 4 18:30 patchmd.xml
-rw-rw-r--. 1 oracle oinstall 54747 Apr 12 10:40 README.html
-rw-r--r--. 1 oracle oinstall 21 Mar 4 18:30 README.txt
进行先决性检查。
[oracle@XXX-PROD-DB 20299013]$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-28-53AM_1.log
Invoking prereq "checkconflictagainstohwithdetail"
Prereq "checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.
验证通���,说明当前系统安装补丁和将要安装补丁之间没有冲突。但是,执行apply的时候就有问题。
[oracle@XXX-PROD-DB 20299013]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-29-25AM_1.log
Verifying environment and performing prerequisite checks...
Prerequisite check "CheckActiveFilesAndExecutables" failed.
The details are:
Following executables are active :
/u01/app/oracle/product/11.2.0/dbhome_1/bin/oracle
/u01/app/oracle/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1
UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-29-25AM_1.log
OPatch failed with error code 73
报错信息中包括了日志内容,一旦出现Oracle错误,各种日志是进行诊断的最好方法。
[root@XXX-PROD-DB patch]# cd /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/
[root@XXX-PROD-DB opatch]# ls -l
total 36
drwxr-xr-x. 2 oracle oinstall 4096 Aug 4 10:21 19852360_Aug_04_2015_10_21_09
drwxr-xr-x. 2 oracle oinstall 4096 Aug 4 10:06 lsinv
-rw-r--r--. 1 oracle oinstall 2050 Aug 4 10:06 opatch2015-08-04_10-06-22AM_1.log
-rw-r--r--. 1 oracle oinstall 1665 Aug 4 10:22 opatch2015-08-04_10-22-39AM_1.log
-rw-r--r--. 1 oracle oinstall 2021 Aug 4 10:28 opatch2015-08-04_10-28-53AM_1.log
-rw-r--r--. 1 oracle oinstall 10540 Aug 4 10:29 opatch2015-08-04_10-29-25AM_1.log
-rw-r--r--. 1 oracle oinstall 1872 Aug 4 10:29 opatch_history.txt
[root@INTCTL-PROD-DB opatch]# ls -l | grep 2015-08-04_10-29-25
-rw-r--r--. 1 oracle oinstall 10540 Aug 4 10:29 opatch2015-08-04_10-29-25AM_1.log
--日志片段:
[Aug 4, 2015 10:29:31 AM] Finish fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/bin/proc at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Start fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/lib/liborasdkbase.so.11.1 at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Finish fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/lib/liborasdkbase.so.11.1 at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Start fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/bin/wrap at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Finish fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/bin/wrap at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Start fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/bin/e2eme at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Finish fuser command /sbin/fuser /u01/app/oracle/product/11.2.0/dbhome_1/bin/e2eme at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] OUI-67073:UtilSession failed: Prerequisite check "CheckActiveFilesAndExecutables" failed.
[Aug 4, 2015 10:29:31 AM] Finishing UtilSession at Tue Aug 04 10:29:31 CST 2015
[Aug 4, 2015 10:29:31 AM] Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-29-25AM_1.log
[Aug 4, 2015 10:29:31 AM] Stack Description: java.lang.RuntimeException: Prerequisite check "CheckActiveFilesAndExecutables" failed.
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.OPatchSessionHelper.runApplyPrereqs(OPatchSessionHelper.java:5717)
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.opatchutil.NApply.process(NApply.java:697)
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.opatchutil.OUSession.napply(OUSession.java:1082)
[Aug 4, 2015 10:29:31 AM] StackTrace: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[Aug 4, 2015 10:29:31 AM] StackTrace: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[Aug 4, 2015 10:29:31 AM] StackTrace: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[Aug 4, 2015 10:29:31 AM] StackTrace: java.lang.reflect.Method.invoke(Method.java:592)
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.UtilSession.process(UtilSession.java:317)
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.OPatchSession.main(OPatchSession.java:2575)
[Aug 4, 2015 10:29:31 AM] StackTrace: oracle.opatch.OPatch.main(OPatch.java:626)
经过分析,认为是Oracle数据库和监听器启动状态。安装补丁的时候,最好还是能够停机进行。
[oracle@XXX-PROD-DB 20299013]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 04-AUG-2015 10:37:25
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
The command completed successfully
[oracle@INTCTL-PROD-DB 20299013]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 4 10:37:32 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
进行OPatch Apply操作。
[oracle@XXX-PROD-DB 20299013]$ opatch apply
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-38-47AM_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 17478514 18031668 18522509 19121551 19769489 20299013
(篇幅原因,有省略……)
Composite patch 20299013 successfully applied.
Log file location: /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-38-47AM_1.log
OPatch succeeded.
补丁成功。
注意:此时完成的是数据库软件、数据库实例的升级。但是数据库对象却没有升级。之后重启数据库,要进行脚本升级执行。
[oracle@XXX-PROD-DB 20299013]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Tue Aug 4 10:41:37 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 5227814912 bytes
Fixed Size 2262368 bytes
Variable Size 1140853408 bytes
Database Buffers 4076863488 bytes
Redo Buffers 7835648 bytes
Database mounted.
Database opened.
执行脚本。
SQL> @?/rdbms/admin/catbundle.sql psu apply
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_INTCDB_APPLY_2015Aug04_10_42_39.log
查看补丁内容信息:
[oracle@XXX-PROD-DB 20299013]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.10
Copyright (c) 2015, Oracle Corporation. All rights reserved.
Oracle Home : /u01/app/oracle/product/11.2.0/dbhome_1
Central Inventory : /u01/app/oraInventory
from : /u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
OPatch version : 11.2.0.3.10
OUI version : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-08-04_10-45-21AM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2015-08-04_10-45-21AM.txt
--------------------------------------------------------------------------------
Local Machine Information::
Hostname: localhost
ARU platform id: 226
ARU platform description:: Linux x86-64
Installed Top-level Products (1):