Tuesday, 13 October 2015

Oracle 11gR2 - Patching Oracle using oPatch

The following steps uses the patch set 10094017 as an example. This patch set fixes issues in both Oracle home and Grid home.

 

The following Environment variables are assumed  –

 

CRS_HOME = /app/oracle/grid/11.2/grid

RDBMS_HOME = /app/oracle/oracle/11.2/db

 

 

Prerequisites 

 

1.                   Make sure you have access as oracle,grid and root user.

2.                   Make sure you have the right amount of free space.

            Free space required is 5.1GB. To free up space on grid home and oracle home, two places to look at are

 

Ø                /app/oracle/grid/11.2/grid/.patch_storage.

This directory contains files created as backup everytime a patch is installed.

 

To free up space in this directory, issue the following command –

$opatch util cleanup <patch number with timestamp>

              that command will usually free up more than 2GB of space.

 

 

Ø  Log directories for the grid background processes.

 

Some of the files locations are -

              /app/oracle/grid/11.2/grid/log/diag/tnslsnr/node1/listener_scan/alert

              /app/oracle/grid/11.2/grid/log/thehostnamehere/cssd

              /app/oracle/grid/11.2/grid/log/ thehostnamehere /crsd

 

3.                   Check if you have the latest version of the opatch.

            It is recommended for the patch to be atleast the same version as Oracle currently installed.

           Current version of Oracle is 11.2.0.1.0. So the opatch is recommended to be atleast 11.2.0.1.0

 

       4.         Check if patch inventory is accessible

 

        Issue the following commands –

 

        $opatch lsinventory -detail -oh /app/oracle/grid/11.2/grid

        $opatch lsinventory -detail -oh /app/oracle/oracle/11.2/db

 

     5.         Check if the patch being installed does not conflict with a previously installed patch.

      $ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./

 

Installation steps

 

 Important first step : Read the README.TXT file that is included in the oPatch zip file.

 

      Place opatch in all the oracle and grid homes in all nodes.

      To achieve that, perform the following steps -

1.           Download zipped opatch file from oracle website.

2.           Copy the zipped opatch file to the following locations on all nodes where you plan to execute opatch –

/app/oracle/grid/11.2/grid

/app/oracle/oracle/11.2/db

3.           Unzip the zipped opatch file in the above directories.

This will result in the following new directories

/app/oracle/grid/11.2/grid/OPatch

/app/oracle/oracle/11.2/db/OPatch

This is the final installed opatch . You do not have to do anything more.

 

This specific patch should be applied as a rolling upgrade. All of the following steps should be followed for each node. Do not patch two nodes at once.

 

      1. Verify that the Oracle Inventory is properly configured.

         $ opatch lsinventory -detail -oh <CRS_HOME>

         $ opatch lsinventory -detail -oh <RDBMS_HOME>

         This command completes instantly

 

      2.relocate service for inst1 instance. relocated the services service1, service2 and service3

         This command takes about 30 seconds to complete.

 

       3.shut down the CRS managed resources running from DB home

          Issue the following command -

         $ <RDBMS_HOME>/bin/srvctl stop home -o <RDBMS_HOME> -s <status file location> -n  

             <node_name>#

         note the status file is created by the process

         This command completes in 4 minutes.

   

     4.Execute the following command as root to unlock protected files.

        $ <CRS_HOME>/crs/install/rootcrs.pl –unlock

        This command completes in 3 minutes.

 

       5. Save the RDBMS home configuration settings

        To achieve that,execute the following command –

        $ custom/server/10094017/custom/scripts/prepatch.sh -dbhome <RDBMS_HOME>

        This command completes instantly.

 

       6. Patch the CRS home files

       As the Oracle Clusterware (CRS) software owner, from the directory where the patch was unzipped;

       $ opatch napply -local -oh <CRS_HOME> -id 10094017

       This command finishes in ~17-20 minutes.

 

       7. Configure the CRS HOME

 

       After opatch completes, some configuration settings need to be applied to the patched files.

      To change owner and permissions as root execute the following;

      $ chmod +w <CRS_HOME>/log/<nodename>/agent

      $ chmod +w <CRS_HOME>/log/<nodename>/agent/crsd

      This command finishes instantly.

 

      8. Configure the RDBMS HOME

      After opatch completes, some configuration settings need to be applied to the patched files.

      As the  RDBMS software owner execute the following –

     $ server/10094017/custom/scripts/postpatch.sh -dbhome <RDBMS_HOME>

     This command finishes instantly.

 

     9. Security settings need to be restored on the CRS Home. This script will also restart the CRS daemons. Invoke this script as root.

     $ <CRS_HOME>/crs/install/rootcrs.pl -patch

     This command finishes in 3 minutes.

 

     $ <DB_HOME>/bin/srvctl start home -o <DB_HOME> -s <status file location> -n <node name>

     This command finishes in 4 minutes.

 

    10. On success you can determine whether the patch has been installed by using the following command -

     $ opatch lsinventory -detail -oh <CRS_HOME>

     $ opatch lsinventory -detail -oh <RDBMS_HOME>

 

 

This completes the patching of Oracle version 11.2.0.1

 



No comments:

Post a Comment