Apply a Patch

Use OPatch to install a patch

Every patch is different from another, so there is no rule for applying a patch.
You need to read the doc before! Don’t simply do an “apply patch” w/o reading it before.

[1] Reactive Patches
-> are usually delivered as “Interim Patches”
-> were historically known as “one-off” patches

Interim Patch (One-Off Patch) FAQ (Doc ID 726362.1)

1. export PATH = $PATH:$ORACLE_HOME/OPatch

2. opatch : Oracle Interim Patch Installer

commands

apply : This operation applies an interim patch to an ORACLE_HOME from
the current directory. The patch location can specified using
the parameter patch_location.

napply : This operation is used to Apply a set of patches at a time.
Use -silent to apply the patches in silent mode.

rollback : Roll back an existing patch indicated by the reference-id.

nrollback : This operation is used to Rollback a set of patches at a time.
Use -silent to Rollback the patches in silent mode.

lsinventory :List the inventory for a particular $ORACLE_HOME or display 
all installations that can be found.
lsinv

lspatches : List and verify patch metadata specified by patch ID 
(installed in ORACLE_HOME) or patch location.

compare : Allows for comparison between two files generated by the 
'opatch lsinv -xml' command. 
Currently, the command only takes in two such files as input.

query : This operation loads and prints out various information about a patch.
Parameter patch_location points to where a patch is located.
For example, if you specify "path", there should be sub-dir.
"etc/config" under "path".

util : This operation invokes the chosen utilities on an ORACLE_HOME

prereq : This operation runs the prerequisite checks on an ORACLE_HOME.

version : Print the version of OPatch for a particular $ORACLE_HOME or 
display all OPatch version in the Central Inventory.
-help
-help -fmw

example:
'opatch -help'
'opatch -help -fmw'
'opatch apply -help'
'opatch compare -help'
'opatch lsinventory -help'
'opatch lspatches -help'
'opatch napply -help'
'opatch nrollback -help'
'opatch rollback -help'
'opatch prereq -help'
'opatch util -help'


[2] How to create an OCM response file for opatch silent installation 

1) Download and install latest opatch tool (recommended)
Patch # 6880880

2) How to create response file for OCM

Note : the location of OCM executable is "$ORACLE_HOME/OPatch/ocm/bin/emocmrsp"
------------------------------------------------------------------------------------------------
Option 1 : Create the response file while keeping OCM turned OFF

$export ORACLE_HOME=/u01/app/oracle/11.2/db1
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /u02/ocm.rsp

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name:

<<<< Press Enter/Return key and don't provide any input >>>>
You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]: Y <<< type Y/Yes >>>
The OCM configuration response file (/u02/ocm.rsp) was successfully created. <<
--------------------------------------------------------------------------------------------------
Option 2 : Create the response file while keep OCM turn ON / Active

$export ORACLE_HOME=/u01/app/oracle/11.2/db1
$ORACLE_HOME/OPatch/ocm/bin/emocmrsp -no_banner -output /u02/ocm.rsp

Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: <Provide Oracle Metalink Email address Example: user@oracle.com >

Password (optional): <Password will be verified if provided / Press return/Enter Key>
The OCM configuration response file (/u02/ocm.rsp) was successfully created. <<<
-------------------------------------------------------------------------------------------------------
Note:

$ cd /u01/app/oracle/product/12.1.0.2/db_1/OPatch/ocm/bin/
$ ll
total 4
-rw-r--r-- 1 oracle oinstall 18 Jul 8 2008 dummy
$ pwd
/u01/app/oracle/product/12.1.0.2/db_1/OPatch/ocm/bin

$ locate emocmrsp
/u01/app/oracle/product/12.1.0.2/db_1/ccr/bin/emocmrsp

-bash-4.1$ pwd
/u01/app/oracle/product/12.1.0.2/db_1/ccr/bin
-bash-4.1$
-bash-4.1$ ./emocmrsp -help
OCM Installation Response Generator 10.3.8.1.1 - Production
Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.

emocmrsp creates a response file used in scripted deployment of the Oracle
Configuration Manager. The response filename is created by default in the
current directory with the filename ocm.rsp.

