使用opatch工具 打补丁Patch 21352635 -(Database Patch Set Update 11.2.0.4.8)

时间:2021-06-21 23:20:50

Patch 21352635 - Database Patch Set Update 11.2.0.4.8

一、OPatch工具检查及升级

OPatch工具包,在安装目录$ORACLE_HOME下,PSU安装升级,都是通过OPatch来完成的。PSU的升级安装对OPatch的版本有一定的要求,关于这一点,可以查看PSU的Readme文档。例如,要安装p21352635_112040_Linux-x86-64,则必须要11.2.0.3.6或更高版本的OPatch。

1.1、确定当前系统的OPatch版本。

方法如下所示:

[oracle@Oracle11g ~]$cd /u01/app/oracle/product/11.2.0/db_1/OPatch/

[oracle@Oracle11g OPatch]$./opatch version

Invoking OPatch 11.1.0.6.6

OPatch Version: 11.1.0.6.6

OPatch succeeded.

显然,当前系统的OPatch版本不适合安装补丁p21352635_112040_Linux-x86-64,要先升级OPatch,升级步骤如下:

1.2、备份当前版本的OPatch

[oracle@Oracle11g db_1]$ tar cvf OPatch.tar OPatch/   # 也可以直接覆盖

[oracle@Oracle11g db_1]$ cd OPatch

[oracle@Oracle11g OPatch]$ rm -rf *   --删除文件

1.3、下载对于版本的OPatch解压至$ORACLE_HOME目录下

然后授予执行权限。

[oracle@Oracle11g opatchs]$ cd  /home/oracle/opatchs   --这个是存放补丁包的目录

[oracle@Oracle11g opatchs]$ ls -ltr

总计 122932

drwxrwxr-x 10 oracle oinstall     4096 2015-09-01 21352635

-rw-rw-r--  1 oracle oinstall    65235 2015-10-24 PatchSearch.xml

-rw-r--r--  1 oracle oinstall 72935280 2017-06-19 p21352635_112040_Linux-x86-64.zip安全漏洞的补丁包

-rw-r--r--  1 oracle oinstall 52733900 2017-06-19 p6880880_112000_Linux-x86-64.zip  --升级opatch的补丁包

[oracle@Oracle11g opatchs]$ unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/db_1 

--解压opatch升级包至$ORACLE_HOME目录下

[oracle@Oracle11g OPatch]$ cd /u01/app/oracle/product/11.2.0/db_1/OPatch

[oracle@Oracle11g OPatch]$ chmod +x opatch opatch.bat opatchdiag opatchdiag.bat

1.4、重新验证OPatch版本

[oracle@Oracle11g OPatch]$ cd

/u01/app/oracle/product/11.2.0/db_1/OPatch

 

[oracle@Oracle11g OPatch]$./opatch version

OPatch Version: 11.2.0.3.12

OPatch succeeded.–okopatch版本升级成功

二、应用补丁

主要,首先必须保证数据库实例+监听正常关闭。

[oracle@Oracle11g opatchs]$ cd  /home/oracle/opatchs这是存放补丁包的路径

[oracle@Oracle11g opatchs]$ unzip p21352635_112040_Linux-x86-64.zip

……

篇幅很长,略

……

[oracle@Oracle11g opatchs]$ cd 21352635/

[oracle@Oracle11g 21352635]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatchprereqCheckConflictAgainstOHWithDetail -ph ./  --这是预安装的检查

Oracle 中间补丁程序安装程序版本 11.2.0.3.12

版权所有 (c) 2017, Oracle Corporation。保留所有权利。

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.12

OUI version       : 11.2.0.1.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-05-26_20-34-20下午_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

[oracle@Oracle11g 21352635]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/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.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/opatch2016-07-12_09-40-56AM_1.log

 

Verifying environment and performing prerequisite checks...

OPatch continues with these patches:   17478514  18031668  18522509  19121551  19769489  20299013  20760982  21352635 

 

Do you want to proceed? [y|n]

 

...省略部分内容...

 

Backing up files...

Applying sub-patch '17478514' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.sdo, 11.2.0.4.0...

 

Patching component oracle.sysman.agent, 10.2.0.4.5...

 

Patching component oracle.xdk, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.sdo.locator, 11.2.0.4.0...

 

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...

 

Verifying the update...

Applying sub-patch '18031668' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.ldap.rsf, 11.2.0.4.0...

 

Patching component oracle.rdbms.crs, 11.2.0.4.0...

 

