Showing posts with label Database Session. Show all posts
Showing posts with label Database Session. Show all posts

Sunday 19 October 2014

Find Database Session Idle/Inactive more then 2 hours

### Find the Database sessions who are Idle more than two hours but connected through application###

select 'alter system kill session ''' ||sid|| ',' || serial#|| ''' immediate ;',logon_time,machine,status,osuser,lockwait
from v$session
where machine  like 'SBLC%'
and status ='INACTIVE'
and logon_time

Note: Here machine name should be application servers name.

###Kill the found session###

alter system kill session '656,31665' immediate ;
alter system kill session '1011,2111' immediate ;
alter system kill session '3478,45629' immediate ;
alter system kill session '5979,43717' immediate ;
alter system kill session '6293,17609' immediate ;


If any issue just give me a buzz....cheers....