Scripts   Home

Find Related Unix Processes of Baan Sessions on Application Servers and Database Server

Use this to find sessions related on different hosts. It is a shell script wrapping SQLPLUS.

#!/bin/ksh
# More scripts at http://www.tc.umn.edu/~hause011

# Find related user Unix process ids of baan sessions on 
# Application Servers and Database Server. If servers are separate hosts
# it is good to know which sessions are related.

# NOTE: run from Oracle Database Server host.

get_session () {
sqlplus -s << EOF
system/manager
set heading off
set feedback off
set pages 50
select 'Database is ', name from v\$database;
set heading on
column host format a8 heading "Host"
column luser format a8 heading "luser"
    select
           s.SID,
           s.OSUSER luser,
           s.MACHINE host,
           s.PROCESS,
            '$MACHINE ' ||p.spid,
           s.logon_time
    from V\$session s, V\$process p
    where addr=paddr
    and TYPE='USER'
    order by s.logon_time;
EOF
}

#####################################
# Main

# Have an environment for $ORACLE_HOME/bin, $ORACLE_SID set up here.
export MACHINE=`uname -n`
echo
echo ' USERS and hosts.'
echo
get_session

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

The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.