Oracle out of place patching reduces database downtime

February 12, 2016 by 2 Comments 

To minimize downtime during patching of NON-RAC databases Out of Place Patching can be used. You can apply this approach to any Oracle patch starting from Oracle database 11g (11.2.0.2.0+) using OPatch utility. In this case time spent installing the software can be saved from the total database downtime required. However, some downtime is required for switching database services to the new Oracle database home and applying a post-upgrade script. A basic overview of the steps is below:

– Clone the existing database home online
– Apply required patch to the cloned database home using OPatch
– Switch the database services to the cloned database home
– Complete the post installation tasks for the patch applied

Notes:
– Oracle database 11g and 12c documentation describe DB_HOME cloning only in OFFLINE mode (when DB is down)
http://docs.oracle.com/cd/E11882_01/em.112/e12255/oui6_cloning.htm#OUICG298
http://docs.oracle.com/database/121/LADBI/app_cloning.htm#LADBI7853

– However, there should be no requirement to shutdown any databases, listeners, agents etc. that are running from the source home while cloning the Oracle Home directory because any processes that load the static binaries or libraries into memory should not hold a write lock.

– Oracle Out of Place patching is supported by SAP

– Out of Place patching is a recommended patching method that is used in out of the box deployment procedure of Oracle Enterprise Manager (OEM) Cloud Control 12c+ version

Oracle 12c database Out of Place patching reduce downtime

Oracle database Out of Place patching

Below we will use a combination of Oracle documentation, a few MOS Notes and a little bit of experience to manually conduct Out of Place patching of Oracle database 12c

# 1) Prepare the environment

export ORACLE_BASE=/oracle
export ORACLE_HOME_O=/oracle/product/12.1.0/dbhome_1
export ORACLE_HOME_C=/oracle/product/12.1.0/dbhome_2
export ORACLE_HOME=$ORACLE_HOME_O
export ORACLE_HOME_NAME_C=OraDB12Home2

# 2) Clone the existing Oracle Database home to the new location (same or remote)

mkdir $ORACLE_HOME_C
cd $ORACLE_HOME_O
# 2.A) Clone online $ORACLE_HOME_O to $ORACLE_HOME_C on the same server
tar cvfp – . –exclude=*.log –exclude=*.trc | ( cd $ORACLE_HOME_C; tar xvf – )

# 3) Clone the installation with OUI using Perl or OUI itself
# Tested on 12cR1
export ORACLE_HOME_C=/oracle/product/12.1.0/dbhome_2
$ORACLE_HOME/oui/bin/runInstaller -clone -silent -noconfig
-defaultHomeName ORACLE_BASE=$ORACLE_BASE ORACLE_HOME=$ORACLE_HOME_C oracle_install_OSDBA=dba oracle_install_OSOPER=oper

# 4) Run root.sh (as root) from the target home.
su –
/oracle/product/12.1.0/dbhome_2/root.sh

# 5) Patch the cloned Oracle Database home (with Oracle PSU example)
export ORACLE_HOME=$ORACLE_HOME_C
$ORACLE_HOME/OPatch/opatch lsinv –detail
cd /oracle/stage/DB.12/12.1.0.2.5-21359755
$ORACLE_HOME/OPatch/opatch apply

# 6) Switch database services to the cloned Oracle Database Home
# 6.1) Update new oracle_home in the /etc/oratab and any .profile files
# 6.2) Restart DB and listener from the cloned Oracle Database home
export ORACLE_HOME=$ORACLE_HOME_O
lsnrctl stop
sql> shutdown immediate

export ORACLE_HOME=$ORACLE_HOME_C
. oraenv
lsnrctl start
sql> startup

# 7) Complete the Patch post installation steps (do not forget Oracle patch prerequisite check)
./datapatch –verbose

# 8) Cleanup the old Oracle Database home
export ORACLE_HOME=$ORACLE_HOME_O
$ORACLE_HOME/oui/bin/detachHome.sh
rm -rf $ORACLE_HOME

# 9) Clean Up the environment variables set in the beginning

unset ORACLE_HOME_O
unset ORACLE_HOME_C
unset ORACLE_OWNER_GROUP
..

That was a step by step manual procedure for Oracle12c Out of Place patching that you can use for any patch starting from Oracle 11g and that can help reducing database downtime.

Enjoyed this article? Please share it with others using the social site of your choice:

Comments

2 Responses to “Oracle out of place patching reduces database downtime”
  1. Ziad abuqasem says:

    Dear Sir ,
    I am practicing oracle database 12c and RAC database
    I have one question and I need your help to find the correct answer about Opatch
    can you help me and explain the correct answer
    Which statement is true about using OPatch to patch Oracle Grid Infrastructure 12c?
    A. All grid infrastructure patches may be applied in a rolling fashion with Opatch.
    B. Opatch can patch all cluster nodes simultaneously without stopping the clusterware on all nodes.
    C. Opatch can patch all cluster nodes simultaneously only for non-rolling patches.
    D. Applying patches with Opatch must be done in an out-of-place fashion.

    I think the correct answer choice D but i am not sure can you help me
    Thank you

  2. Kirill Loifman says:

    looks like a RAC exam questions :)
    I might be wrong but I believe non of them is correct.
    — Kirill

Add a Comment

We welcome thoughtful and constructive comments from readers.
If you want your own picture to show with your comment?
Go get a Globally Recognized Avatar!

DBMS Blog Updates : Subscribe RSS RSS: Subscribe to Articles · Subscribe to Comments Subscribe RSS Receive site updates via email