SQL to find how long a session has been ACTIVE or IDLE, very handy.
There are up to one thousand sessions connected to Oracle Database from a Weblogic connection pool. User wanted to know how long those sessions have been idle ( INACTIVE), so the Weblogic connection pool can be reviewed and reconfigured properly.
The below query can be run to meet this requirement:
If the session STATUS is currently ACTIVE, then the value represents the elapsed time in seconds since the session has become active.If the session STATUS is currently INACTIVE, then the value represents the elapsed time in seconds since the session has become inactive.
The below query can also get the results as per Oracle Doc ID 365693.1.
SQL>select sid, seconds_in_wait
and event='SQL*Net message from client'
order by seconds_in_wait desc;