What this script for?
This script kills all running processes having a string/pattern "provided by the user" in their name or description.
This script works only on Linux environment, it won't work on Unix.
When you need such script?
Sometimes when I shut down an Oracle database it goes hung in the middle, in many cases it worth to kill all the connected sessions to the DB from OS to release this hung in many cases, so I kill all the processes having this pattern in their name, suppose that my instance name is ORCL: oracleORCL (LOCAL=NO)
This script helps me to safely and easily do this job. This is just an example of usage, but it can kill any process, not only Oracle ones.
Before going to "How to Use" section, please read the following disclaimer carefully:
THIS SCRIPT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY. IT IS PROVIDED "AS IS".
THE AUTHOR WILL NOT BE HELD RESPONSIBLE TO ANY PERSON OR ENTITY WITH RESPECT TO ANY DATA LOSS OR DAMAGES CAUSED BY THIS SCRIPT.
This script is like any powerful Linux command, you suppose to
really know what you are doing, make sure you read the prompted messages and outputs carefully.
Also, it's expected that you already practiced/tested this script on a test environment before using it against production.
How to use:
1- You need to provide the full or partial name of the processes you want to kill.
2- The user you are running this script with should be the owner of the processes to be killed.
# sh KILL_ALL_PROCESSES_MATCHING_STRING_LINUX.sh
Read the Disclaimer and decide whether you want to continue or not, then provide the full or partial name of the processes you want to kill: