Killing Invalid Sessions to increase Performance of Database ~ OracleSource

Monday, June 30, 2008

Killing Invalid Sessions to increase Performance of Database

Many times we face performance problem on an application running on web. The reason can be many.
I have pointed out a common reason which is due to the INCATIVE sessions when user
either closes the window or leave it for long time or for any other reason.
The INVALID sessions needs to be killed to avoid performance issues.

To kill inactive session created at database end(with dba previledge), we have two options:

1)Get session serial#'s -
Please query all sessions from v$sessions where status='INACTIVE' first
SELECT sid,serial#,osuser,(last_call_et/60) as idle_time FROM v$SESSION;

Alter system kill session 'sid,serial#';
Example :- Alter system kill session '156,1';

2). Create a profile with a resource_name as IDLE_Time settings as 30 Minutes.
For this, resource_limit parameter has to be set to true.
This will enable the settings such that, all inactive sessions for more than 30
minutes will be killed. These will show up as SNIPED in v$session and after
some time will be released automatically.

If you are in dedicated server environment then for the first step do the following:
Alter system set resource_limit=true;
create profile only30minutes_of_inactivity limit idle_time 30;
alter user profile only30minutes_of_inactivity;

No comments: