Patching





Patch:
======
A Patch which fixes a bug (or) enhance/add a particular feature in existing program.

Why patches require in oracle ebs?

Patches may be required to resolve problem wth application code,to fix production issues,to install new feature
to upgrade components of the technology stack.

Patches is of two types

1)(Opatch) to apply database patches
2)(adpatch) to apply application patches.

Naming convention of patch
============================
1)<p><number>_11i_<platform>

 <number>=7 digits

exmple: p1234567_r12_LINUX.Zip

2)P1234567_11i_GENERIC.Zip

Note: Generic indicates on all platform we can apply this patch.


Types of patch in oracle application
====================================

One of patch
=============

A patch that doesnot depends upon another patch .
one of patches fixes one or more bugs for a single product.
one of patches may or may not have the pre requisites.
These patches are small in size.
They often called as standalone patches.

Mini Pack:
=========
A mini pack is one which will upgrade any product patch set level to next level .

or

Collection of one -off patches and enhancement related to particular module.
All bug fixes related to one product which will change the patchset level of
specific product.

Minipack version is denoted by alphabetic characters.

patch+patch=Minipack

 <11i>_<product>_<minipack level>

Example: 11i.FND.H
         11I.GL.I
         11i.GL.H.1


Rollup patches
=============

 A rollup patch is one which will deliver bug fixes identified after the release of any major application versions like 11.5.8/11.5.9.



Family pack
===========
A Family pack is one which will upgrade the patch set level of all the products in that family to particular patchsetlevel.

(OR)

Collection of minipack patches for a particular family group of application modules.

Some of the families in oracle Apps are:

 FIN == GL,AR,AP,FA

 ATG == AD,FNDAU,WF

Family pack patches will change entire product family.

product Minipack+product Minipack= Family pack.

Naming convention of family pack patch:
========================================

<Family name>_PF.<CODE LEVEL>

Example:HR_PF.J
        GL_PF.K


Maintainance pack patch
============================
Group of family pack is called Maintainance pack patch.

A maintenance pack will upgrade applications from one version to another like 11.5.8 to 11.5.9.


 consolidated  patches.
===================
Consolidated patches will come into pictures after upgrades from one
version of applications to another, all post upgrade patches will a consolidated
and given as consolidated patch.





PATCH ARCHTECTURE
================
Suppose this is the patch number 1234567.
Example:P<1234567>_R12_LINUX.zip

A patch contains three things.

1)Directory with the patch number like here in this case 1234567.inside you will find below files.

2)README.txt or README.html

3)Driver files
c<patch number>.drv
d<patch number>.drv
g<patch number>.drv

u<patch number>.drv  it is ther in updated versions.


What happens when we unzip a patch?
===========================

unzip P<1234567>_R12_LINUX.zip

When we unzip a patch it create a base directory with the patch number like 1234567.
it contains all patch related files .in this directory there is a file README.txt or README.html
which contains instruction how to apply a patch and also it contain patch number,product,release
and platform.if patch is too long it contain document id which helps us to apply a patch.
it also contain driver files.

c<patch number>.drv
====================
Copies the files that are there in patch to the APPL_TOP
Extracts the appropriate files from each product c library.
Re-links the oracle application product.

Compares the files in the patch with those in the APPL_TOP,if the files in the patch are a higher
version,then adpatch copies the files from patch to APPL_TOP

d<patch number>.drv
===================
The database driver contains all commands to change the database objects.In multi node installation d driver runs
from the admin server.The database driver applies all script copied by the copy driver to the database.

==> Make a list of all invalid objects in the database.
==>Run sql scripts,which make changes to the database.(Packages,procedures and etc).
==>Compile all the invalid objects that are there in the database.

g<patch number>.drv
==================

Regenerate all forms,reports and PL/SQL libraries that have been effected by the patch.

u<patch number>.drv
===================
It is combination of all three drivers c,d and g.The action of each driver is performed by u driver.



Who will created the patches?

Patches are created by oracle whenever there are enahancement in its application or there are any problem with the exists ones.








***************************************************************************


How to apply a patch in oracle ebs suite?
============================

check patch is applied or not if not download from metalink
===========================================================
select bug_number,creation_date from apps.ad_bugs where bug_number='&bug_number';

check how many langagues are installed
=======================================

col LANGUAGE_CODE for a20
col NLS_LANGUAGE for a20
select NLS_LANGUAGE,LANGUAGE_CODE,INSTALLED_FLAG from apps.fnd_languages where INSTALLED_FLAG in('B','I');
NLS_LANGUAGE LANGUAGE_CODE INS
-------------------- -------------------- ---
AMERICAN US B
BRAZILIAN PORTUGUESE PTB I

OR
cd $AU_TOP/forms
Invalid objects before applying the patch
=======================
select count(*) from dba_objects where status='INVALID';
25
Backuping the invalids object before applying the patch
====================================================
create table dba_objects_18apr2013 AS select * from dba_objects where status='INVALID';

if you have multiple patches Please merge it by using below command
====================================================================
Go to patch directory and create below directories
cd /u01/ebsapp/patches/CTASK0214234
mkdir before after
chmod 777 *
Now merge patch using below command
===================================
You should fire this command from CTASK0214234.
ls -trl /u01/ebsapp/patches/CTASK0214234/before/*.zip|awk '{print $NF}' > patch_list
admrgpch -s before -d after -merge_name 0214234 -manifest patch_list
above command merge the patch and go to after directory you will find merge driver file.

send outage communication/Put mail to business
============================================
Bring down middle tier/apps tier services
11i==============>cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME
r12==============>cd $INST_TOP/admin/scripts
ps -fu applmgr|grep -i http


if it is shared application file system
========================================
you have to bring down admin tier service i.e, concurrent node it depends on business requirement.
ps -fu applmgr|grep -i FND|wc -l
if processes not went down do kill processes and proceed ahead
===============================================================
kill -9 procid

Enable the maintanace mode
===========================
sqlplus -s apps/******** @$AD_TOP/patch/115/sql/adsetmmd.sql ENABLE
To check maintanace mode enable or not use below query
=======================================================
select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;


Now fire adpatch from VNC server as its process will be created on the server.
You can also use putty session but this process will run at client side.Putty
session will be inactive after 30 mins.if your patch taking more than 30 mins
your session will gone.you have to start adpatch from the start.

So its better practice to use VNC.




FIRE :adpatch
as adpatch will ask for some questions like logfile name,system,apps,ORACLE_HOME,number worker,driver file
once the patch is applied successfully.Please check the logfile for errors and warnings.

To check adpatch log
cd $APPL_TOP/admin/$TWO_TASK/log.


grep -i errors $APPL_TOP/admin/$TWO_TASK/log/0214234.log
grep -i warnings $APPL_TOP/admin/$TWO_TASK/log/0214234.log

Please check whether patch is applied or not.
===============================================
select bug_number,creation_date from ad_bugs where bug_number='5968480';
BUG_NUMBER CREATION_DATE
------------------------------ ---------------
14072764 18-APR-12

Disable the maintainance mode
=========================================
sqlplus -s apps/****** @$AD_TOP/patch/115/sql/adsetmmd.sql DISABLE


To check maintanace mode enable or not use below query
=======================================================
select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;




Up the DT services and then AT services
======================================
11i==============>cd $COMMON_TOP/admin/scripts/$CONTEXT_NAME
R12==============>cd $INST_TOP/admin/scripts (OR) $ADMIN_SCRIPTS_HOME

do sanity check and release instance for user access .
http://appoltp.user.com:8011/OA_HTML/AppsLocalLogin.jsp
In sanity check you will sumbit below to requests

Go to System adminstrator --->Request--->Run

1)Active User =====>Check View LOG/vIEW OUT
2)Active Responsiblity ===>Check View LOG/vIEW OUT


Invalid objects after applying the patch
=========================================
SQL> select count(*) from dba_objects where status='INVALID';
COUNT(*)
----------
16
Backuping the invalids object after applying the patch
====================================================
SQL> create table dba_objects_18apr2012_after AS select * from dba_objects where status='INVALID';
Table created.


To find new invalid objects
============================
SQL> select count(1) from dba_objects where object_id not in (select object_id from dba_objects_18apr2013) and status='INVALID';
COUNT(1)
----------
0
SQL>


***************************************************************


Merging patches
==============

Merging multiple patches into one patch is said to be merge patch.

We can merge language patches,pre-requisite and co -requisite patche into one patch.

Don't merge RDBMS patch with apps patch.

Don't merge patches of different version (11.5.x, 12.1).

Don't merge ATG family product patches.


PATCHES MODE
============

We can apply adpatch in four modes.They are

1)Interactive
2)Non - Interactive
3)Pre-install mode
4)Test  mode



1)Interactive *:-
==============

Providing all the inputs at the time of applying a patch.

2)Non - Interactive *:-
====================
Providing  the inputs for adpatch in a file is said to be Non-interactive mode.

It is a text file.

Location of the defaluts file is $APPL_TOP/admin/<SID>

While working with defaults file for the first time we need to provide all the inputs.From next time onwards
we have to provide only limited information like Patch location,driver file,patch log file and number of works.


Example:
===========

$adpatch defaultsfile=/u01/erpapp/appl/admin/ebsofdb/adpatchdef.txt

From next time onwards no need to provide all the inputs,its enough to provide below inputs.
1)Logfile
2)Patch directory location
3)Driver file
4)Workers

Advantage: Reduce patch timing.


3)Pre-install mode *--
====================
In this mode,Only copy portion is applied.('C' Driver is applied)
Database portion and generate portion will not be executed.('D' and 'G' Driver will  not be executed).
Default it is set to no adpatch preinstall=n
This would be done normally during an upgrade or consolidated update. When a patch is applied in a preinstall mode then all the AD utilities are updated before the upgrade or update.

if you wish to apply a patch in preinstall mode then use below syntax.

$adpatch preinstall=y


4)Test  mode * :-
===============
BY using this mode,We can see the effects of applying this patch will have on your system before applying the patch.

The default is adpatch apply=y.

If you want to apply a patch in test mode follow below syntax.

Syntax: adpatch apply=no


in this mode just file comparision will be done between PATCH_TOP and APPL_TOP and that will be reported in .lgi file.
It is located under $APPL_TOP/adminn/<SID>/log/adpatch.lgi


Advantage: Will get to know what patch is doing before applying the patch on our system.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
                                     Adpatch options
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

To change the default behaviour of patching ,we can use below options.

Non default
======              
nocopyportion
nodatabaseportion
nogenerateportion
nocompiledb
nocompilejsp
novalidate
nomaintainancemrc
noautoconfig
hotpatch



default
======
copyportion
databaseportion
generateportion
compiledb
compilejsp
validate
maintainancemrc
autoconfig
nohotpatch


Checkfile *:-
==========
The checkfile option of adpatch tells adpathc to check for already executed exec, SQL, and exectier commands. this can cause performance overheds so should be used only when specified.

$adpatch options=nocheckfile


compiledb *:-
============
Purpose: To compile invalid objects in the database after running actions in the database driver.
Default: compiledb (use ‘nocompiledb’ to skip)



compilejsp *:-
===========
Purpose: To compile out-of-date JSP files, if the patch has copy actions for at least one JSP file.
Default: compilejsp (use’nocompilejsp’ to skip)


copyportion*:-
============
Purpose: To run commands found in a copy driver. This will copy the higher version files from patch to product top.
Default: copyportion (Use ‘nocopyportion’ to skip. Use it only when mentioned in readme of patch)


databaseportion * :-
================
Purpose: To run commands found in a database driver. This portion includes applying the files (like sql, pls etc) to database.
Default: databaseportion (use ‘nodatabaseportion’ to skip. Use it only when mentioned in readme of patch).


generateportion *:-
===================

Purpose: To run commands found in a generate driver. This portion will generate new executable files from the copied code of patch. For example if will generate new forms files (fmx) from new .fmb files.
Default: generateportion (use ‘nogenerateporation’ to skip).

$adpatch options=nogenform
$adpatch options=nogenrep

integrity *:-
=============
Purpose: To perform patch integrity checking. Tells adpatch whether to perform patch integrity checking, which verifies that the version of each file referenced in a copy action matches the version present in the patch.
Default: nointegrity (By default the integrity is not checked)

$adpatch options=integrity

maintainmrc *:-
==============
Purpose: To maintain the MRC schema after running actions found in the database driver.
Default: maintainmrc (use ‘nomaintainmrc’ to skip)


autoconfig *:-
==============
Purpose: Tells adpatch to run Autoconfig after patch installation.
Default: autoconfig (use ‘noautoconfig’ to skip)


parallel * :-
=============
Purpose: To run actions that update the database or actions (like SQL) that generate files in parallel (like genform).



prereq *:-
==========
Purpose: Tells adpatch whether to perform prerequisite patch checking prior to running patch driver files that contain actions normally found in the copy driver.
Default: prereq (use ‘noprereq’ to skip)

$adpatch options=noprereq

validate *:-
=============
Purpose: To connect to all registered Oracle Applications schemas at the start of the patch. Adpatch validates the passwords for each schema.
Default: novalidate (use ‘validate’ to validate schema passwords)
Default: parallel (use ‘noparallel’ to skip)


Java Classes * :-
=============
If you wish adpatch not to copy new java classes from the patch .By default java classes are copied.

$adpatch options=nojcopy


Relinking *:-
===========
If you wish adpatch not do perform relinking you can use options=nolink.


Force Copy *:-
============
By default adpatch copies the files without check the version of the existing files already present on the system.If you do  not wish the newer version of the file to be replaced by the older version contained in the patch use options=noforcecopy.

$adpatch options=noforcecopy.


You could specify multiple options at the command line using the , delimiter.
=============================================================================
$adpatch options=nocompiledb,nocompilejsp,nojcopy


Following flags can be passed to adpatch
1) hidepw
Purpose: This argument is used to hide the passwords in log files
Default: nohidepw
2) trace
Purpose: Tells the adpatch utility whether to log all database operations to a trace file
Default: notrace
3) logging
Purpose: Tells the adpatch utility whether to create indexes using the logging or nologging mode.



What two tables adpatch creates when you apply or run adpatch session ?
FND_INSTALL_PROCESSES , AD_DEFERRED_JOBS



12 comments:

  1. Good stuf you Posted in this Blog.

    Really it is a valuable material for those who are really want to work as ORACLE APPS DBA.

    one more point i have to Share with u is:


    After Patch is Applied Sucessfully ,it will update the patch history in AD_SNAPSHOTS.

    ReplyDelete
  2. what is a snapshot?

    ANS:
    ---
    There are two types of snapshosts, APPL_TOP and global. APPL_TOP snapshots contain version of files and patches applied within that APPL_TOP. A global snapshot contains the same information but for the entire environment, ie. all APPL_TOPS.

    The global view snapshot is used when you use Patch Wizard to determine whether or not a patch has been applied. APPL_TOP snapshots are using by autopatch (adpatch) to determine if all prerequisite patches have been applied. Each time you apply a patch AutoPatch updates the current view snapshot. I believe it may even create a new current view snapshot and just replace the existing one.

    Additionally there are two types of snapshots, current view and named. A named snapshot is just a copy of the current view snapshot at a given point in time. Patch wizard and AutoPatch use current view snapshots.

    To access snapshot information launch adadmin, select option 2 - Maintain Applications Files menu, select 5 - Maintain snapshot information and you will see the menu below:


    Maintain Snapshot Information
    -------------------------------------------

    1. List snapshots

    2. Update current view snapshot

    3. Create named snapshot

    4. Export snapshot to file

    5. Import snapshot from file

    6. Delete named snapshot(s)

    7. Return to Maintain Applications Files menu



    Back to the problem of adpatch seeming to hang while instantiating a current-view snapshot. Since this is a cloned environment, a snapshot doesn't exist yet for the APPL_TOP. So before AutoPatch can check if prerequistite patches have been applied, it must create a snapshot. This process can take 1-2 hours depending on how fast your servers are. You can avoid this by running "Update current view snapshot" via adadmin after you clone.

    I should add, that in my experience I've only encountered this problem a few times. Most of the patches I apply to a cloned environment are quick one-offs with no pre-reqs. Large patching efforts such as family packs or patches with pre-reqs may experience this problem. I haven't tried, but if your crunched for time you may be able to bypass adpatch updating the current view snapshot by specifying "adpatch options=noprereq" to skip the prerequisite check.

    ReplyDelete
  3. Q) Why we need to run 'active users' request from application front end?
    if possible, please mail me the detail answer about my question to- vishalpawar4189@gmail.com

    ReplyDelete
    Replies
    1. Hi Vishal,

      After doing the cloning from production or after taking production outage to make sure everything is fine we submit "Active User" and "Active responsibility" and confirm to business.


      Also you can submit Active User request from back end.

      Delete
  4. Q) why all patches are not shown in patch wizard list (front end) , which type of patches are hidden in that list???

    ReplyDelete
  5. Hi everyone, my question is what does this b.ldt , f.ldt....etc files do in patch directory..?
    If possible please reply me on my mail-id mhashmani@osius.com

    ReplyDelete
    Replies
    1. https://abduulwasiq.blogspot.com/p/interview.html

      Please see question 104

      Delete
  6. hi sir
    i read ur blog every time,it seems to be very informative
    i had question that
    i have oracle linux os,oracle 11g database software
    i want to install my oracle 11g database software on my linux os
    how do i install it?
    is there any prerequisite needed?
    plz give it step by step installation process of oracle 11g database on oracle enterprise linux?
    sys specification
    8gb ram
    win 8(64 bit)---host os
    linux (64 bit)---guest os
    vmware (virtualization)

    ReplyDelete
  7. Abdul bhai could you please send me the steps to apply a patch in multinode environment in R12.1 and R12.2

    Thanks
    Naseem.Shaik

    ReplyDelete
    Replies
    1. Hi Naseem,

      Suppose you are having DB/CM on node 1
      Forms and report on Node 2
      Bring down application services from Node 2 using adstpall.sh (applmgr user)
      Bring down application services from Node 1 using adstpall.sh (applmgr user)
      Enable maintainance Mode
      Apply patch from CM node
      Disable maintainance mode
      start CM , Forms and report services

      Delete