Online Patching with opatch


Online patching is available since 11.1.0.6. It will be delivered starting with RDBMS 11.2.0.2.0.

Here I’m going to demonstrate such a online patching process:

Environment:
Linux Fedora 19, x86_64 –> 12.1.0.1.0 for Linux x86_64

ORACLE_SID=CDB12C
ORACLE_HOME=/opt/oracle/app/product/12.1.0/dbhome_1
PATH=/opt/oracle/app/product/12.1.0/dbhome_1/bin:/opt/oracle/app/product/12.1.0/dbhome_1/OPatch:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin

1. Check actual patch state

[bash]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2013-07-13_07-14-28AM_1.log

Lsinventory Output file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-07-13_07-14-28AM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1): 

Oracle Database 12c                                                  12.1.0.1.0
There are 1 products installed in this Oracle Home.

There are no Interim patches installed in this Oracle Home.

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

OPatch succeeded.

2. Switch to extracted patch location:

[bash]$ cd /tmp/16527374

3. Patch with online method

Install the patch by running the following command:

  • For Non-RAC Environments (Standalone Databases)
    $ opatch apply online -connectString <SID>:<USERNAME>:<PASSWORD>:
  • For RAC Environments
    $ opatch apply online -connectString <SID_Node1>:<Username_Node1>:<Password_Node1>:<Node1_Name>,<SID_Node2>:<Username_Node2>:<Password_Node2>:<Node2_Name>,<SID_NodeN>:<Username_NodeN>:<Password_NodeN>:<NodeN_Name>
[bash]$ opatch apply online -connectString CDB12C:sys:<password>:
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/16527374_Jul_13_2013_07_15_42/apply2013-07-13_07-15-41AM_1.log

The patch should be applied/rolled back in '-all_nodes' mode only.
Converting the RAC mode to '-all_nodes' mode.
Applying interim patch '16527374' to OH '/opt/oracle/app/product/12.1.0/dbhome_1'
Verifying environment and performing prerequisite checks...
All checks passed.
Backing up files...

Patching component oracle.rdbms, 12.1.0.1.0...
Installing and enabling the online patch 'bug16527374.pch', on database 'CDB12C'.

Verifying the update...
Patch 16527374 successfully applied
Log file location: /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/16527374_Jul_13_2013_07_15_42/apply2013-07-13_07-15-41AM_1.log

OPatch succeeded.

4. Verify opatch inventory

[bash]$ opatch lsinventory
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2013-07-13_07-16-18AM_1.log

Lsinventory Output file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2013-07-13_07-16-18AM.txt

--------------------------------------------------------------------------------
Installed Top-level Products (1): 

Oracle Database 12c                                                  12.1.0.1.0
There are 1 products installed in this Oracle Home.

Interim patches (1) :

Patch (online) 16527374: applied on Thu Jul 13 07:15:45 CEST 2013
Unique Patch ID:  16551736
   Created on 12 Jul 2013, 13:23:36 hrs PST8PDT
   Bugs fixed:
     16527374

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

OPatch succeeded.

5. Verify alertlog of database:

Thu Jul 13 07:15:45 2013
Patch file bug16527374.pch is out of sync with oracle binary; performing fixup
Patch file bug16527374.pch has been synced with oracle binary
Thu Jul 13 07:15:45 2013
Patch bug16527374.pch Installed - Update #1
Thu Jul 13 07:15:45 2013
Patch bug16527374.pch Enabled - Update #2
Thu Jul 13 07:15:48 2013
Online patch bug16527374.pch has been installed
Online patch bug16527374.pch has been enabled

6. If you want to patch multiple instances with the same patch use the following per instance:

[bash]$ opatch util enableonlinepatch -connectString CDB12C2:sys:<password>: -id 16527374
Oracle Interim Patch Installer version 12.1.0.1.0
Copyright (c) 2012, Oracle Corporation.  All rights reserved.

Oracle Home       : /opt/oracle/app/product/12.1.0/dbhome_1
Central Inventory : /opt/oracle/oraInventory
   from           : /opt/oracle/app/product/12.1.0/dbhome_1/oraInst.loc
OPatch version    : 12.1.0.1.0
OUI version       : 12.1.0.1.0
Log file location : /opt/oracle/app/product/12.1.0/dbhome_1/cfgtoollogs/opatch/opatch2013-07-13_08-32-14AM_1.log

Invoking utility "enableonlinepatch"
Installing and enabling the online patch 'bug16527374.pch', on database 'CDB12C2'.

OPatch succeeded.

7. Verify enabled patch:

[bash]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Thu Jul 13 08:33:59 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> oradebug patch list

Patch File Name                                   State
================                                =========
bug16527374.pch                                  ENABLED

SQL>

Or again in alertlog:

Thu Jul 13 08:32:17 2013
Patch bug16527374.pch Installed - Update #1
Thu Jul 13 08:32:17 2013
Patch bug16527374.pch Enabled - Update #2
Thu Jul 13 08:32:18 2013
Online patch bug16527374.pch has been installed
Online patch bug16527374.pch has been enabled

For further information refer to my oracle support notice: RDBMS Online Patching Aka Hot Patching [ID 761111.1]

2 thoughts on “Online Patching with opatch

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s