Oracle 单实例打补丁

今天业务这边需要打一个补丁,具体如图


补丁工具的下载

https://updates.oracle.com/download/6880880.html


这里下载的是默认的32位的,记住如果平台是64位的那么就要使用64位的,32位是不行的。

下载补丁

https://support.oracle.com/epmos/faces/MosIndex.jspx?_afrLoop=79723004942769&_afrWindowMode=0&_adf.ctrl-state=5eu2ft196_4



上传最新的OPatch(补丁和OPatch可以上传到任意路径下面,但是解压出来之后OPatch要替换掉在$ORACLE_HOME/OPatch

解压上传的最新的OPatch包,将$ORACLE_HOME/OPatch替换为$ORACLE_HOME/OPatch.bak将解压后的最新的OPatch替换到原来的路径下面

验证补丁冲突

opatch prereq CheckConflictAgainstOHWithDetail -ph ./

[oracle@Database1 opath]$ ls

14772891  p14772891_11204160119_Linux-x86-64.zip

[oracle@Database1 14772891]$ pwd(切换到补丁的解压的目录下面)

/opath/14772891

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./(在补丁解压的目录下面使用OPatch工具的绝对路径所在的命令进行冲突检查

Oracle Interim Patch Installer version 11.2.0.3.4

Copyright (c) 2012, 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.4

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-18_04-08-57AM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

 

补丁平台验证

 

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq  CheckPatchApplicableOnCurrentPlatform -phBaseDir ./

Oracle Interim Patch Installer version 11.2.0.3.19

Copyright (c) 2018, 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.19

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_03-04-19AM_1.log

Invoking prereq "checkpatchapplicableoncurrentplatform"

Prereq "checkPatchApplicableOnCurrentPlatform" for patch 14772891 passed.

OPatch succeeded.

补丁包需要特殊.so文件验证

 

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq   CheckActiveFilesAndExecutables -phBaseDir ./

Oracle Interim Patch Installer version 11.2.0.3.19

Copyright (c) 2018, 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.19

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_03-06-50AM_1.log

Invoking prereq "checkactivefilesandexecutables"

Prereq "checkActiveFilesAndExecutables" for patch 14772891 passed.

OPatch succeeded.

在打补丁之前记得将单实例的数据库关闭,监听关闭

开始打补丁

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch apply

Oracle Interim Patch Installer version 11.2.0.3.19

Copyright (c) 2018, 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.19

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_01-52-01AM_1.log

Verifying environment and performing prerequisite checks...

OPatch continues with these patches:   14772891  

Do you want to proceed? [y|n]

y

User Responded with: Y

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.

Visit http://www.oracle.com/support/policies.html for details.

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

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.

(Oracle Home = '/u01/app/oracle/product/11.2.0/db_1')

Is the local system ready for patching? [y|n]

y

User Responded with: Y

Backing up files...

Applying interim patch '14772891' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms, 11.2.0.4.0...

Patch 14772891 successfully applied.

Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_01-52-01AM_1.log

OPatch succeeded.

 

验证补丁是否安装

 

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch lsinventory

Oracle Interim Patch Installer version 11.2.0.3.19

Copyright (c) 2018, 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.19

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_02-05-38AM_1.log

Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-04-19_02-05-38AM.txt

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

Local Machine Information::

Hostname: localhost

ARU platform id: 226

ARU platform description:: Linux x86-64

Installed Top-level Products (1):

Oracle Database 11g                                                  11.2.0.4.0

There are 1 products installed in this Oracle Home.

Interim patches (1) :

Patch  14772891 (这个才是回滚补丁需要的ID号)    : applied on Thu Apr 19 01:58:30 CST 2018

Unique Patch ID:  19443257

   Created on 12 Oct 2015, 21:22:04 hrs

   Bugs fixed:

     14772891

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

OPatch succeeded.

运行SQL脚本

 级数据库数据字典、编译无效对象  
数据库启动,并加载修改SQL Files到数据库

[oracle@11g opatch]$ sqlplus / as sysdba
SQL> startup;
-- 升级数据库数据字典
SQL> @?/rdbms/admin/catbundle.sql psu apply
省略大量输出
。。。。。。
SQL> SET echo off ## 输出末尾内容
Check the following log file for errors:
/home/oracle/app/cfgtoollogs/catbundle/catbundle_PSU_ORCL_APPLY_2015Feb16_13_42_57.log

--编译无效对象的脚本
SQL>@?/rdbms/admin/utlrp.sql

回滚补丁(打补丁成功和失败了都是可以回滚的)

[oracle@Database1 14772891]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch rollback -id 14772891

Oracle Interim Patch Installer version 11.2.0.3.19

Copyright (c) 2018, 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.19

OUI version       : 11.2.0.4.0

Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_02-31-27AM_1.log

Patches will be rolled back in the following order:

   14772891

The following patch(es) will be rolled back: 14772891  

Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.

(Oracle Home = '/u01/app/oracle/product/11.2.0/db_1')

Is the local system ready for patching? [y|n]

y

User Responded with: Y

Rolling back patch 14772891...

RollbackSession rolling back interim patch '14772891' from OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms, 11.2.0.4.0...

RollbackSession removing interim patch '14772891' from inventory

Log file location: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2018-04-19_02-31-27AM_1.log

OPatch succeeded.

下面是补丁解压出来的readme里面的内容

1)先决条件

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

在安装或卸载补丁程序之前,请确保您满足以下要求:

注意:如果是Oracle RAC环境,请在每个节点上满足这些先决条件。

1.确保要安装修补程序的Oracle主目录或Oracle数据库11g发行版(11.2.0.4.160119)。

2.确保11g 11.2.0.4.160119版补丁集更新(PSU)21948347已应用于Oracle数据库。

3. Oracle建议您使用适用于11g版本11.2.0.4.160119的最新版本的OPatch。如果您没有OPatch 11g版本11.2.0.4.160119或适用于XXg版本X的最新版本,请从修补程序#6880880下载11.2.0.4.160119版本。

有关OPatch文档的信息(包括任何已知问题),请参阅My Oracle Support文档293369.1 OPatch文档列表:

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=224346.1

4.确保您(作为家庭用户)将ORACLE_HOME环境变量设置为Oracle主目录。

5.确保$ PATH定义具有以下可执行文件:make,ar,ld和nm。这些可执行文件的位置取决于您的操作系统。在许多操作系统上,它们位于/ usr / ccs / bin中。

6.确保您验证Oracle Inventory,因为OPatch访问它来安装修补程序。要验证清单,请运行以下命令。如果该命令显示一些错误,请联系Oracle支持人员并解决问题。

$ opatch lsinventory

注意:

- 如果此命令成功,它将列出顶级Oracle产品和一次性修补程序(如果安装在Oralce Home中)。

- 保存输出,以便在补丁应用之前拥有状态。

- 如果该命令显示一些错误,则请与Oracle支持部门联系,并先解决该问题,然后再继续操作。

7.(仅用于安装)维护一个存储修补程序ZIP文件内容的位置。在文档的其余部分,这个位置(绝对路径)被称为<PATCH_TOP_DIR>。将补丁ZIP文件的内容解压到上面创建的位置(PATCH_TOP_DIR)。为此,请运行以下命令:

$ unzip -d <PATCH_TOP_DIR> p14772891_11204160119_Linux-x86-64.zip  

8.(仅限安装)确定当前安装的临时补丁是否与此补丁14772891相冲突,如下所示:

$ cd <PATCH_TOP_DIR> / 14772891

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

报告将指出与此修补程序相冲突的修补程序以及当前14772891是超集的修补程序。

注意:

OPatch启动时,它会验证该修补程序并确保与已安装在ORACLE_HOME中的软件没有冲突。OPatch将冲突分类为以下类型:

- 与已应用于ORACLE_HOME的修补程序发生冲突,该修补程序是您要应用的修补程序的子集 - 在这种情况下,请继续修补程序安装,因为新修补程序包含ORACLE_HOME中现有修补程序的所有修补程序。在安装新补丁程序之前,子集补丁程序将自动回滚。

- 与已应用于ORACLE_HOME的补丁发生冲突 - 在这种情况下,请停止补丁安装并联系Oracle支持服务。

9.(仅适用于脱机修补)确保关闭了从Oracle主目录运行的所有服务。

注意:

- 对于非RAC环境,请关闭与正在更新的Oracle主目录相关联的所有数据库和侦听器。有关更多信息,请参阅Oracle数据库管理员指南。

- 对于RAC环境,请关闭您要修补的节点的Oracle主目录中运行的所有服务(数据库,ASM,侦听器,节点应用程序和CRS守护进程)。修补此节点后,在此节点上启动服务。对Oracle RAC系统的每个其他节点重复此过程。一次只在一个节点上使用OPatch。

10.(仅限在线修补)确保Oracle主页中的所有服务都已启动并正在运行。

11.(仅适用于联机修补程序)确保在系统上保留足够的内存以应用此联机修补程序。要计算此联机修补程序所需的内存量,请使用以下公式:

内存消耗=(Oracle进程数+1)X(Patched .pch文件的大小)

注意:

- 对于UNIX,通过查询v $参数来检查数据库中的参数“processes”来确定Oracle进程的数量。对于Microsoft Windows,Oracle进程的数量始终为零(0)。

-  .pch文件位于<bug_number> / online / files / hpatch /目录下。

12.没有

2)安装

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

本节介绍可用于安装组合补丁程序的以下模式。使用最适合您要求的那个。

- 在离线模式下安装

- 在线模式下安装

2.1)以离线模式安装

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

要安装修补程序,请按照下列步骤操作:

1.将当前目录设置为修补程序所在的目录,然后通过输入以下命令来运行OPatch实用程序:

$ cd <PATCH_TOP_DIR> / 14772891

$ opatch apply

2.通过运行以下命令验证修补程序是否已成功安装:

$ opatch lsinventory

3.从Oracle主页启动服务。



猜你喜欢

转载自blog.csdn.net/qq_34556414/article/details/80182576