Procedure for Killing sessions
Hi All,
Almost everyday we have requirement to kill user sessions for dev user, I'm thinking to create a procedure for this and grant to the users so that they can kill it by themself.
Below is the what I got from Ask Tom forum, however appreciate if someone can share few information if already imlemented in there environment
<quote>
create or replace procedure kill_session( p_sid in number,
p_serial# in number)
is
ignore pls_integer;
BEGIN
select count(*) into ignore
from V$session
where username = USER
and sid = p_sid
and serial# = p_serial# ;
if ( ignore = 1 )
then
execute immediate '
alter system kill session ''' ||
to_char(p_sid,'999999')||','||
to_char(p_serial#,'999999')||'''';
else
raise_application_error( -20001,
'You do not own session ''' ||
p_sid || ',' || p_serial# ||
'''' );
end if;
END;/
grant execute on kill_session to <username>
</quote>
Regards,
shaan