Saturday, August 17, 2019

ADPATCH



Oracle EBS is set of many application. The technology stack consists of Application filesystem, database  and IAs server.
We often need to patch it either to fix a bug or upgrade it. This article we are presenting the basics of  patch and how patching is done in Oracle EBS environment.

What is patch ?

When a customer reports a problem or TAR (Technical Assistance Request) a support analyst investigates the problem. If a patch doesn’t exist to fix the problem, the problem is logged as a bug. Development researches the bug and creates a patch.

Types of application patches ?

• Stand-alone (one-off) Patch:  Addresses a single fix or enhancement. Stand-alone patches are released only when there is an immediate need for a fix or enhancement that cannot wait until an aggregate bundling is available. Although stand-alone patches are intended to be as small as possible, they usually include any dependent files that have changed since the base release in order to form a complete patch that can be applied by any customer.
The actual number of files changed will depend on the current code level on the system to which the patch is being applied.

• Rollup Patch (RUP): An aggregation of patches that may be at the functional level, or at a specific product/family release level. For example, a Flexfields rollup patch contains all the latest patches related to Flexfields at the time the patch was created. A Marketing Family 11.5.9 rollup patch contains all the latest Marketing patches released since, and applicable to, 11.5.9.

Simply we can say A rollup patch is one which will deliver bug fixes identified after the release of any major application versions like 12.1.3

• Mini-pack: An aggregation of patches at the product level. For example, Inventory Mini-pack G (11i.INV.G) contains all the latest patches for the Inventory product at the time the mini-pack was created.Mini-packs are cumulative.

In other words , A mini pack is one which will upgrade any product patchset level to next level like AD.H to AD.I

• Family Pack: An aggregation of patches at the product family level. For example, HR Family Pack C (11i.HR_PF.C) contains all the latest patches for products in the HR family at the time the family pack was created. Family packs are cumulative.
Simply we can say,A Family pack is one which will upgade the patchset level of all the products in that family to perticular patchsetlevel.

• Maintenance Pack: An aggregation of patches for all products in the E-Business Suite. For example, Release 11.5.10 Maintenance Pack contains all the latest code level for all products at the time 11.5.10 was created. Maintenance packs are numbered sequentially such as 11.5.8, 11.5.9, 11.5.10, and are cumulative
Simply We can say A maintanance pack will upgrade applications from one version to another like 12.1.2 to 12.1.3

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

Patches can also be organized by purpose.

• Diagnostic Patch: Used to gather additional information when a product failure cannot be reproduced by Oracle. The additional information will assist Oracle Support Services and Oracle Development in resolving the failure.• Interoperability Patch: Allows Oracle Applications to function properly with a newer version of the technology stack. Interoperability patches are typically required with new version of the database or Applications technology stack.

• Translated Patch: A non-English version of a patch. Release 11i supports 30 non-English languages. Customers who are using languages other than English, need to apply the corresponding translated patch(es) for the languages they are using in addition to any base US patch(es).

• Merged Translation Patch: Provided in real time (without requiring a translator) in the event a translated patch is not available when a customer needs it. A merged translation patch is applied just like a fully translated patch. The fully translated patch is escalated and is usually available within 24 hours. It can be applied safely on top of a merged translation patch.

• Translation Fix:
Provided in the event a translation word choice is inappropriate. A translation fix is applied just like a translated patch, except there is no corresponding base US patch.

• New Feature Patch:
Introduces new functionality and/or products. It is applied using standard patching utilities.

About Patch Structure:-

Patch Structure is formed by a top-level directory with several files nested under it. Top-Level directory is the Patch Number and various files in a Patch are:-

Ø  Readme Files

Readme.txt and Readme.html files describes:-

·         Software Requirements like patches to be applied before applying this patch or what Application Release we should have.

·         Disk Space Requirements

·         Manual Steps to Run.

·         Problems Fixed in this Patch

·         Post Patching Steps.



Ø  Patch Driver Files

Patch Driver files consist of various files:-

·         Copy Driver Files(Which Copies the product files)

·         Database Driver Files(Which changes the database objects)

·         Generate Driver Files(Which generates forms, graphics, messages and new objects)

Nowadays most Patches contains one unified driver (where all driver files are placed in a single unit)

More info about C,D,G and U drivers,

• Copy driver (c driver): Named c.drv, and contains commands to change Oracle Applications files. The commands include directives to copy/update files, libraries, and/or Java, and commands for generating JAR files and relink C executables. In a multi-node system, run it on all application tier APPL_TOPs. It does not make use of FND_INSTALL_PROCESSSES

• Database driver (d driver):
Named d.drv, and contains commands to change Oracle Applications database objects, such as PL/SQL and table definitions, or to update or migrate data. In a multi-node system, run it only on the application tier APPL_TOP that implements the admin server. It does make use of FND_INSTALL_PROCESSSES