Patching component oracle.precomp.common, 11.2.0.4.0...

 

Patching component oracle.ldap.rsf.ic, 11.2.0.4.0...

 

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.rdbms.rman, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '18522509' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.precomp.common, 11.2.0.4.0...

 

Patching component oracle.rdbms.rman, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '19121551' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.precomp.common, 11.2.0.4.0...

 

Patching component oracle.sysman.console.db, 11.2.0.4.0...

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.rdbms.rman, 11.2.0.4.0...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.ordim.client, 11.2.0.4.0...

 

Patching component oracle.ordim.jai, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '19769489' to OH '/u01/app/oracle/product/11.2.0/db_1'

ApplySession: Optional component(s) [ oracle.sysman.agent, 11.2.0.4.0 ]  not present in the Oracle Home or a higher version is found.

 

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.ovm, 11.2.0.4.0...

 

Patching component oracle.xdk, 11.2.0.4.0...

 

Patching component oracle.rdbms.util, 11.2.0.4.0...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.xdk.parser.java, 11.2.0.4.0...

 

Patching component oracle.oraolap, 11.2.0.4.0...

 

Patching component oracle.rdbms.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...

 

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '20299013' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.rdbms.dv, 11.2.0.4.0...

 

Patching component oracle.rdbms.oci, 11.2.0.4.0...

 

Patching component oracle.precomp.common, 11.2.0.4.0...

 

Patching component oracle.sysman.agent, 10.2.0.4.5...

 

Patching component oracle.xdk, 11.2.0.4.0...

 

Patching component oracle.sysman.common, 10.2.0.4.5...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Patching component oracle.xdk.parser.java, 11.2.0.4.0...

 

Patching component oracle.sysman.console.db, 11.2.0.4.0...

 

Patching component oracle.xdk.rsf, 11.2.0.4.0...

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.sysman.common.core, 10.2.0.4.5...

 

Patching component oracle.rdbms.rman, 11.2.0.4.0...

 

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '20760982' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.sysman.console.db, 11.2.0.4.0...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

 

Verifying the update...

Applying sub-patch '21352635' to OH '/u01/app/oracle/product/11.2.0/db_1'

 

Patching component oracle.sysman.agent, 10.2.0.4.5...

 

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

 

Patching component oracle.rdbms.rman, 11.2.0.4.0...

 

Patching component oracle.rdbms, 11.2.0.4.0...

 

Verifying the update...

Composite patch 21352635 successfully applied.

Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2016-07-12_09-40-56AM_1.log

 

OPatch succeeded.

四、运行catbundle.sql和utlrp.sql脚本,对于RAC环境,仅需要在一个节点上运行。

(1)、catbundle.sql将补丁信息反射到数据库中,使数据库知道你最后一次打了什么补丁或者回滚了哪些补丁。

[oracle@Oracle11g 21352635]$ cd $ORACLE_HOME/rdbms/admin

[oracle@Oracle11g admin]$ sqlplus /nolog

SQL> CONNECT / AS SYSDBA

SQL> STARTUP;

SQL>@catbundle.sql  psu apply

SQL>exit

(2)、utlrp.sql脚本可以在数据库运行的状态下编译数据库中的invalid对象,Oracle建议在对数据库进行迁移、升级、降级后都运行一遍utlrp.sql以编译无效对象。

cd $ORACLE_HOME/rdbms/admin

sqlplus /nolog

SQL> CONNECT / AS SYSDBA

SQL>@utlrp.sql

(3)、查看 $ORACLE_HOME/cfgtoollogs/catbundle or

$ORACLE_BASE/cfgtoollogs/catbundle目录下的的日志文件是否记录错误。

catbundle_PSU_<database SID>_APPLY_<TIMESTAMP>.log

catbundle_PSU_<database SID>_GENERATE_<TIMESTAMP>.log

至此,本次patch过程结束。

三、确认升级后补丁信息

(1)、通过OPatch的信息库记录,可以看到补丁信息。

[oracle@Oracle11g 21352635]$ $ORACLE_HOME/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/opatch2016-07-12_11-01-23AM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2016-07-12_11-01-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  21352635     : applied on Tue Jul 12 09:50:04 CST 2016

Unique Patch ID:  19227862

Patch description:  "Database Patch Set Update : 11.2.0.4.8 (21352635)"

Created on 1 Sep 2015, 07:49:44 hrs

Sub-patch  20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"

Sub-patch  20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"

…….

篇幅太长略

……

--------------------------------------------------------------------------------

OPatch succeeded.