What is OPATCH?
Opatch is a set of perl scripts and java classes which allow the application and rolling back of interim (one-off) patches currently for the Oracle RDBMS product. The program requires that the perl language interpreter version 5.005_03 or greater to run but version 5.6 or greater is
recommended. The main shell of OPatch is called from opatch, which calls other Perl modules and subsequently java classes as well. Under a normal Oracle home installation the JRE is used from the Oracle home and the Perl installation as well which is installed with the Apache
software in $ORACLE_HOME/Apache/perl .
In single line you can say, OPatch is the oracle database’s Interim (one-off) Patch Installer.
Where can I download it from ?
If OPatch is not installed into your Oracle Home ($ORACLE_HOME/OPatch), you may need to download it from Metalink.
Download latest OPatch (Patch 6880880 ) for the Oracle software release.
Follow README.txt for the OPatch utility installation.
https://updates.oracle.com/Orion/Services/download?type=readme&aru=13116058
or you can follow the steps as follows:
Oracle Inventory is the location or the place where all the information about an Oracle Home is stored and maintained. When ever we install an RDBMS Oracle Home, a new inventory gets created. Applying any new patch to Oracle Home will update the inventory for that Oracle Home and record the details for the patch applied. This inventory is in the form of XML files.
The location of inventory is defined in a file called oraInst.loc. The path for this file is provided while installing Oracle Home. If we dont supply any path, the is file will be present at central location /etc/oraInst.loc. Also we can have a central inventory if its not used by any other oracle installation. If the central inventory is used by previous Oracle installation we can create local inventory. The content of oraInst.loc file is as shown below.
How to create Local Inventory?
You can create local inventory at any location while installing Oracle Home. You need to use -invPtrLoc variable along with runInstaller command and give the location of oraInst.loc. Otherwise the default path assumed for oraInst.loc is /etc/oraInst.loc.
./runInstaller -invPtrLoc /slot/ems2029/appmgr/apps/tech_st/10.1.2/oraInst.loc
After the installation starts it will ask for location of oraInventory directory and group which should own it. It will make entry of these into oraInst.loc file.
Opatch help
You can get all the options using opatch -help
How to Applying the OPATCH?
Check the opatch version
make a copy of the OPatch folder, copy the etc & files folders of the patch to $ORACLE_HOME/OPatch directory,
Run the command opatch apply command from $ORACLE_HOME/OPatch location
I am applying the 10010310 opatch on the database.
Master note for opatch on metalink : Master Note For OPatch [ID 293369.1]
recommended. The main shell of OPatch is called from opatch, which calls other Perl modules and subsequently java classes as well. Under a normal Oracle home installation the JRE is used from the Oracle home and the Perl installation as well which is installed with the Apache
software in $ORACLE_HOME/Apache/perl .
In single line you can say, OPatch is the oracle database’s Interim (one-off) Patch Installer.
Where can I download it from ?
If OPatch is not installed into your Oracle Home ($ORACLE_HOME/OPatch), you may need to download it from Metalink.
Download latest OPatch (Patch 6880880 ) for the Oracle software release.
Follow README.txt for the OPatch utility installation.
https://updates.oracle.com/Orion/Services/download?type=readme&aru=13116058
or you can follow the steps as follows:
% mv p6880880_101000_SOLARIS64.zip $ORACLE_HOME % cd $ORACLE_HOME (If a former OPatch directory already exist, then rename it) % mv Opatch OPatch_100057_OLD % unzip p6880880_101000_SOLARIS64.zip Archive: p6880880_101000_SOLARIS64.zip creating: OPatch/ creating: OPatch/docs/ inflating: OPatch/docs/FAQ inflating: OPatch/docs/README.txt inflating: OPatch/docs/Users_Guide.txt inflating: OPatch/docs/bt1.txt inflating: OPatch/docs/bt2.txt inflating: OPatch/docs/tmp inflating: OPatch/emdpatch.pl creating: OPatch/jlib/ inflating: OPatch/jlib/opatch.jar inflating: OPatch/opatch inflating: OPatch/opatch.bat inflating: OPatch/opatch.pl creating: OPatch/perl_modules/ inflating: OPatch/perl_modules/Apply.pm inflating: OPatch/perl_modules/AttachHome.pm inflating: OPatch/perl_modules/Command.pm inflating: OPatch/perl_modules/LsInventory.pm inflating: OPatch/perl_modules/Query.pm inflating: OPatch/perl_modules/RollBack.pm inflating: OPatch/perl_modules/Version.pm inflating: OPatch/perl_modules/XML.pm inflating: OPatch/perl_modules/opatchIO.pm inflating: OPatch/README.txt creating: OPatch/ocm/ extracting: OPatch/ocm/ocm.zip creating: OPatch/ocm/doc/ inflating: OPatch/ocm/doc/license.txt creating: OPatch/ocm/lib/ inflating: OPatch/ocm/lib/emocmutl.jar creating: OPatch/ocm/bin/ inflating: OPatch/ocm/bin/emocmrsp
What is Oracle Database Inventory and where it is located?
Oracle Inventory is the location or the place where all the information about an Oracle Home is stored and maintained. When ever we install an RDBMS Oracle Home, a new inventory gets created. Applying any new patch to Oracle Home will update the inventory for that Oracle Home and record the details for the patch applied. This inventory is in the form of XML files.
The location of inventory is defined in a file called oraInst.loc. The path for this file is provided while installing Oracle Home. If we dont supply any path, the is file will be present at central location /etc/oraInst.loc. Also we can have a central inventory if its not used by any other oracle installation. If the central inventory is used by previous Oracle installation we can create local inventory. The content of oraInst.loc file is as shown below.
[oracle@bcfprddb|BCFPRD /oracle/products/apps]$cd /etc [oracle@bcfprddb|BCFPRD /etc]$cat oraInst.loc inventory_loc=/oracle/oraInventory inst_group=dba [oracle@bcfprddb|BCFPRD /etc]$Here “inventory_loc” gives the location of Inventory directory where as inst_group gives the name of the group which is the owner of this inventory.
How to create Local Inventory?
You can create local inventory at any location while installing Oracle Home. You need to use -invPtrLoc variable along with runInstaller command and give the location of oraInst.loc. Otherwise the default path assumed for oraInst.loc is /etc/oraInst.loc.
./runInstaller -invPtrLoc /slot/ems2029/appmgr/apps/tech_st/10.1.2/oraInst.loc
After the installation starts it will ask for location of oraInventory directory and group which should own it. It will make entry of these into oraInst.loc file.
Opatch help
You can get all the options using opatch -help
[oracle@bcfprddb|BCFPRD /oracle/products/apps]$cd $ORACLE_HOME/OPatch [oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$ [oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$ [oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$opatch -help Invoking OPatch 10.2.0.4.9 Oracle Interim Patch Installer version 10.2.0.4.9 Copyright (c) 2009, Oracle Corporation. All rights reserved. Usage: opatch [ -help ] [ -r[eport] ] [ command ] command := apply lsinventory napply nrollback rollback query version prereq util <global_arguments> := -help Displays the help message for the command. -report Print the actions without executing. example: 'opatch -help' 'opatch auto -help' 'opatch apply -help' 'opatch lsinventory -help' 'opatch napply -help' 'opatch nrollback -help' 'opatch rollback -help' 'opatch prereq -help' 'opatch util -help' OPatch succeeded.You can get specific help for any command of opatch using opatch <command> -help. Example opatch apply -help.
How to Applying the OPATCH?
Check the opatch version
[oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$opatch version Invoking OPatch 10.2.0.4.9 OPatch Version: 10.2.0.4.9 OPatch succeeded.Check the command opatch lsinventory command is working properly.
oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$opatch lsinventory Invoking OPatch 10.2.0.4.9 Oracle Interim Patch Installer version 10.2.0.4.9 Copyright (c) 2009, Oracle Corporation. All rights reserved. Oracle Home : /oracle/products/apps/10.2 Central Inventory : /oracle/oraInventory from : /etc/oraInst.loc OPatch version : 10.2.0.4.9 OUI version : 10.2.0.5.0 OUI location : /oracle/products/apps/10.2/oui Log file location : /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch2011-09-13_00-12-48AM.log Patch history file: /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch_history.txt Lsinventory Output file location : /oracle/products/apps/10.2/cfgtoollogs/opatch/lsinv/lsinventory2011-09-13_00-12-48AM.txt -------------------------------------------------------------------------------- Installed Top-level Products (3): Oracle Database 10g 10.2.0.1.0 Oracle Database 10g Release 2 Patch Set 2 10.2.0.3.0 Oracle Database 10g Release 2 Patch Set 4 10.2.0.5.0 There are 3 products installed in this Oracle Home. There are no Interim patches installed in this Oracle Home. -------------------------------------------------------------------------------- OPatch succeeded.
shut down the database.
[oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$sqlplus "/ as sysdba" SQL*Plus: Release 10.2.0.5.0 - Production on Tue Sep 13 00:30:17 2011 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL> shut immediate; Database closed. Database dismounted. ORACLE instance shut down.
stop the listener.
[oracle@bcfprddb|BCFPRD /oraclebck/10010310]$lsnrctl stop LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 13-SEP-2011 00:30:04 Copyright (c) 1991, 2010, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bcfprddb)(PORT=1521))) The command completed successfully
Stop the DBCONSOLE
[oracle@bcfprddb|BCFPRD /oracle/products/apps]$emctl stop dbconsole Oracle Enterprise Manager 10g Database Control Release 10.2.0.5.0 Copyright (c) 1996, 2010 Oracle Corporation. All rights reserved. http://bcfprddb:1158/em/console/aboutApplication Stopping Oracle Enterprise Manager 10g Database Control ...
Stop isqlplus
[oracle@bcfprddb|BCFPRD /oracle/products/apps]$isqlplusctl stop iSQL*Plus 10.2.0.5.0 Copyright (c) 2003, 2010, Oracle. All Rights Reserved. iSQL*Plus instance on port 5560 is not running ...
Crosscheck the database & listener is not running.
[oracle@bcfprddb|BCFPRD /oracle/products/apps]$lsnrctl status LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.5.0 - Production on 13-SEP-2011 00:34:31 Copyright (c) 1991, 2010, Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=bcfprddb)(PORT=1521))) TNS-12541: TNS:no listener TNS-12560: TNS:protocol adapter error TNS-00511: No listener IBM/AIX RISC System/6000 Error: 79: Connection refused oracle@bcfprddb|BCFPRD /oracle/products/apps]$ps -ef|grep pmon_
Unzip the downloaded opatch,
make a copy of the OPatch folder, copy the etc & files folders of the patch to $ORACLE_HOME/OPatch directory,
Run the command opatch apply command from $ORACLE_HOME/OPatch location
I am applying the 10010310 opatch on the database.
[oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$opatch apply Invoking OPatch 10.2.0.4.9 Oracle Interim Patch Installer version 10.2.0.4.9 Copyright (c) 2009, Oracle Corporation. All rights reserved. Oracle Home : /oracle/products/apps/10.2 Central Inventory : /oracle/oraInventory from : /etc/oraInst.loc OPatch version : 10.2.0.4.9 OUI version : 10.2.0.5.0 OUI location : /oracle/products/apps/10.2/oui Log file location : /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch2011-09-13_00-35-57AM.log Patch history file: /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch_history.txt ApplySession applying interim patch '10010310' to OH '/oracle/products/apps/10.2' Running prerequisite checks... OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only. Please shutdown Oracle instances running out of this ORACLE_HOME on the local system. (Oracle Home = '/oracle/products/apps/10.2') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files and inventory (not for auto-rollback) for the Oracle Home Backing up files affected by the patch '10010310' for restore. This might take a while... Backing up files affected by the patch '10010310' for rollback. This might take a while... Patching component oracle.rdbms, 10.2.0.5.0... Updating archive file "/oracle/products/apps/10.2/lib/libserver10.a" with "lib/libserver10.a/ksu.o" Running make for target ioracle ApplySession adding interim patch '10010310' to inventory Verifying the update... Inventory check OK: Patch ID 10010310 is registered in Oracle Home inventory with proper meta-data. Files check OK: Files from Patch ID 10010310 are present in Oracle Home. The local system has been patched and can be restarted. OPatch succeeded.Check the Patch is listed in the ouptput of opatch lsinventory command: 10010310 should be listed in the above command
[oracle@bcfprddb|BCFPRD /oracle/products/apps/10.2/OPatch]$opatch lsinventory Invoking OPatch 10.2.0.4.9 Oracle Interim Patch Installer version 10.2.0.4.9 Copyright (c) 2009, Oracle Corporation. All rights reserved. Oracle Home : /oracle/products/apps/10.2 Central Inventory : /oracle/oraInventory from : /etc/oraInst.loc OPatch version : 10.2.0.4.9 OUI version : 10.2.0.5.0 OUI location : /oracle/products/apps/10.2/oui Log file location : /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch2011-09-13_00-39-11AM.log Patch history file: /oracle/products/apps/10.2/cfgtoollogs/opatch/opatch_history.txt Lsinventory Output file location : /oracle/products/apps/10.2/cfgtoollogs/opatch/lsinv/lsinventory2011-09-13_00-39-11AM.txt -------------------------------------------------------------------------------- Installed Top-level Products (3): Oracle Database 10g 10.2.0.1.0 Oracle Database 10g Release 2 Patch Set 2 10.2.0.3.0 Oracle Database 10g Release 2 Patch Set 4 10.2.0.5.0 There are 3 products installed in this Oracle Home. Interim patches (1) : Patch 10010310 : applied on Tue Sep 13 00:36:22 GMT+05:30 2011 Unique Patch ID: 13113841 Created on 4 Nov 2010, 13:11:42 hrs PST8PDT Bugs fixed: 10010310 -------------------------------------------------------------------------------- OPatch succeeded.Opatch is successfully applied, Start the listener & the database.
Master note for opatch on metalink : Master Note For OPatch [ID 293369.1]
No comments:
Post a Comment