• Generate driver (g driver): Named g.drv, and contains commands to generate forms, reports, and/or graphics files. In a multi-node system, run it on all application tier APPL_TOPs, unless the APPL_TOP only implements the admin server. It does make use of FND_INSTALL_PROCESSSES

• Unified driver (u driver): Named u.drv, it is a consolidated driver containing all copy, database, and generate actions. Apply this driver to all APPL_TOPs on all application tier servers. AutoPatch knows which command should be run on each type of application tier. The unified driver requires only a single execution of AutoPatch. It is currently used only in the Release 11.5.9 Maintenance Pack.It does make use of FND_INSTALL_PROCESSSES

If you merge a patch that contains a unified driver with patches that contain other drivers, the resulting merged patch will contain only a merged unified driver.



Ø  Replacement Files

These files are listed in the copy driver which replaces the outdated forms, reports, html files, sql scripts, object modules with newer versions of files.



Ø  Metadata Files

This contains a list of files included in this patch and the relationship between this patch and other patches. The information in this patch helps you to determine the pre-requisites patches and analyze the impact of patches in this system.


How the patches are applied in EBS ?
Patches in Oracle Applications are applied using the patch utilities.
Patching Utilities:-

1. Auto Patch(adpatch)

2. AD Merge Patch

3. Patch Wizard


Number of Parallel Workers
--------------------------


By default, AutoPatch runs database updates and file generation commands in parallel and prompts you for the number of workers. Tasks are assigned to workers, the workers run the tasks to completion, and AutoPatch assigns new tasks.

The default value for the number of workers is two times the number of CPUs on the node from which you run AutoPatch. Oracle recommends specifying the number of workers as between two and four times the number of CPUs.

Backup Directory

----------------
When AutoPatch runs, a backup directory is created in the directory where you unzip the patch. The old version of each file updated by the patch is copied into the backup directory. When applying large patches (such as release update packs, product family RUPs, and pre-upgrade patches), ensure there is enough disk space on the system where you unzip the patch, or the patching process may fail. We recommend having at least twice the amount of disk space as the unzipped patch file uses.

Tip: Periodically, you can delete the files in the backup directory to free the space.


1.ADPATCH:

----------
When ever applying an application patch, always must should follow the Readme.txt or Readme.html file. And always advised to first test the patches on Test Environment, then go for production Environment.

Step 1: Download the patch to your pc and transfer it to Linux server
login to oracle metalink. (www.metalink.oracle.com)
Select the patches option then select the search type.

Search for patch by writing the patch no. & platform on which you want to download the patch.
Click download.
If you have downloaded the patch at desktop then transfer it to Linux server by using Winscp or any other software.

Note:

Here, you can download the patch and put in any directory.
Unzip the patch.

But while running adpatch it will ask like below path where we need to provide the patch location:

Enter the directory where your Oracle Applications patch has been unloaded

The default directory is [/proxy/ebs/uat01/apps/apps_st/appl/ad/12.0.0/bin] : /<patch directory>

Note: To run the adadmin we need to go adadmin directory. If you are not sure ten you can use below command as:
$ which adadmin
$APPL_TOP/ad/12.0.0/bin/adadmin

Same way if you want to run adpatch then we need to go adpatch directory. If you are not sure then you can use below command as:
$ which adpatch
$APPL_TOP/ad/12.0.0/bin/adpatch

In below example, we are putting patches in same location at adpatch.



Step 2: Unzip the patch. And set the permission

$pwd
/opt/oracle/VIS/apps/apps_st/appl/ad/12.0.0/bin

$ unzip p9501440_R12.XDO.B_R12_GENERIC.zip

$ chmod 755 9501440


Step 3: Before applying a patch you must check whether the patch is already applied or not and check for number/list of invalid objects. For this we query the database:

