How To Identify Database Idle Sessions


The below scripts will identify the Database Idle Session .When on firing the below the scripts, it will prompt for the number of minutes the session is idle for.
[oracle@server1 ~]$ sqlplus / as sysdba
SQL> set linesize 140
SQL> col username format a15
SQL> col idle format a15
SQL> col program format a30


Now Enter the number of minutes for which the sessions should have been idle:
PROMPT

SQL> select sid,username,status,
to_char(logon_time,'dd-mm-yy hh:mi:ss') "LOGON",
floor(last_call_et/3600)||':'||
floor(mod(last_call_et,3600)/60)||':'||
mod(mod(last_call_et,3600),60) "IDLE",
program from v$session where type='USER'
and (LAST_CALL_ET / 60) > &minutes
order by last_call_et;


No comments:

Post a Comment