Friday, June 21, 2013

whatpatchnode


What EBusiness Suite Nodes are Updated by this Patch ?
If Your E-Business Suite Environment has MORE-THAN-ONE AppsTier-Node,
and you are NOT using a SHARED-FILE-SYSTEM between the AppsTier-Nodes, then
this Script will help determine if patches have been applied on ANY/ALL of the
AppsTier Nodes.


Example: 

#---------------------------------------------------------------#
#- What Patch Nodes Were Patched by Patch (whatpatchnode)      -#
#---------------------------------------------------------------#

                   OATC (oratest) Apps What Patch Modules
                 EBusiness Patch 16052604 Updated These Products

AD_Bugs    Node                       Patch                Patch
Patch      Patch                      Creation             LastUpdate
Number     Number     Node Name       Date                 Date
---------- ---------- --------------- -------------------- --------------------
16052604   16052604   oatcapd04       18-MAY-2013 01:35:30 18-MAY-2013 01:35:30




#!/usr/bin/ksh
#whatpatchnodes ()
#-----------------------------------------------------------------------#
#    Module Name:  whatpatchnode                                        #
#                                                                       #
#    Purpose:      Report on the which Nodes Have been Patched.         #
#                                                                       #
#    Maintenance                                                        #
#    Date          Author        Description                            #
#    -----------   ------------  -------------------------------------  #
#    10-May-2012   M.Barone      Module design/creation                 #
#-----------------------------------------------------------------------#
{
        DIRNAM=$(dirname $0)
        ORASID=$(echo $CONTEXT_NAME | cut -f1 -d'_')
        HNAME=$(uname -n)

        #---------------------------------------------------------------#
        #  TEST:  Number ($#) of arguments passed to this function?     #
        #---------------------------------------------------------------#
        if      [ $# = 0 ]
        then
            clear
            echo
            echo  " #---------------------------------------------------#"
            echo  " # whatpatchnode:   What Nodes were Patches by Patch #"
            echo  " #---------------------------------------------------#"
            echo                                                              

            #------------------------------------------------------------#
            #  Trap: Set CNTL-C CNTL-D CNTL-\ Before Password Protection #
            #------------------------------------------------------------#
            trap        "stty echo; return"     2                             
            trap        "stty echo; return"     3
            stty -echo

            read PASSWD?" Please Enter the Oracle APPS Passwd:  "

            stty echo
            echo
            #------------------------------------------------------------#
            #  Trap: Reset CNTL-C CNTL-D CNTL-\After Password Protection #
            #------------------------------------------------------------#
            trap        2
            trap        3

            read PTCHNM?" Please Enter the Patch-Number/Partial-Number: "

            clear
        else
            PASSWD=$1
            clear
        fi

#------------------------------------------------------------------------#
#  Initialize                                                            #
#------------------------------------------------------------------------#
        SPOOLNM=/tmp/whatpatchnode_$$.txt

#------------------------------------------------------------------------#
#  SQL*Plus ("Here-Document")                                            #
#------------------------------------------------------------------------#
sqlplus  -s  /nolog  <<-END_FILE

        CONNECT  APPS/$PASSWD

        SPOOL ${SPOOLNM}

        clear   BREAKS
        clear   BUFFER
        clear   COLUMNS
        clear   COMPUTES
        clear   SCREEN
        clear   SQL
        clear   TIMING

        set     feedback        off
        set     flush           on
        set     heading         on
        set     pause           off
        set     space           1
        set     termout         on
        set     verify          on
        set     linesize        80
        set     pagesize        999

        prompt #---------------------------------------------------------#
        prompt #- What Patch Nodes Were Patched by Patch (whatpatchnode)-#
        prompt #---------------------------------------------------------#

        COLUMN  datevalue       NOPRINT NEW_VALUE       DATEVAR
        COLUMN  timevalue       NOPRINT NEW_VALUE       TIMEVAR 

        TTITLE  CENTER  '${ORASID} (${HNAME}) Apps What Patch Modules'  -
                LEFT                                            skip 1  -
                CENTER  'EBusiness Patch ${PTCHNM} Updated These Nodes' -
                LEFT                                            skip 2

        alter session set NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';

        COLUMN ptchno   FORMAT A10  HEADING 'AD_Bugs|Patch|Number'
        COLUMN ptchnm   FORMAT A10  HEADING 'Node|Patch|Number'
        COLUMN nodenm   FORMAT A15 HEADING 'Node Name'
        COLUMN ptchcr   FORMAT A20 HEADING 'Patch|Creation|Date'
        COLUMN ptchdt   FORMAT A20 HEADING 'Patch|LastUpdate|Date'

        SELECT  ab.bug_number           ptchno,
                aap.patch_name          ptchnm,
                aat.name                nodenm,
                apr.creation_date       ptchcr,
                apr.end_date            ptchdt
        FROM    ad_bugs                 ab,
                ad_applied_patches      aap,
                ad_patch_drivers        apd,
                ad_patch_runs           apr,
                ad_appl_tops            aat
        WHERE   ab.bug_number           = aap.patch_name (+)
          AND   aap.applied_patch_id    = apd.applied_patch_id
          AND   apd.patch_driver_id     = apr.patch_driver_id
          AND   aat.appl_top_id         = apr.appl_top_id
          AND   aap.patch_name          = '${PTCHNM}';

END_FILE

print
print  "Please see  /tmp/whatpatchnodes_$$.txt"
print
}
 


No comments:

Post a Comment