Session info at Oracle


SELECT 'USERNAME : ' || s.username || CHR (10) 
 || 'SCHEMA : ' || s.schemaname || CHR (10)
 || 'OSUSER : ' || s.osuser || CHR (10) 
 || 'PROGRAM : ' || s.program || CHR (10) 
 || 'MACHINE : ' || s.machine || CHR (10) 
 || 'TERMINAL : ' || s.terminal || CHR (10) 
 || 'SPID : ' || p.spid || CHR (10) 
 || 'SID : ' || s.sid || CHR (10) 
 || 'SERIAL# : ' || s.serial# || CHR (10) 
 || 'TYPE : ' || s.TYPE || CHR (10) 
 || 'SQL ID : ' || q.sql_id || CHR (10) 
 || 'CHILD_NUMBER : ' || q.child_number || CHR (10) 
 || 'SQL TEXT : ' || q.sql_text
 RESULT
 FROM v$session s, v$process p, v$sql q
 WHERE s.paddr = p.addr AND s.sql_id = q.sql_id(+) AND p.spid = '&&MY_PID';

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: