Tuesday, October 7, 2014

Everything About Oracle Apps R12.2 Online Patching – Part II

The Online Patching Cycle- Step by Step

Click here to read previous first part of this blogpost - Click here


All patches to an editioned system are applied in below explained sequence of an Online Patching Cycle.
1)    Prepare - creates the patch edition.
“ADOP” is the new ad utility given by Oracle for patching the Oracle Apps R12.2 environments.
ADOP is similar to our old adpatch.

What actually happens during “PREPARE” phase?
Before applying a patch, you must start an Online Patching Cycle. This is done using the adop "prepare" command. Connect to the primary application-tier node of your target system and source the run edition environment file. Then execute the prepare command.





[ajithpathiyil1:ajithebs:applmgr]> . /u02/app/applmgr/120/ajithebs/EBSapps.env run

  E-Business Suite Environment Information
  ----------------------------------------
  RUN File System : /u02/app/applmgr/120/ajithebs/fs1/EBSapps/appl
  PATCH File System : /u02/app/applmgr/120/ajithebs/fs2/EBSapps/appl
  Non-Editioned File System : /u02/app/applmgr/120/ajithebs/fs_ne
  DB Host: ajithpathiyil1.lab.com  Service/SID: ajithebs

  Sourcing the RUN File System ...

[ajithpathiyil1:ajithebs:applmgr]> adop phase=prepare


Note:- In case, the previous patch cycle did not complete its cleanup phas, The new adop prepare phase will execute the clean-up phase of previous cycle, if needed, and then proceed with preparing the new patch edition for new Online patching cycle.

  • Create a new database patch edition
  • Synchronize the file system patch edition with the run edition
  • Configure the patch edition for use by the patching tools

File system synchronization may be done by applying the delta (changes) from the previous patching cycle, or by re-creating the entire patch edition file system as a fresh copy of the run edition (called "fs_clone"). When complete, check the exiting status code (success is '0'):

adop exiting with status = 0 (Success)
 

Once prepare phase is complete, the database and file system patch edition will contain a copy of the run edition code and seed data.

Now the instance is ready for ARU or Manual Patching to the Patch Edition

2)    Apply - apply ARU or manual patches to the patch edition.
Below steps can be followed for ARU Patches


  • Download the patch bundle from ARU from metalink.
  • SCP the ZIP files in the "fs_ne/EBSapps/patch" directory on the Middle-tier
  • Use "adop phase=apply" command for patch application.
[ajithpathiyil1:ajithebs:applmgr]> adop phase=apply patches=12345678
    ...

[ajithpathiyil1:ajithebs:applmgr]> adop phase=apply patches=12345678,12312345
    ...

Below steps can be followed for Manual Patches.
Manual patching is similar to our old R12.1 or 11i methods but the only difference being that the update happens in the patch edition only.

  • Copy patch files to their destination directories in the patch edition.
  • Execute any commands necessary to deploy changes to the file system.
  • Execute any commands necessary to deploy changes to the database.
  • Update the custom synchronization driver to include any file system actions that must be executed again on the next prepare phase, in order to synchronize the alternate file system.  
 
Note:- The above steps can be automated using code migration tools like HP PPM Kintana or Dell Stat or Any other tools. My Favourite is HP PPM tool  :)  (Its deployment module).




[ajithpathiyil1:ajithebs:applmgr]> . /u02/app/applmgr/120/ajithebs/EBSapps.env patch

  E-Business Suite Environment Information
  ----------------------------------------
  RUN File System : /u02/app/applmgr/120/ajithebs/fs1/EBSapps/appl
  PATCH File System : /u02/app/applmgr/120/ajithebs/fs2/EBSapps/appl
  Non-Editioned File System : /u02/app/applmgr/120/ajithebs/fs_ne
  DB Host: ajithpathiyil1.lab.com  Service/SID: ajithebs

  Sourcing the PATCH File System ...

