Monday, February 2, 2009

Killing a Session in RAC database

I wonder why oracle not thought about it and implemented a mechanism to kill a session in RAC database. Killing a session in oracle database is easy with "alter system kill session". This works gr8 in normal databases.
I had a situation where I had to kill a database session in RAC environment and I was keep getting error stating that the specified sid and session could not be found.
That's when I realized that the instance that I connected to kill a session is different than the session instance.
Hmm...
So, now I need to find the instance where the session exists and then make a connection to that instance and then issue a command to kill that session... what a pain...
Its ok as long as you need to kill session once in a while but not often (don’t ask me why do you need to kill sessions so often as all the work environments are not same).
So, wrote a small package to accept sid, session and instance# and it will take care of killing that session irrespective of instance you connected to it.
Sweet, now I don’t have to wait for Oracle to come with a mechanism anymore!!!
Drop me a note if you are in need of the code and I shall send it you.

No comments:

Post a Comment