You can use profiles (see concepts and admin guide) or you can use dbms_jobs to look for and kill sessions on a recurring basis. Profiles have the downside that they will send a kill to the client and wait for the client to acknowledge -- so the sessions will tend to stay in the database until the client does something in the database -- discovers it was killed and then goes away.
To use dbms_jobs and plsql for example, if you use the last_call_et column in v$session for INACTIVE sessions, you can find all users inactive for 6 hours of more:
1 select 'alter system kill session ''' || sid || ',' || serial# || '''; /* ' || username || ' */'
2 from v$session where username is not null
3 and status = 'INACTIVE'
4* and last_call_et/60/60 >= 6
ops$tkyte@8i> /
'ALTERSYSTEMKILLSESSION'''||SID||','||SERIAL#||''';/*'||USERNAME||'*/'
----------------------------------------------------------------------------------------------------
alter system kill session '7,11639'; /* REVIEW */
alter system kill session '59,5939'; /* ATCDEMO */
If you use dbms_sql to dynamically execute SQL (make sure to grant ALTER SYSTEM to the owner of the procedure, see </code>
http://asktom.oracle.com/Misc/RolesAndProcedures.html <code>for the reason why), you could write a procedure that is run every N minutes using dbms_jobs to kill these idle sessions.