[ajithpathiyil1:ajithebs:applmgr]> cd $NE_BASE/EBSapps/patch/mypatch
[ajithpathiyil1:ajithebs:applmgr]> apply_fs.sh

    # apply patch to file system
    cp fnd/patch/115/sql/* $FND_TOP/patch/115/sql

[ajithpathiyil1:ajithebs:applmgr]> apply_db.sh

    # apply patch to database
    sqlplus apps/apps @$FND_TOP/patch/115/sql/ajith_pks.sql
    sqlplus apps/apps @$FND_TOP/patch/115/sql/ajith_pkb.sql



After applying an ARU patch or a manual patch you can look at the patch edition file system or database status to verify that the patching actions were successful and that the resulting patch edition code and seed data are as expected.

[ajithpathiyil1:ajithebs:applmgr]> . /u02/app/applmgr/120/ajithebs/EBSapps.env patch

  E-Business Suite Environment Information
  ----------------------------------------
  RUN File System : /u02/app/applmgr/120/ajithebs/fs1/EBSapps/appl
  PATCH File System : /u02/app/applmgr/120/ajithebs/fs2/EBSapps/appl
  Non-Editioned File System : /u02/app/applmgr/120/ajithebs/fs_ne
  DB Host: ajithpathiyil1.lab.com  Service/SID: ajithebs

  Sourcing the PATCH File System ...


[ajithpathiyil1:ajithebs:applmgr]> sqlplus apps/*****
SQL> show errors package ajith_pks
SQL> show errors package body ajith_pkb
SQL> quit

3)    Finalize - perform any actions required to prepare for cutover.



ü        The finalize phase is used by the Online Patching system to perform any final actions needed to make the system ready for the fastest possible cutover. 

      The finalize command is run as follows:


    [ajithpathiyil1:ajithebs:applmgr]> adop phase=finalize

      The finalize command should not have any error, In case of error, the system is not ready for cutover
ü      After successful completion of the finalize phase, the system is ready for cutover

      Note:- We do not need to execute the cutover immediately; Cutover can be delayed until a convenient time in the future. In the meantime, We may also apply additional patches if needed, but you will need to run the finalize phase again after doing so.


4)   Cutover - Promote Patch Edition to be the new Run Edition.

ü        The cutover phase will configure the patch edition to become the new run edition, and restart the application on this new run edition.

Note:- Since the run/patch designation of the dual file systems are swapped during cutover, you must re-source the run edition environment directly after cutover.


 
[ajithpathiyil1:ajithebs:applmgr]> adop phase=cutover
...

[ajithpathiyil1:ajithebs:applmgr]> . /u02/app/applmgr/120/ajithebs/EBSapps.env run

  E-Business Suite Environment Information
  ----------------------------------------
  RUN File System : /u02/app/applmgr/120/ajithebs/fs1/EBSapps/appl
  PATCH File System : /u02/app/applmgr/120/ajithebs/fs2/EBSapps/appl
  Non-Editioned File System : /u02/app/applmgr/120/ajithebs/fs_ne
  DB Host: ajithpathiyil1.lab.com  Service/SID: ajithebs

  Sourcing the RUN File System ...



5)   Cleanup - remove obsolete code and data from old editions.


  • The cleanup phase will remove unnecessary code and data from old editions that are no longer needed by the running application.
  • Cleanup should be run after cutover, at any time before the next prepare phase.
  • It is best to run cleanup immediately after cutover so that there is no delay when preparing the next online patching cycle.
There are two levels of cleanup available:

  • quick - the minimal cleanup required before starting the next patching cycle.
  • full - removes all obsolete code and data to recover maximum free space.
Quick cleanup is the default, and is all that is necessary after normal patching.


[ajithpathiyil1:ajithebs:applmgr]> adop phase=cleanup
[ajithpathiyil1:ajithebs:applmgr]> adop phase=cleanup cleanup_mode=full


   Note:- Use full cleanup periodically or after major updates to restore the system to optimal space usage.     

    Warning: full cleanup can take many hours and should only be done when there is no immediate need to   start a new patching cycle.



  HAPPY LEARNING!