I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator.
I don't want to just lock the database and let the users quit gracefully.
How would I script this?
I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator.
I don't want to just lock the database and let the users quit gracefully.
How would I script this?
I found the below snippet helpful. Taken from: http://jeromeblog-jerome.blogspot.com/2007/10/how-to-unlock-record-on-oracle.html
Then ran:
To kill individual sessions.
I've been using something like this for a while to kill my sessions on a shared server. The first line of the 'where' can be removed to kill all non 'sys' sessions:
If you want to stop new users from connecting, but allow current sessions to continue until they are inactive, you can put the database in QUIESCE mode:
From the Oracle Database Administrator's Guide:
If Oracle is running in Unix /Linux then we can grep for all client connections and kill it
grep all oracle client process:
ps -ef | grep LOCAL=NO | grep -v grep | awk '{print $2}' | wc -l
Kill all oracle client process :
kill -9
ps -ef | grep LOCAL=NO | grep -v grep | awk '{print $2}'