How to Kill All Sessions Instantly

  • by

Kill All Sessions

I have talked about many topics about identifying and killing sessions in my blog, including:

In some situation, you might see AP server spawned thousands of sessions for some reason. We have to take some actions on the spot. Removing all user sessions could be an immediate remedy for such situation. But how to kill all user sessions instantly?

In fact, the situation is very similar with How to Resolve Oracle SHUTDOWN IMMEDIATE Hangs. First of all, you must make sure $ORACLE_SID is the one we want to operate with.

[oracle@test ~]$ echo $ORACLE_SID
ORCL

Then we kill all user processes by this.

[oracle@test ~]$ kill -9 $(ps -ef | grep LOCAL | grep oracle$ORACLE_SID | awk '{print $2}')

If you don't want to kill local user sessions, you can include only LOCAL=NO out. For example, batch jobs or GoldenGate extracts are all important local sessions.

[oracle@test ~]$ kill -9 $(ps -ef | grep LOCAL=NO | grep oracle$ORACLE_SID | awk '{print $2}')

We killed only remote user sessions.

Leave a Reply

Your email address will not be published. Required fields are marked *