Usage: emocmrsp [-output <response-file>] [-repeater <OracleSupportHubUrl>]
[-help] [-no_banner] [<CSI> [<MosId>]]
[-verbose <response-file>] [-verify <response-file>]
where,
<CSI> Customer Support Identifier to be used to
register the configuration
<MosId> My Oracle Support id holding the CSI in its My
Oracle Support profile

-help Displays this usage information
-no_banner Do not display the banner
-output <response-file> Creates a response file with the name specified
-verbose Display contents of the response file specified
-verify Verifies a response file for connectivity
-repeater Url for Oracle Support Hub used to connect to
Oracle. If NONE is specified, no Oracle Support
Hub is to be used to communicate with Oracle

Oracle Configuration Manager no longer requires the CSI and My Oracle Support
Id to be specified as part of the installation process. If known, the user can
choose to specify the CSI on the command line. Alternatively, the response
generator prompts for the My Oracle Support username and password alone.

3) Use the OCM response file for all "opatch -silent" operations

Assume applying patch 12345
$cd 12345
$opatch apply -silent -ocmrf <path_to_response_file>

Example: $opatch apply -silent -ocmrf /u02/ocm.rsp

Additional Examples :
1) User below for CPU/SPU apply
$opatch napply -silent -ocmrf /u02/ocm.rsp

2)Use below for PSU apply
$opatch apply -silent -ocmrf /u02/ocm.rsp

3)GRID patching command changed sightly as below 
$opatch auto -ocmrf /u02/ocm.rsp


$ opatch version
OPatch Version: 12.1.0.1.3

OPatch succeeded.

Note :- Starting with OPatch version 12.2.0.1.5 and higher , 
opatchauto execution doesn't require ocm.rsp .

[3] Other tools

$ opatchauto : OPatch Automation Tool

command := apply
resume
rollback
version

example:
'opatchauto -help'
'opatchauto -h'
'opatchauto apply -help'
'opatchauto resume -help'
'opatchauto rollback -help'
'opatchauto version -help'

Note: opatchauto must run from Grid Home with current arguments. 
Please retry it inside Grid Home

$ datapatch : SQL Patching tool

sqlpatch usage:
All arguments are optional, if there are no arguments sqlpatch
will automatically determine which SQL scripts need to be run in
order to complete the installation of any SQL patches.

Optional arguments:
-db <db name> Use the specified database rather than $ORACLE_SID
-bundle_series <bundle_series>
Specify if the patch is a bundle patch
Should also be accompanied by -force option
if -bundle_series option is specified,only 1 patch will
be considered by the -force command
-apply <patch1,patch2,...,patchn>
Only consider the specified patch list for apply operations
-rollback <patch1,patch2,...,patchn>
Only consider the specified patch list for rollback operations
-upgrade_mode_only
Only consider patches that require upgrade mode
-force
Run the apply and/or rollback scripts even if not necessary
per the SQL registry
-pdbs <pdb1,pdb2,...,pdbn>
Only consider the specified list of PDBs for patching. All
other PDBs will not be patched
-prereq
Run prerequisite checks only, do not actually run any scripts
-oh <oracle_home value>
Use the specified directory to check for installed patches
-verbose
Output additional information used for debugging
-help
Output usage information and exit
-version
Output build information and exit

$ datapatch
SQL Patching tool version 12.2.0.0.0 on Fri Aug 30 12:41:06 2019
Copyright (c) 2014, Oracle. All rights reserved.

Connecting to database...OK
Determining current state...done
Adding patches to installation queue and performing prereq checks...done
Installation queue:
Nothing to roll back
Nothing to apply

SQL Patching tool complete on Fri Aug 30 12:41:13 2019

Example1: Applying the agent PSU
Example2: Applying grid control PSU 
Example3: Applying database PSU 

=====================
Path to Documentation:
=====================
11g Documentation -> Installing and Upgrading 
-> Universal Installer and OPatch User's Guide for Windows and UNIX 
-> 7 Patching Oracle Software with OPatch

MOS Reference Note 966023.1

Thank you for visiting this blog…

Advertisements