[root@r12 ~]# su - oracle
$ sqlplus apps/*****

SQL> select * from AD_BUGS where bug_number='<patch number>';

For Example:
SQL> select * from AD_BUGS where bug_number='9501440';
no rows selected

Check for INVALID objects.

SQL>Select count(*) from dba_objects where status='INVALID';
SQL> select owner,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where STATUS='INVALID';

Step 4: Run the environment variable for application on Application Tier.

$ cd /opt/oracle/VIS/apps/apps_st/appl/
$. ./APPSVIS_r12.env

Step 5: Stop the application with adstpall.sh utility. We are stopping applications because we are not using Hot Patch.

(Please Note: Database and Listener should be up because while appying patch it will update tables)

$ pwd
/opt/oracle/VIS/inst/apps/VIS_r12/admin/scripts

$ ./adstpall.sh apps/*****


Step 6: Enable the Maintenance Mode

Before you initiate an AutoPatch session, you must shut down the Workflow Business Events System and set up function security so that no Oracle E-Business Suite functions are available to users. This ensures optimal performance and reduces downtime when applying a patch. Maintenance mode provides a clear separation between normal runtime operation of Oracle E-Business Suite and system downtime for maintenance.
During a Maintenance mode downtime, user login is restricted. Users are redirected to a system downtime URL, which informs them that the maintenance session is in progress. The Oracle Applications Manager (OAM) Maintenance Mode page allows you to schedule system downtime and send alert messages to notify users of the downtime schedule.
To enable or disable Maintenance mode, use the Change Maintenance Mode menu in AD Administration. See: Changing Maintenance Mode, Oracle E-Business Suite Maintenance Utilities.

Caution: You can run AutoPatch by using options=hotpatch on the command line when Maintenance mode is disabled. However, applying a 'hot patch' may result in significant degradation of system performance. For more information, see AutoPatch Options.

$ pwd
/opt/oracle/VIS/apps/apps_st/appl/ad/12.0.0/bin
$./adadmin

* Provide patch log file name as:
Filename [admin.log]: patchnumber.log

* Batchsize leav it as default, hit enter.
Batchsize [1000]:

* Enter the password for SYSTEM, and then apps password.
By Default System and Apps password is as shown below:

Enter the password for your 'SYSTEM' ORACLE schema: manager
Enter the ORACLE password of Application Object Library [APPS]: apps
1. Generate Applications Files menu

2. Maintain Applications Files menu

3. Compile/Reload Applications Database Entities menu

4. Maintain Applications Database Entities menu

5. Change Maintenance Mode

6. Exit AD Administration

* Select an option 5 and press enter key to Change Maintenance Mode.

* Then, Select an option 1 and press enter to Enable Maintenance Mode.

* Press enter to continue.

* Select option 3 and press Enter key to return to main menu .

* Press enter to Exit AD Administration

Step 7: Run autopatch (adpatch) from the patch directory by entering the following command:

$pwd
/opt/oracle/VIS/apps/apps_st/appl/ad/12.0.0/bin

$ ls -l adpatch
-rwxrwxrwx 1 oracle oinstall 9380 Mar 31  2009 adpatch
$./adpatch


After applying successfully patch disable the Maintenance mode as below.

Step 8: Disabling maintenance mode.

The disabling steps are just same as enabling maintenance mode as shown above steps only the thing is you have to select 2 options to Disable maintenance Mode.
After running



./adadmin read carefully options and choose as 5->2->3->6.

5--> Change maintenance mode.
2--> Disable  maintenance mode.
3--> Return to Main Menu.
6--> Exit AD Administration.

Step 9: After disabling the Maintenance Mode, we need to start the services.

$cd $ADMIN_SCRIPTS_HOME

$./adstrtal.sh apps/<apps_pwd>

After checking all the services from backend like:
$ps –ef|grep applmgr |wc –l
Or
$ps –ef|grep FNDLIBR
Or
$ps –ef|grep FND*

Once all the services are UP and Running.

Step 10: Check for Number of Invalid Objects from below command:

SQL>Select count(*) from dba_objects where status='INVALID';

SQL> select owner,OBJECT_NAME,OBJECT_TYPE,STATUS from dba_objects where STATUS='INVALID';

If there is any new invalid objects then need to recompile.

Then does the front-end sanity check such as checking all the Concurrent Manager’s status and Submit a request.


Log Files:

In addition to the main log file (adpatch.log), AutoPatch also creates several other log files for specific purposes, for example, to record all the actions associated with parallel workers. The log files are written to $APPL_TOP/admin/<SID>/log (UNIX), where <SID> is the value of your ORACLE_SID or TWO_TASK variable, or in %APPL_TOP%\admin\<SID>\log (Windows), where <SID> is the value of ORACLE_SID or LOCAL. Review these files when the AutoPatch session is complete.

The log directory contains adpatch.log and adpatch.lgi, and may contain one or more additional files as described in the following table.

Log Files
-------------------------------------------------------
Log File Used For
adpatch.log Main AutoPatch log file (default name)
adpatch.lgi AutoPatch informational messages (default name)
adrelink.log Relinking
adlibin.log Moving C object files into the C library of a product
adlibout.log Moving C object files out of the C library of a product
adworkxxx.log Database operations run in parallel
<language>_<filename>_ldt.log Seed data loader files

ORACLE DATABASE CONTENT

ORACLE DATABASE 11gR2 & 12C  CONTENT Pre-Requisite: UNIX, SQL Basics Introduction to Oracle Database §   Introduction of Database ...