Have you looked at resource profiles? resource profiles are setup to do exactly this. You can set a maximum connect idle time. The sessions will be marked for kill when they exceed this limit.
In 7.3 and up, you can get this out of v$session:
ops$tkyte@8i> select sid,
2 username,
3 status,
4 to_char(logon_time,'dd-mm-yy hh:mi:ss') "LOGON",
5 floor(last_call_et/3600)||':'||
6 to_char(floor(mod(last_call_et,3600)/60),'fm00')||':'||
7 to_char(mod(mod(last_call_et,3600),60),'fm00') "IDLE",
8 program
9 from v$session
10 where type='USER'
11 order by last_call_et
12 /
SID USERNAME STATUS LOGON IDLE PROGRAM
---------- --------------- ---------- ----------------- ---------- -------------------------
119 OPS$TKYTE ACTIVE 28-02-00 02:12:15 0:00:00 sqlplus@aria (TNS V1-V3)
89 WEB$LALBRIGH ACTIVE 28-02-00 02:29:46 0:00:02 wrb21@aria (TNS V1-V3)
54 WEB$JGEMMELL ACTIVE 28-02-00 02:29:44 0:00:03 wrb21@aria (TNS V1-V3)
57 SCOTT INACTIVE 28-02-00 02:19:25 0:09:10 sqlplus@aria (TNS V1-V3)
110 OPS$CLBECK INACTIVE 28-02-00 02:03:22 0:23:10 sqlplus@aria (TNS V1-V3)
101 HOTEL INACTIVE 28-02-00 01:45:44 0:24:01 sqlplus@aria (TNS V1-V3)
88 REVIEW INACTIVE 28-02-00 08:38:16 5:42:45 sqlplus@aria (TNS V1-V3)
--
Thanks,
Thomas Kyte asktom_us@oracle.com
Oracle Service Industries
Oracle tips and papers </code>
https://asktom.oracle.com/magazine-archive.htm <code>