Kill Forms Db Long

download Kill Forms Db Long

of 4

Transcript of Kill Forms Db Long

  • 8/3/2019 Kill Forms Db Long

    1/4

    le:///C|/blog/kill_forms_db_long.txt

    bin/ksh

    ============================================================================

    Program kill_forms_db_long.ksh - Kill long running/inactive forms processes

    History:

    Date Who Description

    ------- ------------- -----------------------------------

    4/09/07 Navdeep Saini Initial Creation

    4/20/07 Navdeep Saini Hard coded the forms: INVTTMTX, INVTVQOH, INVTOTRXUsage:

    kill_forms_db_long.ksh [SID]

    ============================================================================

    ############################################################

    serror: echos the usage error line and exits with an exit code of 1

    ###########################################################

    et environmental variables

    mmand=$(print $0 | awk -F/ '{print $NF }')

    eset -xu ORACLE_SIDOG=${HOME}/local/log/kill_forms_db_long.log

    W=/usr/local/bin/GetPass.ksh

    eset -x HOSTNAME=$(hostname)

    eset -x DATE=$DATE

    nction userror

    rint "Usage: $command []"

    xit 2

    ###########################################################heck that applmgr is running this script

    [ $(/usr/bin/whoami) != applmgr ]]; then

    cho "You must be applmgr to run this script."

    xit 1

    ##########################################################

    f there are no command line parameters the script is in error

    [ $# = 0 ]]; then

    rint "Please enter the proper number of command line parameters"

    serror

    RAENV_ASK=NO

    eset -x ORACLE_SID=$1

    sr/local/bin/db

    {PW} system

    Check to see if the SYSTEM password is available

    le:///C|/blog/kill_forms_db_long.txt (1 of 4) [5/22/2007 2:34:54 PM]

  • 8/3/2019 Kill Forms Db Long

    2/4

    le:///C|/blog/kill_forms_db_long.txt

    [ -z ${SYSTEM_PASS} ]]; then

    print "${PW} does not have the SYSTEM password for $ORACLE_SID"

    userror

    ##########################################################

    Main

    ###########################################################

    plus -s

  • 8/3/2019 Kill Forms Db Long

    3/4

    le:///C|/blog/kill_forms_db_long.txt

    head off

    feedback off

    ool /tmp/db_sessions.lst

    lect

    er system kill session '''||s.sid||','||s.serial#||''';'

    FROM

    V\$SESSION s

    , V\$PROCESS p

    WHERE

    s.paddr = p.addr

    AND

    s.username IS NOT NULL

    AND

    s.username = 'APPS'

    AND

    s.osuser = 'applmgr'

    AND

    s.last_call_et/3600 > 1

    and

    s.action like 'FRM%'-- and s.module in ('INVTTMTX','INVTVQOH','INVTOTRX')

    and

    s.status='INACTIVE';

    ool off

    ool /tmp/forms_session.sh

    LECT

    'remsh '||s.machine||' kill -7 '||s.process

    FROM

    V\$SESSION s

    , V\$PROCESS p

    WHEREs.paddr = p.addr

    AND

    s.username IS NOT NULL

    AND

    s.username = 'APPS'

    AND

    s.osuser = 'applmgr'

    AND

    s.last_call_et/3600 > 1

    and

    s.action like 'FRM%'-- and s.module in ('INVTTMTX','INVTVQOH','INVTOTRX')

    and

    s.status='INACTIVE';

    ool off

    OF

    at /tmp/kill_forms_db.lst |awk '{print "alter system kill session ('" $7 "\,'" $8}'

    mail -s "Long running forms sessions in "$HOSTNAME [email protected] < /tmp/kill_forms_db.lst

    /tmp/kill_forms_db.lst >> $LOG

    le:///C|/blog/kill_forms_db_long.txt (3 of 4) [5/22/2007 2:34:54 PM]

  • 8/3/2019 Kill Forms Db Long

    4/4

    le:///C|/blog/kill_forms_db_long.txt

    /tmp/db_sessions.lst >> $LOG

    /tmp/forms_session.sh >> $LOG

    heck to see if any rows returned and run the kill db and forms

    UMROWS=`cat /tmp/kill_forms_db.lst|grep "no rows selected"`

    cho $NUMROWS

    [ $NUMROWS != "no rows selected" ]] then

    plus -s