At the end of Part
3, a patch for an Oracle 10.2.0.1 database was obtained from MetaLink and
cached in a cache repository. During the installation, the patch was not
applied (although it could have been at that time). In this part of the series,
Oracle’s OPatch utility will be used to actually apply the cached patch.
What is OPatch?
Detailed information about
OPatch is available in Chapter 8 (Oracle Software Patching Using OPatch) of Oracle®
Universal Installer and OPatch User’s Guide
10g Release 2 (10.2) for Windows and UNIX. From the documentation:
OPatch
is an Oracle supplied utility to assist you with the process of applying
interim patches to Oracle’s software. OPatch is a Java-based utility which
requires the Oracle Universal Installer to be installed. It is platform independent
and runs on all supported operating systems. OPatch supports the following:
- Applying an interim patch.
-
Rolling back the application
of an interim patch. -
Detecting conflict when
applying an interim patch after previous interim patches have been applied. It
also suggests the best options to resolve a conflict. -
Reporting on installed
products and interim patch.
Prior to release 10.2
(OPatch for 10.2 is only compatible with 10.2 and nothing earlier), OPatch was
available from MetaLink as a patch in and of itself (p2617419_10102_GENERIC.zip
for release 10.1.0.2). With 10.2, OPatch is installed as part of the RDBMS
software.
A question frequently seen
on Oracle-related Web sites is "how do I find out what version or patch am
I using?" One of OPatch’s features – the last bulleted item in the list
above – is its ability to report on installed products.
Putting OPatch to work
Although "opatch"
is an Oracle executable, it is not located in the bin directory. Under the
OPatch directory in ORACLE_HOME, there exists a Perl (for UNIX) and a batch
(for Windows) opatch file. Running "opatch" by itself produces the
following output. The log file location was edited where "<>"
appears (and yes, there really are two periods after "All rights reserved,"
but that is from Oracle, not me).
C:>%ORACLE_HOME%Opatchopatch Invoking OPatch 10.2.0.1.0 Oracle interim Patch Installer version 10.2.0.1.0 Copyright (c) 2005, Oracle Corporation. All rights reserved.. Oracle Home : C:oracleproduct10.2.0db_1 Central Inventory : n/a from : C:Program FilesOracleInventory OPatch version : 10.2.0.1.0 OUI version : 10.2.0.1.0 OUI location : C:oracleproduct10.2.0db_1oui Log file location : C:<$OH>cfgtoollogsopatchopatch-<date_info>.log Usage: opatch [ -help ] [ -r[eport] ] [ command ] command := apply lsinventory query rollback version <global_arguments> := -help Displays the help message for the command. -report Print the actions without executing (deprecated). example: 'opatch -help' 'opatch apply -help' 'opatch lsinventory -help' 'opatch rollback -help' OPatch succeeded. C:> Output from using "opatch" by itself Adding the lsinventory option to opatch produces output like so: C:>%ORACLE_HOME%opatchopatch lsinventory Invoking OPatch 10.2.0.1.0 Oracle interim Patch Installer version 10.2.0.1.0 Copyright (c) 2005, Oracle Corporation. All rights reserved.. Oracle Home : C:oracleproduct10.2.0db_1 Central Inventory : n/a from : C:Program FilesOracleInventory OPatch version : 10.2.0.1.0 OUI version : 10.2.0.1.0 OUI location : C:oracleproduct10.2.0db_1oui Log file location : C:<$OH>cfgtoollogsopatchopatch-<date>.log Lsinventory Output file location : C:oracleproduct10.2.0db_1cfgtoollogsopatchlsinvlsinventory-2005_Dec ----------------------------------------------------------------------- Installed Top-level Products (1): Oracle Database 10g 10.2.0.1.0 There are 1 products installed in this Oracle Home. There are no Interim patches installed in this Oracle Home. ----------------------------------------------------------------------- OPatch succeeded.
Output from using "opatch" by itself
Adding the lsinventory
option to opatch produces output like so:
C:>%ORACLE_HOME%opatchopatch lsinventory Invoking OPatch 10.2.0.1.0 Oracle interim Patch Installer version 10.2.0.1.0 Copyright (c) 2005, Oracle Corporation. All rights reserved.. Oracle Home : C:oracleproduct10.2.0db_1 Central Inventory : n/a from : C:Program FilesOracleInventory OPatch version : 10.2.0.1.0 OUI version : 10.2.0.1.0 OUI location : C:oracleproduct10.2.0db_1oui Log file location : C:<$OH>cfgtoollogsopatchopatch-<date>.log Lsinventory Output file location : C:oracleproduct10.2.0db_1cfgtoollogsopatchlsinvlsinventory-2005_Dec ----------------------------------------------------------------------- Installed Top-level Products (1): Oracle Database 10g 10.2.0.1.0 There are 1 products installed in this Oracle Home. There are no Interim patches installed in this Oracle Home. ----------------------------------------------------------------------- OPatch succeeded.
Opatch "lsinventory" report
Going one step further,
adding the report parameter (opatch lsinventory –detail) produces an extensive
report of installed components. Instead of trying to read everything on the
screen, review the log file because it contains what is shown on your monitor
(but in a slightly different format). A partial log file is shown below.
SEVERE:OPatch invoked as follows: 'lsinventory -detail ' INFO:Starting LsInventorySession at Sat Dec 17 21:15:32 MST 2005 INFO:Lsinventory Output file location : $OHcfgtoollogsopatchlsinvlsinventory-<date>.txt INFO:------------------------------------------------------------------ INFO:Installed Top-level Products (1): INFO:Oracle Database 10g 10.2.0.1.0 INFO:There are 1 products installed in this Oracle Home. INFO: INFO:Installed Products (114): INFO:Agent Required Support Files 10.2.0.1.0 INFO:Assistant Common Files 10.2.0.1.0 INFO:Bali Share 1.1.18.0.0 INFO:Buildtools Common Files 10.2.0.1.0 INFO:Character Set Migration Utility 10.2.0.1.0 INFO:Database Configuration and Upgrade Assistants 10.2.0.1.0 INFO:Database SQL Scripts 10.2.0.1.0 INFO:Database Workspace Manager 10.2.0.1.0 INFO:DBJAVA Required Support Files 10.2.0.1.0 INFO:Enterprise Edition Options 10.2.0.1.0
Detailed reporting from lsinventory
However, a better-looking
output file is contained under the lsinv directory (the "INFO:" parts
of each line are not displayed). As you can see, a very simple command answers
the commonly seen "how do I see what my patch information is"
question.