日期:2014-05-16  浏览次数:20483 次

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 suc