kingno1
asked on
Killing Inactive Oracle database sessions
Hello, I have installed a database with 250 sessions specified in the init file.
I still see a lot of inactive sessions in the database once in a while.
I would like to kill/terminate any sessions that are inactive for 2 hours. How do I achieve this?
Lets say use scott has 10 sessions and only 2 of them are inactive for over 2 hours, I would like to kill only those 2.
Please suggest.
Thank you.
I still see a lot of inactive sessions in the database once in a while.
I would like to kill/terminate any sessions that are inactive for 2 hours. How do I achieve this?
Lets say use scott has 10 sessions and only 2 of them are inactive for over 2 hours, I would like to kill only those 2.
Please suggest.
Thank you.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thank You.
select 'alter system kill session '|| sid || ',' || serial# || ';'
from v$session
where user ='SCOTT' -- i have used SCOTT for example , change it accordingly if you want some other user
and status ='INACTIVE' -- to only get inactive sessions
thanks