************************************************************************
* Description: SQL for checking and killing session count by time frame
* Compatiablity: RDBMS 11g, 12c
* Date: 03:27 PM EST, 03/27/2017
************************************************************************


<1> Dynamic SQL to kill inactive session:
     | 
     |__ SQL> select 'alter system kill session '||''''||sid||','||serial#||''''||' immediate;' 
              from v$session where username is not NULL and status='INACTIVE' and logon_time < to_date('1:00 03-27-2017', 'HH24:MI MM-DD-YYYY') and last_call_et > 1200;
	 

<2> Session group by status:
     |
     |__ SQL> select count(*),status from v$session where username is not null group by status;