It is definitely an useful script to have especially if you are lazy dba like me to offload repetitive work.
Vijai, I went through your code. My understanding is, whenever developer calls, we can use this procedure to kill the session. Still we have to kill the session every time.. Is that correct? Can't we give this procedure to developers? Since they can not kill others session/backgound process etc.. Is that the purpose it is created??? Please let me know.
I had created the public synonym and granted execute permissions to the public.
create public synonym myDemoPack for sys.myDemoPack;
grant execute on myDemoPack to public;
So the developers can can kill their sessions.
Execute permission on the procedure can be granted to developers.
The procedure only kills the users own (NON-CURRENT) session only.