col sid form 999 col serial# form 999 col waitime form 9999 heading 'Idle|Mins' col logontime heading 'Logon|Time' col machine heading ' User|Machine' select a.sid,b.serial#,round(a.seconds_in_wait/60) waitime, substr(b.machine,1,15) machine, substr(to_char(b.logon_time,'HH:MI:SS'),1,10) logontime from v$session_wait a, v$session b where a.sid=b.sid and b.type <>'BACKGROUND' order by waitime desc ,machine /