We have an old messy thirdparty application at work that uses Oracle. Sometimes the application tends to lock the Oracle system and use a LOT of threads, leaving the system pretty much unresponsive. To be able to kill all 1000+ Oracle-plus processes i created a small script that kills all processes.
Put the following lines in scriptfile and call it “pkill.sh”.
1 2 3 4 5 6 |
#!/bin/sh process_id=`ps aux | grep $1 | grep -v root | grep -v grep | awk '{print $2}'` if [ $? -eq "0" ]; then echo "Killing process $process_id\r\n"; for i in $process_id;do kill -9 $i;done fi |
Make the script executable with “chmod a+x pkill.sh”.
Run the script with the command “./pkill.sh ora” to kill all processes containing the name “ora”.
Have fun but use at your own risk!