Академический Документы
Профессиональный Документы
Культура Документы
Filed under: Oracle Database 10g,Oracle Database 11g,Oracle Database 9i Tags: database
patching, opatch, RDBMS patching advait @ 6:32 am
Introduction:
This post has been written on request of one of regular visitor of my blog (Altaaf). This post is
all about Oracle Patching Utility (OPATCH) and various options that can be used along with
Opatch.
We will begin the discussion by knowing what exactly is Opatch?
- OPatch is a java based utility that allow the application and rolling back of interim patches to
an Oracle product. The program has sub-commands that may take arguments. The program
requires Java(JVM) to be present on the current system.OPatch expects users to have commands
such as fuser, jar, ar and make on Unix platforms and jar on Windows platforms to be available
in their PATH.
Opatch Details
How to check the Opatch version?
-bash-3.00$ ./opatch version
Invoking OPatch 10.2.0.3.0
OPatch Version: 10.2.0.3.0
OPatch succeeded.
How to know which version is the correct version of Opatch for your RDBMS home?
You can verify whether the Opatch version for your RDBMS release is correct or not using
metalink note ID 357221.1.
This note ID gives the copatibilities between OPatch version and RDBMS version.
How to get the latest version of OPatch?
You can download the latest version of OPatch from metalink using following URL.
http://updates.oracle.com/download/6880880.html
In the release dropdown you can select the OPatch release that you want to download based on
your RDBMS version. Please read the README.txt before applying the patch.
-bash-3.00$ cd 6972343
-bash-3.00$ pwd
/slot/ems2029/oracle/db/tech_st/11.1.0/patches/6972343
-bash-3.00$ ls
etc files README.txt
$ORACLE_HOME/OPatch/opatch apply
If you have created local inventory then you need to give the correct path for local inventory
stored in oraInst.loc. If you have updated /etc/oraInst.loc with correct location of your inventory,
then above command will work, If not you can give the correct location by giving local
oraInst.loc file.
$ORACLE_HOME/OPatch/opatch apply -invPtrLoc
/slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
Remember that when we are applying patch, patch number is NOT provided as an input to
opatch command. So we have to to be in the directory of patch since opatch will pick the patch
files from current directory.
Rolling back a patch
In case if a patch did not fix the issue or if you has applied wrong patch to oracle home, you can
always rollback the patch using following comamnd.
opatch rollback -id <Patch Number>
Applying bundle patches
Some times if you have to apply bundle patch having many patches, example lets say you want
to a bundle patch 6778860 ( 11.1.0.6 BUNDLED PATCH FOR EBS 11I)) containing many
other patches to RDBMS home, OPatch provides a facility to apply many patches to RDBMS
home using a single comamnd. Following command should be used for applying bundle patches.
Download the patch and extract the same. You will see many directories (one for each patch)
inside the main patch directory. Execute following command to apply all patches.
$ORACLE_HOME/OPatch/opatch util NApply -invPtrLoc
/slot/ems2029/oracle/db/tech_st/11.1.0/oraInst.loc
NApply -> Will apply all patches to RDBMS home.
You can also use -phBaseDir to point to the directory where bundle patch is installed. So you can
run opatch command from any location
CopyListedFilesTest
It is used to copy a single file to remote nodes. The usage remains the same as CopyListedFiles.
Example: opatch util copylistedfilestest -fp /home/oracle/a -remote_nodes ceintcb-a5
This is used where RAC setup is present.
CopyListedDirs
It is used to recursively copy all directories listed in
ORACLE_HOME/.patch_storage/<ID>/rac/copy_dirs.txt to remote nodes. If -dp option is used,
then one can specify the path of the file containing the list of directories to be copied. The
directories mentioned in this file will be copied to the remote nodes.
This is used where RAC setup is present.
CopyListedDirsTest
It is used to copy a single file to remote nodes. The usage remains the same as CopyListedDirs.
This is used where RAC setup is present.
RemoveListedFiles
It is used to remove files listed in ORACLE_HOME/.patch_storage/<ID>/rac/remove_files.txt
on remote nodes. If -fr option is used, then one can specify the path of the file containing the list
of files to be removed. The files mentioned in this file will be removed from the remote nodes.
This is used where RAC setup is present.
RemoveListedFilesTest
It is used to remove a single file from remote nodes. The usage remains the same as
RemoveListedFiles.
This is used where RAC setup is present.
RemoveListedDirs
It is used to recursively remove directories listed in
ORACLE_HOME/.patch_storage/<ID>/rac/remove_dirs.txt from remote nodes. If -dr option is
used, then one can specify the path of the file containing the list of directories to be removed.
The directories mentioned in this file will be removed from the remote nodes.
This is used where RAC setup is present.
RemoveListedDirsTest
It is used to remove a single directory from remote nodes. The usage remains the same as
RemoveListedDirs.
This is used where RAC setup is present.
RunLocalMake
It is used to invoke re-link on the local node. The make commands are stored in
ORACLE_HOME/.patch_storage/<ID>/make.txt. You need to use the -ps option to specify the
Patch ID with timestamp. A directory by this name will be present under
ORACLE_HOME/.patch_storage. The make.txt file present under
ORACLE_HOME/.patch_storage/<Patch ID with timestamp>/ will be used to perform the local
make operation. This command cannot be run if you have already run Cleanup as it would have
removed these make.txt files.
Example: opatch util runlocalmake -ps 6121250_ un_21_2007_04_16_11
RunRemoteMake
It is used to invoke re-link on remote nodes. The make commands are stored in
ORACLE_HOME/.patch_storage/<ID>/rac/makes_cmd.txt. The usage remains the same as
RunLocalMake.
This is used where RAC setup is present.
RunAnyCommand
It is used to run any command on remote nodes. The command should be specified using the
-cmd option.
Example: opatch util runanycommand -remote_nodes ceintcb-a5 -cmd ls
This is used where RAC setup is present.
LoadXML
It is used to check the validity of an XML file. The -xmlInput option can be used to specify the
path of the xml file.
@ Support can use this utility to verify the integrity of XML files contained in the local and
central inventory.
Example: opatch util loadxml -xmlInput
$ORACLE_HOME/inventory/ContentsXML/comps.xml
Verify
It is used to run the patch verification process to ensure that the patch was applied to the
ORACLE_HOME. It uses the defined ORACLE_HOME and the given patch location via -ph, to
run the check.
@ Support can use this utility to re-run the OPatch verification stage, if required for patch
diagnosis. The patch staging area has to be present or created.
Example: opatch util verify -ph ~/6646853/6121183
Troubleshooting
Some times the inventory get corrupted because of some issues. In that case you need to repair
the inventory. Following are the two methods which I know can be used to repair the inventory.
1) Development has released a utility (checkinv) which can be use to repair the inventory if it
becomes corrupted for some reason.
Please note that this version of checkinv works only for 9.2 and 10.1 releases of oracle database.
This doesnt work for 10.2 releases of oracle database.
You can download the checkinv utility from Patch 4121946.
To cleanup the components, you should determine the unwanted or dangling components, then
specify those using the option -remcomp, to cleanup the component list.
The utility detects and asks users permission to repair a bad inventory. In case you want to
repair the inventory, the utility will first back up the files before any modification.
However, it is better that you backup the inventory before running the tool.
For more details, check metalink note ID 298906.1
2) Creating a new inventory using Oracle Universal Installer (OUI).
Check my older post http://advait.wordpress.com/2008/03/21/creating-oracle-home-inventoryoracle-database-10g/ for the same.
Hope this helps !!
References:
Metalink note ID : 298906.1
Metalink note ID : 554417.1
Metalink note ID : 374092.1
Metalink note ID : 357221.1
To install this patch simply extract the most uptodate OPatch zip file. Unzip it the file directly
under the ORACLE_HOME. Then check the version by typing "opatch version" command.
How to run the OPatch utility?
OPatch tool works with Perl. You need to have JDK to be in your Oracle Home.
How to invoke the OPatch process?
Go to the patch directory that you want to apply the patch.
For example:
# cd 5225799
# opatch apply -the run the opatch tool.
For Oracle 8i and lower version use the following steps:
The instructions for installing Oracle patch set in general and it will assume a minimal
familiarity with the Oracle Universal Installer and version of upgrade is in the forth level of
release x.x.x.?.0.0, for example 8.1.7.?.? up.
You must remember that applying a patch for each release could be different and the following
instruction are not applicable to any specific patch. Please read and study the patch instruction
before applying them to your system.
As with any maintenance operation, Oracle Corporation recommends that you back up your
Oracle software before making any changes to it.
Notes
On UNIX systems, if you require /usr/ucb in your search path, make
sure that it comes after /usr/bin and/or /usr/ccs/bin in the $PATH
setting.
If an inadvertent attempt is made to apply Patch Sets that applies to
8.1.7 release or up, then if it is not applicable a warning dialog box
entitled Dependencies is displayed like the following message:
There are no patches that need to be applied from the patch set
Oracle8i Patchset 8.1.7.4.0.
1.
2.
3.
4.
5.
Log in to the oracle account and make sure the environment is set to the correct
ORACLE_HOME and ORACLE_SID.
Uncompress and un-tar the downloaded patch set file into a new directory.
Shut down the existing Oracle Server instance with normal or immediate priority. I.e.:
Shutdown all instances (cleanly) if running Parallel Server. Stop all listener, agent and
other processes running in or against the ORACLE_HOME to be installed into.
Start the installer:
o If the Installer was installed during the installation, then run the installer from
within the $ORACLE_HOME/bin directory.
o If the Installer was not installed during the installation, then run the installer from
within the top-level directory on the original Oracle version.
You may install the Patch Set through either an interactive or a silent installation.
2.
Verify the products listed and then click on the Install button.
5. Once the installation has completed successfully, it will display
End of Installation. Click on Exit and confirm to exit the installer.
To perform a silent installation requiring no user intervention:
Copy the response file template provided in the response directory where
you unpacked the Patch Set tar file.
Edit the values for all fields labeled as "<Value Required>" according to
the comments and examples in the template.
Start the installer from whichever of the directories described in Step 4
applies to your situation passing as the last argument the full path of the
response file template you have edited locally with your own value of
ORACLE_HOME and FROM_LOCATION:
4.
o
2.
3.
4.
7.
8.
If you have previously installed Oracle Label Security then add object files to library.
This step is necessary because the installation of this patch set removes Oracle Label
Security object files from RDBMS library.
Link in ols .o files using the following steps:
cd $ORACLE_HOME/lbac/lib
make -f lbac.mk xkzl
make -f lbac.mk ilbac
cd $ORACLE_HOME/rdbms/lib
make -f ins_rdbms.mk ioracle
Disabling system triggers.
Before performing the next step, you must first set _SYSTEM_TRIG_ENABLED =
FALSE in the initialization parameter file. To do this add the following line to your
init<sid>.ora file and restart the database (see Note 149948.1 in Metalink for more
information on this issue).
_system_trig_enabled=false
Invoke SQL*Plus (sqlplus), connect as internal and run the following:
select * from duc$ where PACK='JIS$INTERCEPTOR$' ;
If no rows were returned go to the next step. If a row was returned delete it using the following:
Invoke SQL*Plus (sqlplus), connect as internal (/ as sysdba) and run the following SQL
scripts with event 10520 set. NOTE: This event is not intended for regular database
operation and when turned on below by the 'ALTER SESSION' command will
automatically be turned off by the subsequent 'CONNECT' command.
ALTER SESSION SET EVENTS '10520 TRACE NAME CONTEXT FOREVER, LEVEL 10';
?/rdbms/admin/catalog.sql
?/rdbms/admin/catproc.sql
?/rdbms/admin/catrep.sql (This only needs to be run if you are using
symmetric/advanced replication. This is not necessary for sites using dblinks and read-only
snapshots if symmetric/advanced replication is not installed)
CONNECT / AS SYSDBA;
update obj$ set status=5 where type#=29 and owner#!=0;
commit;
10.
You can ignore this step if you have already executed it as part of a previous patch set
install.
If Java has previously been loaded into the database, invoke SQL*Plus (sqlplus), connect as
internal and run the following SQL DDL command(* Note:If Java has not previously been
loaded into the database, skip this step).:
SQL> create or replace java system
2 /
(Note that the / (slash) is important to ensure the execution of the command).
To ensure the correct installation of the XDK in the database run the following 2 scripts (Bug
2115227):
$ORACLE_HOME/oracore/admin/initxml.sql
$ORACLE_HOME/rdbms/admin/catxsu.sql
Java is installed if you get a non zero result returned from the query.
11.
12.
You can ignore this step if you have already executed it as part of a previous patch set
install:
If Java has previously been loaded into the database, invoke SQL*Plus (sqlplus), connect as
internal and run the following scripts which are located in $ORACLE_HOME/javavm/install (
Note: If Java has not previously been loaded into the database, you can skip this
step):
load_jis.sql
jisja.sql
initjsp.sql
jspja.sql
Notes:
When running the $ORACLE_HOME/javavm/install/jisja.sql script the following error may be
reported and can be ignored:
call jis_exit_java_session(0)
ERROR at line 1:
ORA-29515: exit called from Java code with status 0
Bug 1459233 was filed against this problem which is fixed in 9i.
13.
If you deleted a row from duc$ in step 8 then reinsert it again. Invoke SQL*Plus
(sqlplus), connect as internal and run the following SQL:
insert into duc$ (OWNER, PACK, PROC, FIELD1, OPERATION#, SEQ) values
('SYS', 'JIS$INTERCEPTOR$', 'USER_DROPPED', 0, 1, 1);
commit;
14.
15.
?/rdbms/admin/utlrp.sql
16. Execute the following steps only if you have installed Oracle
17.
You can ignore this step if you have already executed it as part of a previous patch set
install:
The installation of this patch set fixes a potential security hole in the XSQL Servletl. The
patchset installation does not, however, modify any of the Oracle HTTP Server configuration
files to reflect changes to the XSQL Servlet installation. If you have previously installed the
Oracle HTTP Server, you will need to update one of the configuration files manually after the
patchset installation is complete. If you do not do so, the XSQL Servlet may not work in the
context of the Oracle HTTP Server after the patchset is installed. To update your Oracle HTTP
Server configuration, perform the following steps:
1) Edit the file: $ORACLE_HOME/Apache/Jserv/conf/jserv.properties
2) Search for the string: "XSQLConfig.xml File location"
3) Modify the parameter wrapper.classpath on the line immediately following the above string
to read: $ORACLE_HOME/oracore/admin
4) Save the file.
18.
You can ignore this step if you have already executed it as part of a previous patch set
install:
The installation of this patch set fixes a potential security hole in the PL/SQL XML parserl. To
load the new XML parser in to the database, run the following script as user SYS:
? /xdk/plsql/parser/bin/load.sql
19.