Session


set linesize 138
set pagesize 200
col c1 for a9
col c1 heading "OSUser"
col c2 for a9 trunc
col c2 heading "OraUser"
col b1 for a6 
col b1 heading "OSPID"
col b2 for 9999 justify left
col b2 heading "OraSID"
col b3 for 999999 justify left
col b3 heading "Serial#"
col b5 for a3 trunc
col b5 heading STS
col sql_text for a65
set space 1
break on b1 nodup on c1 nodup on c2 nodup on b2 nodup on b3 skip 3
select c.spid b1, b.osuser c1, b.status b5,b.username c2, b.sid b2, b.serial# b3,to_char(b.logon_time,'DDMonYY HH24:MI:SS') 
LOGIN_TIME,a.sql_text from V$SQLTEXT a, V$SESSION b,V$PROCESS c 
where a.address = b.sql_address 
-- and b.status = 'ACTIVE' /* CHOOSE THIS OPTION ONLY TO SEE ACTVE TRANSACTION ON THAT MOMENT */ 
and b.paddr = c.addr 
and a.hash_value = b.sql_hash_value order by c.spid,a.hash_value,a.piece; 
exit

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: