Saturday, 10 October 2015

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

No comments:

Post a Comment