Script to show Unix Details for a Specified SID

SET VERIFY OFF
SET ECHO OFF
SET FEEDBACK ON
SET PAGES 80
SET LINES 132

REM
REM || Title : show_unixdets.sql
REM ||
REM || Purpose : This script display Unix process details for a specified SID
REM ||
REM ||
REM || Release No : 1
REM ||
REM || Variables : None
REM ||
REM || Schema : sys
REM ||
REM ||

UNDEFINE ora_sid


COLUMN machine FORMAT a10
COLUMN sid FORMAT 99999
COLUMN serial FORMAT 99999
COLUMN process_id FORMAT a10
COLUMN username FORMAT a10
COLUMN osuser FORMAT a10
COLUMN logon_time FORMAT a10


SELECT 'On Client ' location,
''
|| b.pid process_id,
a.sid,
a.serial#,
a.username,
a.osuser,
a.machine,
a.logon_time
FROM v$session a,
v$process b
WHERE a.paddr = b.addr
AND a.sid = &&ora_sid
UNION
SELECT 'On HOST ',
a.process process_id,
a.sid,
a.serial#,
a.username,
a.osuser,
a.machine,
a.logon_time
FROM v$session a
WHERE a.sid = &&ora_sid

SPOOL show_unixdets.lis
/
SPOOL OFF

UNDEFINE ora_sid

This script is provided for educational purposes only. The script has been tested and appears to work as intended. However, you should always test any script before relying on it. No responsibility will be accepted for Lost or damage that may occur from it's use.