Oracle 11g 新特性 -- Online Patching (Hot Patching 热补丁)说明
一.官网说明
MOS 的文档:RDBMSOnline Patching Aka Hot Patching [ID 761111.1] 有说明。这里取部分内容。
A regular RDBMSpatch is comprised of one or more object (.o) files and/or libraries (.afiles). Installing a regular patch requires shuttingdown the RDBMS instance, re-linking the oracle binary, and restarting theinstance; uninstalling a regular patch requires the same steps.
On the otherhand, an online patch is a special kind of patch that can be applied to a live,running RDBMS instance. An online patch contains a single shared library; installing an online patch does not require shutting downthe instance or relinking the oracle binary. An online patch can beinstalled/un-installed using Opatch (which uses oradebug commands toinstall/uninstall the patch).
1.1 How does Online Patching differ than traditionalpatches?
--online patching 与传统patch 的区别:
1. Online patches are applied and removedfrom a running instance where traditional patches require the instances to beshutdown.
2. Online patches utilize the oradebug interface toinstall and enable the patches where traditional diagnostic patches arelinked into the "oracle" binary.
--online patch 使用oradebug 接口来install和 enable patches。
3. Online patches do not require the "oracle" binary to be relinkedwhere traditional diagnostic patches do.
4. There is additional memory consumption and processstart time penalty for online patches.
--online patch 需要消耗一些额外的内存和时间。
1.2 How Does the Online PatchMechanism Work ?
--online Patch 的工作机制
We firstconstruct a shared library that contains the relevant fixes and/or diagnostics.When we need to install the online patch, we use oradebug commands to tell eachoracle process to perform several steps:
--首先构造一个包含相关的fix或者diagnostics的shared library,当安装online patch时,使用oradebug 命令来通知每个oracle 进程按如下步骤进行切换:
1. Map the shared library into theiraddress space.
2. For each modified function in the patch, change theoriginal function in the text segment so that it performs a jump/branch to the"new" version in the shared library.
3. If the patched code references static variables inthe binary, have these references resolve to the right memory location.
4. If the patched code references static functions inthe binary, have these references resolve to the right memory location.
Uninstalling an online patch is the undoing of step 2: weremove the jumps/branches from the text segment and restore the originalinstructions.
1.3 Required Support from the OS
OnlinePatching requires two major items of support from an OS:
--Online Patching 主要需要OS 2方面的支持:
1. Ability to change protections on text segment pages andmodify these pages - For example, Linux x86 32-bit and Solaris 64-bitprovide COW (copy-on-write) semantics for text pages: once a text page is modifiedby a process, that process now has a private copy of that page. Note that theimplementation currently assumes COW-like semantics: it is not designed to workon an OS which provides the ability for one process to modify a text page suchthat this change affects all other processes which are sharing the sameimage/binary.
2. Support for shared libraries or DLLs - Online patchingrequires the ability to "bundle" modified code into a shared libraryor DLL such that it can be dynamically loaded by oracle processes. Ideally, theoracle binary should also be linked in such a way that shared libraries canrefer to global functions and variables in the binary; for example, on Linux,the oracle binary is linked with the "--export-dynamic" flag. (Currently,the mkpatch utility assumes that nothing special needs to be done when apatch's shared library has references to global functions/variables in thebinary; it is assumed that the dynamic loader will handle this when the sharedlibrary is loaded.)
Currently SupportedPlatforms:
Online patching iscurrently supported on these platforms/systems:
01 HP-UX Itanium.............................. ( requries OS Patch HPUX 11iv3 (11.31) + [March2008 Quality Pack + PHKL_38038] )
02 IBM AIX on POWER Systems (64-bit) .. ( requires AIX 6.1 + TL-02 +SP-01 onwards )
03 IBM: Linux on POWER Systems
04 IBM: Linux on System z
05 Linux x86
06 Linux x86-64
07 Microsoft Windows x86 (32-bit) .......... ( requires Opatch toolversion 11.2.0.1.1 )
08 Microsoft Windows x86-64 (64-bit)
09 Oracle Solaris on SPARC (64-bit) ........ ( requires SunOS kernelpatch 137111-04 )
10 Oracle Solaris on x86-64 (64-bit) ........ ( requires kernel patch137112-04 )
11 HP-PARISC Notsupported
12 Windows/Itanium Not supported
1.4 OPatch - How are Online Patches Installed?
OPatch is the recommended (Oracle-supplied)tool that customers are supposed to use in order to apply or rollback patches.It maintains an inventory of patches, and ensures that two conflicting patchesare not simultaneously installed. OPatch was recently modified to supportonline patches, which means that it can apply/rollback online patches, as wellas detect conflicts between any two kinds of patches. As such, it is notnecessary for customers to execute the "oradebug patch" commands;OPatch does this.
--Oracle 推荐使用OPatch来安装。
All OPatch versions after 11.1.0.6 areOnline Patch aware.
The syntax to install an Online Patch is:
opatch apply online-connectString <SID>:<USERNAME>:<PASSWORD>:<NODE>
example:
$ opatch apply online -connectStringdb11202:sys:oracle -invPtrLoc/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
For RAC you can list allof the instances:
opatch apply online -connectString<SID>:<USERNAME>:<PASSWORD>:<NODE1>,<SID2>:<USERNAME>:<PASSWORD>:<NODE2>,...
The USERNAME and PASSWORD are those of a user that hasSYSDBA privileges. The USERNAME and PASSWORD can be left blank if the OSuser applying the patch has the SYSDBA privilege. Also the NODE is optional ifthe patch is being applied locally.
--USERNAME 和PASSWORD 需要SYSDBA 权限,或者留空,使用OS 认证。
1.5 How to disable or remove the fix from some SIDs
If you want disable or remove the fix forsome SIDs, You need to use the opatch util DisableOnlinePatch as following :
opatch utilDisableOnlinePatch -connectString<SID>:<USERNAME>:<PASSWORD>:<NODE> -ph Patch location
-ph 参数:
Specify the valid patch directory area. This utility will disable the givenpatch in the database instances.
for details, see:
opatch util DisableOnlinePatch -help
example:
opatch util DisableOnlinePatch -connectString OP1:sys:manager: -ph/home/oracle/10188727/online
(...)
Invoking utility "disableonlinepatch"
Disabling and removing online patch 'bug10188727.pch', on database 'OP2'
OPatch succeeded.
Note:
the presence of "/online" at the end of "valid patch directoryarea"
from the alert.log
Wed Nov 09 12:47:51 2011
Patch bug10188727.pch Disabled - Update #3
Patch bug10188727.pch Removed - Update #4
Wed Nov 09 12:47:53 2011
Online patch bug10188727.pch has been disabled
Online patch bug10188727.pch has been removed
from oradebug:
SQL> oradebug patchlist
Patch File Name State
================ =========
bug10188727.pch REMOVED
1.6 How do I know which patches are eligible to be appliedonline?
--如何判断patch 是online patch
If the fix is online patchable there will be directory online that is created.Also the readme will contain the information regarding this, always read thereadme file when applying a patch for any new information or informationrelated to that specific patch.
--如果是online patch,那么patch里会包含一个目录,叫online,并且也可以查看readme 文件。
Example:
$ cd <PATCH_TOP>/10188727
$ ls
etc/ files/ online/ README.txt
$ tree online
online
|-- [embde 4096] etc
| |-- [embde 4096] config
| | |-- [embde 290] actions.xml
| | |-- [embde 22] deploy.xml
| | `-- [embde 1326] inventory.xml
| `-- [embde 4096] xml
| |-- [embde 5376] GenericActions.xml
| `-- [embde 1663] ShiphomeDirectoryStructure.xml
`-- [embde 4096] files
`-- [embde 4096] hpatch
`-- [embde 177874] bug10188727.pch
The better way to check if a patch is online is to use the following command
--最好的方法是使用如下命令来检查是否是online patch:
$ cd <PATCH_TOP>/10188727
$ opatch query -all online
(...)
--------------------------------------------------------------------------------
Patch created on 2 Dec 2010, 01:44:15 hrs PST8PDT
Need to shutdown Oracle instances: false
Patch is roll-backable: true
Patch is a "Patchset Update": false
Patch is a rolling patch: true
Patch has sql related actions: false
Patch is anonline patch: true
Patch is a portal patch: false
Patch is an "auto-enabled" patch: false
List of platforms supported:
226: Linux x86-64
List of bugs to be fixed:
10188727: AFTER UPGRADING TO 11.2.0.2 SOME SQLS FAIL WITH ORA-7445[KKEIDC()+180] ERROR
This patch is a "singleton" patch.
This patch belongs to the "db" product family
List of executables affected:
ORACLE_HOME/bin/oracle
List of optional components:
oracle.rdbms: 11.2.0.2.0
List of optional actions:
Patch the Database instances with Online Patch hpatch/bug10188727.pch
Possible XML representation of the patch:
<ONEOFF REF_ID="10188727" ROLLBACK="T"XML_INV_LOC="oneoffs/10188727/" ACT_INST_VER="11.2.0.2.0"INSTALL_TIME="2011.Nov.09 16:42:02 CET">
<DESC></DESC>
<REF_LIST>
<REF NAME="oracle.rdbms" VER="11.2.0.2.0"HOME_IDX="0"/>
</REF_LIST>
<BUG_LIST>
<BUGS>10188727</BUGS>
</BUG_LIST>
<FILE_LIST/>
</ONEOFF>
--------------------------------------------------------------------------------
1.7 How are Online Patches rollback'ed?
--如何回滚onlinePatch:
Using "opatch" you can rollbackthe patch:
--使用如下命令:
opatch rollback -id <patchID> -connectString<SID>:<USERNAME>:<PASSWORD>:<NODE1>,<SID2>:<USERNAME>:<PASSWORD>:<NODE2>,...
The USERNAME and PASSWORD are those of a user that has SYSDBA privileges. TheUSERNAME and PASSWORD can be left blank if the OS user applying the patch hasthe SYSDBA privilege. Also the NODE is optional if the patch is being appliedlocally.
Using opatch does not remove the patch, it simply disables it (rolls it back)and removes the patch entry from the inventory. This behavior may change in thefuture.
--使用opatch命令不会remove 这个patch,它是简单的disable online patch并从inventory中移除patch entry。 在以后的版本中可能会改变这种方式。
Example:
$ opatch rollback -id10188727 -connectString db11202:sys:oracle -invPtrLoc/u01/app/oracle/product/11.2.0/dbhome_1/oraInst.loc
Invoking OPatch 11.2.0.1.4
Oracle Interim Patch Installer version 11.2.0.1.4
Copyright (c) 2010, 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.1.4
OUI version : 11.2.0.2.0
OUI location :/u01/app/oracle/product/11.2.0/dbhome_1/oui
Log file location :/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2011-01-27_16-21-59PM.log
Patch history file:/u01/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt
RollbackSession rolling back interim patch '10188727' from OH'/u01/app/oracle/product/11.2.0/dbhome_1'
The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.
Running prerequisite checks...
OPatch detected non-cluster Oracle Home from the inventory and will patch thelocal system only.
Backing up files affected by the patch '10188727' for restore. This might takea while...
Patching component oracle.rdbms, 11.2.0.2.0...
The patch will be removed from active database instances.
Disabling and removing online patch 'bug10188727.pch', on database 'db11202'
RollbackSession removing interim patch '10188727' from inventory
OPatch succeeded.
------------------------------
On the Alert.log:
(...)
Thu Jan 27 16:22:07 2011
Patch bug10188727.pch Disabled - Update #3
Patch bug10188727.pch Removed - Update #4
Thu Jan 27 16:22:08 2011
Online patch bug10188727.pch has been disabled
Online patch bug10188727.pch has been removed
Others not recommended way are:
--还有2种不推荐的方法:
1. Using "oradebug" to disablethe patch
SQL> oradebugpatch disable <patch_id>.pch
2. Shutting theinstance down and removing the orapatch*.cfg file. After stopping theinstance do the following:
cd $ORACLE_HOME/hpatch
rm orapatch$ORACLE_SID.cfg
Removing the orapatch*.cfg removes all of the online patches currentlyinstalled for the instance.
Note:
its recommended to rollback only when the online patch is not required for anydatabases in the same ORACLE_HOME.
In case you have done a rollback the online patch can be disabled only by -phoption for the other SID's (see How to disable or remove the fix from someSIDs)
二.Online Patching 说明
说明:该部分内容摘自OCP 050 教材。
在Oracle 11g中提出了online patch(也叫hot patch)的特性;Hot patching允许我们在实例始终在线的情况下安装,启用或禁用一个修复补丁(fix)或者诊断补丁(diagnostic patches)。
使用热补丁可以安装、启用和禁用正在运行的活动Oracle 实例上的bug 修复或诊断补丁程序。使用热补丁是可在应用热补丁程序时避免停机的建议解决方案。Oracle 提供了使用opatch 命令行实用程序对任何Oracle 数据库进行热补丁的功能。如果代码的更改范围和复杂性都较小(例如,诊断补丁程序或小型bug 修复),则可提供热补丁程序。
2.1 安装热补丁程序
(1) 应用热补丁程序不需要关闭实例、重新链接Oracle二进制文件或重新启动实例。
(2) OPatch 可用于安装或卸载热补丁程序。
(3) OPatch 可以检测两个热补丁程序之间以及热补丁程序与常规补丁程序之间的冲突。
可以使用以下命令来确定某个补丁程序是否为热补丁程序:
opatch query -is_online_patch <patchlocation> or
opatch query <patch location> -all
注:
打过补丁的代码将作为动态/共享库提供,该库随后会被每个Oracle 进程映射至内存中。
(关于热补丁的机制可以参考1.2 节的内容。)
2.2 热补丁的优点
(1) 无停机时间,不中断业务
(2) 安装和卸载速度极快
(3) 与OPatch 集成:
检测冲突
在补丁程序清单中列出
在RAC 环境中工作
(4) 虽然不改变磁盘上的Oracle二进制文件,但热补丁程序在实例关闭和启动时都保持有效。
2.3 常规补丁和热补丁
常规补丁基本上要求关闭数据库实例。
热补丁不需要任何停机时间。在安装热补丁时,应用程序可以继续运行。
同样的,无需停机便可卸载已安装的热补丁程序。
常规补丁和热补丁的对比,如下图:
2.4 热补丁注意事项
(1)可能不是所有平台上都有热补丁程序。当前在以下平台上有热补丁程序:
– Linux x86
– Linux x86-64
– Solaris SPARC64
--这个具体可以参考:1.3 小节。
(2)要消耗一些额外的内存。
– 确切的内存数取决于:
— 补丁程序的大小
— 当前运行的Oracle 进程数
– 最小内存数:每个Oracle 进程大约占一个OS 页面
如:一个操作系统(OS) 页面在Linux x86 上一般为4 KB,在和Solaris SPARC64 上为8 KB。
在平均大约一千个Oracle 进程同时运行的情况下,这意味着一个小型的热补丁程序大约额外占用4 MB 内存。
(3) 在每个Oracle 进程安装或卸载热补丁程序之前,可能会有一段极短的延迟(几秒)。
(4) 并非所有bug 修复和诊断补丁程序都可用作热补丁程序。
极大部分诊断补丁程序可作为热补丁程序提供。对于bug 修复,则具体取决于其性质。并非每个bug 修复或诊断补丁程序都可用作热补丁程序。但热补丁工具的长期目标是为关键补丁程序更新提供热补丁功能。
(5) 不能在停机时间使用热补丁程序。
(6) 如果可能有停机时间,则应以常规补丁程序方式安装所有相关的bug 修复。
三. Online Patch 操作示例
测试环境是11.2.0.3:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE 11.2.0.3.0 Production
TNS for Linux: Version 11.2.0.3.0 -Production
NLSRTL Version 11.2.0.3.0 – Production
Google了一下,找了一个对应版本的onlinepatch:
Oracle online patching for bug 13817131(backport for ORA-7445 near ksfqfcrx()+X during RMAN backups)
http://jakub.wartak.pl/blog/?p=624
这里用online patch:13817131的相关操作为例。
3.1 解压缩:
[oracle@dave u01]$ unzipp13817131_112030_Linux-x86-64.zip
Archive: p13817131_112030_Linux-x86-64.zip
creating: 13817131/
creating: 13817131/etc/
creating: 13817131/etc/xml/
inflating: 13817131/etc/xml/ShiphomeDirectoryStructure.xml
inflating: 13817131/etc/xml/GenericActions.xml
creating: 13817131/etc/config/
inflating: 13817131/etc/config/inventory.xml
inflating: 13817131/etc/config/actions.xml
inflating: 13817131/etc/config/deploy.xml
creating: 13817131/online/
creating: 13817131/online/files/
creating: 13817131/online/files/hpatch/
inflating: 13817131/online/files/hpatch/bug13817131.pch
creating: 13817131/online/etc/
creating: 13817131/online/etc/xml/
inflating: 13817131/online/etc/xml/GenericActions.xml
inflating: 13817131/online/etc/xml/ShiphomeDirectoryStructure.xml
creating: 13817131/online/etc/config/
inflating: 13817131/online/etc/config/actions.xml
inflating: 13817131/online/etc/config/deploy.xml
inflating: 13817131/online/etc/config/inventory.xml
creating: 13817131/files/
creating: 13817131/files/lib/
creating: 13817131/files/lib/libserver11.a/
inflating: 13817131/files/lib/libserver11.a/ksfq.o
inflating: 13817131/README.txt
3.2 查看Patch 类型
3.2.1 用树形结构看一下:如果是online patch,会有online 的目录:
[oracle@dave u01]$ ls
13817131 dave dave2.trc p13817131_112030_Linux-x86-64.zip rcopy.sh rename.sh
app dave1.trc nohup.out rcopy.out rcopy.sh.out
[oracle@dave u01]$ tree 13817131
13817131
|-- etc
| |-- config
| | |-- actions.xml
| | |-- deploy.xml
| | `-- inventory.xml
| `-- xml
| |-- GenericActions.xml
| `-- ShiphomeDirectoryStructure.xml
|-- files
| `-- lib
| `-- libserver11.a
| `-- ksfq.o
|-- online
| |-- etc
| | |-- config
| | | |-- actions.xml
| | | |-- deploy.xml
| | | `-- inventory.xml
| | `-- xml
| | |-- GenericActions.xml
| | `--ShiphomeDirectoryStructure.xml
| `-- files
| `-- hpatch
| `-- bug13817131.pch
`-- README.txt
12 directories, 13 files
3.2.2 使用opatch 查看patch 类型:
[oracle@dave u01]$ mv 13817131/u01/app/oracle/product/11.2.0/db_1/OPatch
[oracle@dave u01]$ cd/u01/app/oracle/product/11.2.0/db_1/OPatch
[oracle@dave OPatch]$ ls
13817131 emdpatch.pl jlib opatch opatch.ini opatchprereqs
docs fmw ocm opatch.bat opatch.pl
[oracle@dave OPatch]$ ./opatch query 13817131 -all
Invoking OPatch 11.2.0.1.7
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-00-40????.log
--------------------------------------------------------------------------------
Patch created on 25 Sep 2012, 08:46:37 hrsPST8PDT
Needto shutdown Oracle instances: true
Patch is roll-backable: true
Patch is a "Patchset Update": false
Patch is a rolling patch: true
Patch has sql related actions: false
Patch is an online patch: false
Patch is a portal patch: false
Patch is an "auto-enabled" patch:false
Listof platforms supported:
226: Linux x86-64
Listof bugs to be fixed:
13817131: OAM ORA-7445-[KSFQFCRX()+812] [SIGSEGV] [ADDR 0X8 ]
Thispatch is a "singleton" patch.
Thispatch belongs to the "db" product family
Listof executables affected:
ORACLE_HOME/bin/oracle
Listof optional components:
oracle.rdbms: 11.2.0.3.0
Listof optional actions:
Update /u01/app/oracle/product/11.2.0/db_1/lib/libserver11.a with/ksfq.o
cd/u01/app/oracle/product/11.2.0/db_1/rdbms/lib
; make -f ins_rdbms.mk ioracleORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
Possible XML representation of the patch:
<ONEOFF REF_ID="13817131"ROLLBACK="T" XML_INV_LOC="oneoffs/13817131/"ACT_INST_VER="11.2.0.3.0" INSTALL_TIME="2012.Oct.09 19:00:40CST">
<DESC></DESC>
<REF_LIST>
<REF NAME="oracle.rdbms" VER="11.2.0.3.0"HOME_IDX="0"/>
</REF_LIST>
<BUG_LIST>
<BUG>13817131</BUG>
</BUG_LIST>
<FILE_LIST/>
</ONEOFF>
--------------------------------------------------------------------------------
OPatch succeeded.
这里显示为False。 用opatch is_online_patch 查看:
[oracle@dave OPatch]$ ./opatch query -is_online_patch 13817131
Invoking OPatch 11.2.0.1.7
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-02-47????.log
--------------------------------------------------------------------------------
Patch is an online patch: false
OPatch succeeded.
这里显示的还是为False,但实际上,我们的Patch 确实是online 的patch。
3.3 应用Patch并确认Online Patch 对内存的消耗:
安装online patch需要额外的消耗一些内存资源,所以这里我们验证一下:
--查看pmon 进程的内存消耗:
[oracle@dave 13817131]$ ps -ef|grep pmon|grep-v grep
oracle 2118 1 0 15:15 ? 00:00:13 ora_pmon_dave
[oracle@dave 13817131]$ pmap -d 2118 |tail -20
00007fb4ef13a000 1020 ----- 0000000000289000 008:00003libnnz11.so
00007fb4ef239000 264 rwx-- 0000000000288000 008:00003libnnz11.so
00007fb4ef27b000 12 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef28d000 4 rwxs- 0000000000000000 008:00003hc_dave.dat
00007fb4ef28e000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef290000 864 r-x-- 0000000000000000 008:00003libskgxp11.so
00007fb4ef368000 1024 ----- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef468000 8 rwx-- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef46a000 392r-x-- 0000000000000000 008:00003 libcell11.so
00007fb4ef4cc000 1024 ----- 0000000000062000 008:00003libcell11.so
00007fb4ef5cc000 40 rwx-- 0000000000062000 008:00003libcell11.so
00007fb4ef5d6000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef5d8000 4 r-x-- 0000000000000000 008:00003libodmd11.so
00007fb4ef5d9000 1024 ----- 0000000000001000 008:00003libodmd11.so
00007fb4ef6d9000 4 rwx-- 0000000000001000 008:00003libodmd11.so
00007fb4ef6da000 4 rwx-- 0000000000000000 000:00000 [ anon ]
00007ffff0261000 132 rwx-- 0000000000000000 000:00000 [ stack ]
00007ffff03f6000 4 r-x-- 0000000000000000 000:00000 [ anon ]
ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 958080K writeable/private: 8056K shared: 720900K
--安装Patch:
oracle@dave 13817131]$ opatch apply online -connectString dave:sys:oracle
Invoking OPatch 11.2.0.1.7
Oracle 中间补丁程序安装程序版本11.2.0.1.7
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-10-51下午.log
补丁程序只应在 '-all_nodes' 模式下应用/回退。
将 RAC 模式转换为'-all_nodes' 模式。
Applying interim patch '13817131' to OH'/u01/app/oracle/product/11.2.0/db_1'
Verifying environment and performingprerequisite checks...
是否继续? [y|n]
y
User Responded with: Y
All checks passed.
Backing up files...
正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
The patch will be installed on activedatabase instances.
正在数据库 'dave' 上安装和启用联机补丁程序 'bug13817131.pch'。
Patch 13817131 successfully applied
Log file location:/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-10-51下午.log
OPatch succeeded.
--查看alert log:
Tue Oct 09 19:11:05 2012
Patch file bug13817131.pch is out of syncwith oracle binary; performing fixup
Patch file bug13817131.pch has been syncedwith oracle binary
Patch bug13817131.pchInstalled - Update #1
Patch bug13817131.pchEnabled - Update #2
Tue Oct 09 19:11:07 2012
Online patch bug13817131.pch has beeninstalled
Online patch bug13817131.pch has beenenabled
--再次查看pmon 进程的内存:
[oracle@dave trace]$ ps -ef|grep pmon|grep-v grep
oracle 2118 1 0 15:15 ? 00:00:14 ora_pmon_dave
[oracle@dave trace]$ pmap -d 2118|tail -20
00007fb4ef239000 264 rwx-- 0000000000288000 008:00003libnnz11.so
00007fb4ef27b000 12 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef28c000 4 r-x-- 000000000c955000 008:00003oracle
00007fb4ef28d000 4 rwxs- 0000000000000000 008:00003hc_dave.dat
00007fb4ef28e000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef290000 864 r-x-- 0000000000000000 008:00003libskgxp11.so
00007fb4ef368000 1024 ----- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef468000 8 rwx-- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef46a000 392r-x-- 0000000000000000 008:00003 libcell11.so
00007fb4ef4cc000 1024 ----- 0000000000062000 008:00003libcell11.so
00007fb4ef5cc000 40 rwx-- 0000000000062000 008:00003libcell11.so
00007fb4ef5d6000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef5d8000 4 r-x-- 0000000000000000 008:00003libodmd11.so
00007fb4ef5d9000 1024 ----- 0000000000001000 008:00003libodmd11.so
00007fb4ef6d9000 4 rwx-- 0000000000001000 008:00003libodmd11.so
00007fb4ef6da000 4 rwx-- 0000000000000000 000:00000 [ anon ]
00007ffff0261000 132 rwx-- 0000000000000000 000:00000 [ stack ]
00007ffff03f6000 4 r-x-- 0000000000000000 000:00000 [ anon ]
ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 964344K writeable/private: 8068K shared: 720900K
--安装Patch 之前是:
mapped: 958080K writeable/private: 8056K shared: 720900K。
private 内存增加了 8k。
--并且安装之后,从pmon 进程的内存中,可以看到多出如下3个库文件:
[oracle@davetrace]$ pmap -d 2118|grep 13817131
00007fb4ecf66000 168 r-x-- 0000000000000000 008:00003bug13817131.so
00007fb4ecf90000 1020 ----- 000000000002a000 008:00003bug13817131.so
00007fb4ed08f000 12 rwx-- 0000000000029000 008:00003bug13817131.so
3.4 使用oradebug 来禁用patch
在1.7 小节提到了2种Oracle 不推荐的,使用oradebug 来禁用online patch的方法。 我们这里测试一下。
(1)使用Oradebug
SQL> oradebug patch list
Patch File Name State
================ =========
bug13817131.pch ENABLED
SQL> oradebugpatch disable bug13817131.pch
Statement processed.
SQL> oradebug patch list
Patch File Name State
================ =========
bug13817131.pch DISABLED
注意,这种方法不会释放安装onlinepatch 时消耗的额外内存。
[oracle@dave trace]$ pmap -d 2118|tail-20
00007fb4ef239000 264 rwx-- 0000000000288000 008:00003libnnz11.so
00007fb4ef27b000 12 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef28c000 4 r-x-- 000000000c955000 008:00003oracle
00007fb4ef28d000 4 rwxs- 0000000000000000 008:00003hc_dave.dat
00007fb4ef28e000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef290000 864 r-x-- 0000000000000000 008:00003libskgxp11.so
00007fb4ef368000 1024 ----- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef468000 8 rwx-- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef46a000 392 r-x-- 0000000000000000 008:00003libcell11.so
00007fb4ef4cc000 1024 ----- 0000000000062000 008:00003libcell11.so
00007fb4ef5cc000 40 rwx-- 0000000000062000 008:00003libcell11.so
00007fb4ef5d6000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef5d8000 4 r-x-- 0000000000000000 008:00003libodmd11.so
00007fb4ef5d9000 1024 ----- 0000000000001000 008:00003libodmd11.so
00007fb4ef6d9000 4 rwx-- 0000000000001000 008:00003libodmd11.so
00007fb4ef6da000 4 rwx-- 0000000000000000 000:00000 [ anon ]
00007ffff0261000 132 rwx-- 0000000000000000 000:00000 [ stack ]
00007ffff03f6000 4 r-x-- 0000000000000000 000:00000 [ anon ]
ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 964344K writeable/private: 8068K shared: 720900K
--使用oradebug enable patch:
SQL> oradebug patch enablebug13817131.pch
Statement processed.
SQL> oradebug patch list
Patch File Name State
================ =========
bug13817131.pch ENABLED
(2)关闭实例并移除配置文件
Shutting the instancedown and removing the orapatch*.cfg file. Afterstopping the instance do the following:
cd $ORACLE_HOME/hpatch
rm orapatch$ORACLE_SID.cfg
--这里强调是关闭实例在操作,否则可能会出现其他意外情况。
Removing the orapatch*.cfg removes all of the online patches currentlyinstalled for the instance.
--该方法会移除所有online patch:
[oracle@dave db_1]$ cd hpatch/
[oracle@dave hpatch]$ pwd
/u01/app/oracle/product/11.2.0/db_1/hpatch
[oracle@dave hpatch]$ ls
bug13817131.pch bug13817131.pchdave.fixup bug13817131.so orapatchdave.cfg
3.5 rollback patch
语法参考1.7 小节。
[oracle@dave db_1]$ opatch rollback -id 13817131 -connectString dave:sys:oracle
Invoking OPatch 11.2.0.1.7
Oracle 中间补丁程序安装程序版本11.2.0.1.7
版权所有 (c) 2011, Oracle Corporation。保留所有权利。
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.7
OUI version : 11.2.0.3.0
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-32-31下午.log
RollbackSession 从OH '/u01/app/oracle/product/11.2.0/db_1' 回退中间补丁程序'13817131'
补丁程序只应在 '-all_nodes' 模式下应用/回退。
将 RAC 模式转换为'-all_nodes' 模式。
正在为组件 oracle.rdbms, 11.2.0.3.0 打补丁...
The patch will be removed from activedatabase instances.
正在数据库 'dave' 上禁用和删除联机补丁程序 'bug13817131.pch'
RollbackSession 从产品清单中删除中间补丁程序 '13817131'
Log file location:/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2012-10-09_19-32-31下午.log
OPatch succeeded.
--alert log信息:
Tue Oct 09 19:32:41 2012
Patch bug13817131.pch Disabled - Update #5
Patch bug13817131.pch Removed - Update #6
Tue Oct 09 19:32:44 2012
Online patchbug13817131.pch has been disabled
Online patchbug13817131.pch has been removed
--查看PMON进程对内存的消耗:
[oracle@dave trace]$ pmap -d 2118|tail-20
00007fb4ef239000 264 rwx-- 0000000000288000 008:00003libnnz11.so
00007fb4ef27b000 12 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef28c000 4 r-x-- 000000000c955000 008:00003oracle
00007fb4ef28d000 4rwxs- 0000000000000000 008:00003 hc_dave.dat
00007fb4ef28e000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef290000 864 r-x-- 0000000000000000 008:00003libskgxp11.so
00007fb4ef368000 1024 ----- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef468000 8 rwx-- 00000000000d8000 008:00003libskgxp11.so
00007fb4ef46a000 392 r-x-- 0000000000000000 008:00003libcell11.so
00007fb4ef4cc000 1024 ----- 0000000000062000 008:00003libcell11.so
00007fb4ef5cc000 40 rwx-- 0000000000062000 008:00003libcell11.so
00007fb4ef5d6000 8 rwx-- 0000000000000000 000:00000 [ anon ]
00007fb4ef5d8000 4 r-x-- 0000000000000000 008:00003libodmd11.so
00007fb4ef5d9000 1024 ----- 0000000000001000 008:00003libodmd11.so
00007fb4ef6d9000 4 rwx-- 0000000000001000 008:00003libodmd11.so
00007fb4ef6da000 4 rwx-- 0000000000000000 000:00000 [ anon ]
00007ffff0261000 132 rwx-- 0000000000000000 000:00000 [ stack ]
00007ffff03f6000 4 r-x-- 0000000000000000 000:00000 [ anon ]
ffffffffff600000 4 r-x-- 0000000000000000 000:00000 [ anon ]
mapped: 964344K writeable/private: 8068K shared: 720900K
这里我们使用oradebugdisable 和opatch rollback 都不会释放安装online patch 消耗的额外内存。当然重启实例之后,这些内存自会释放。
About Me
.............................................................................................................................................
● 本文转载自:http://blog.csdn.net/tianlesoftware/article/details/8214412
● 本文在itpub(http://blog.itpub.net/26736162/abstract/1/)、博客园(http://www.cnblogs.com/lhrbest)和个人微信公众号(xiaomaimiaolhr)上有同步更新
● 本文itpub地址:http://blog.itpub.net/26736162/abstract/1/
● 本文博客园地址:http://www.cnblogs.com/lhrbest
● 本文pdf版、个人简介及小麦苗云盘地址:http://blog.itpub.net/26736162/viewspace-1624453/
● 数据库笔试面试题库及解答:http://blog.itpub.net/26736162/viewspace-2134706/
● DBA宝典今日头条号地址:http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826
.............................................................................................................................................
● QQ群号:230161599(满)、618766405
● 微信群:可加我微信,我拉大家进群,非诚勿扰
● 联系我请加QQ好友(646634621),注明添加缘由
● 于 2017-11-01 09:00 ~ 2017-11-30 22:00 在魔都完成
● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解
● 版权所有,欢迎分享本文,转载请保留出处
.............................................................................................................................................
● 小麦苗的微店:https://weidian.com/s/793741433?wfr=c&ifr=shopdetail
● 小麦苗出版的数据库类丛书:http://blog.itpub.net/26736162/viewspace-2142121/
.............................................................................................................................................
使用微信客户端扫描下面的二维码来关注小麦苗的微信公众号(xiaomaimiaolhr)及QQ群(DBA宝典),学习最实用的数据库技术。
小麦苗的微信公众号 小麦苗的DBA宝典QQ群2 《DBA笔试面宝典》读者群 小麦苗的微店
.............................................................................................................................................