Oracle database tips logo
Article categories | Blog and News Page | SQL | SQL*Plus | DBA Scripts | Standby dbs | Database Links | Techno webcasts | Oracle Magazine | Free IT Magazines | Oracle Database Hosting Companies | Site Search |
RSS
XML RSS
What is this?
AddThis Feed Button

Social Bookmarking
- Found on the internet ! -

Oracle workbooks

Download Oracle Books



- Featured ebook -

Database Normalization
by Alf Pedersen

Database Normalization ebook Understand and master how to normalize a database using methods richly documented with graphical ERD and server diagram examples

NoAdware Free Trial

NoAdware Remove
harmful
adware,
spyware,
trojans,
dialers
and worms!
-- FREE --
IT Magazine
Subscriptions

WebSite Magazine WebSite Magazine Practical advice, helpful tools and insights for website owners

Oracle Magazine Oracle Magazine Contains technology strategy articles, sample code, tips, Oracle and partner news, how-to articles for developers and DBAs

Dr Dobb's Journal Dr Dobb's Journal enables coders to write the most efficient programs and help in daily programming quandaries

DM Review DM Review is recognized as the premier business intelligence, analytics and data warehousing publication
Various other Free IT magazine subscriptions

Kill Oracle process without specifying process ID


Make sure you always test the steps outlined in this 'Kill Oracle process ' tutorial on a test server before implementing it on a production system !


If you have ever sighed at needing to kill a number of Oracle processes related to one aspect of Oracle
(listener,instance, agent, oms) then you will enjoy using this little script as much as I do now that I've found it.
Be very careful with it, if you get the 'requirement' wrong, you could end up killing the wrong processes.

For example, if you want to kill all processes associated with one particular SID, but have multiple SIDs running on your server,
don't grep for 'oracle' as the list that is returned is for ALL oracle processes on the server.

In this example, I need to kill all processed associated with the Oracle management agent (emagent) on a server.

I do not need to worry about being careful as I only have one agent home on the server and can not accidentally kill irrelevant ones.


$ps -ef | grep emagent

oracle     395 14244  0 15:10 pts/1    00:00:00
 grep emagent
oracle    3905     1  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/perl/bin/perl 
/home/oracle/product/agent10g/bin/emwd.pl 
agent /home/oracle/product/agent10g/sysman/log/emagent.nohup
oracle    3922  3905  0 13:45 pts/1    00:00:08 
/home/oracle/product/agent10g/bin/emagent
oracle    3928  3922  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    3929  3928  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    3930  3928  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    3931  3928  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    3932  3928  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4019  3928  0 13:45 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4233  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4235  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4236  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4237  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4238  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4239  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4240  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle    4241  3928  0 13:46 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent
oracle   14736  3928  0 14:41 pts/1    00:00:00 
/home/oracle/product/agent10g/bin/emagent

$ps -ef | grep emagent| awk '{print $2}' | xargs kill -9
$
$ps -ef | grep emagent
oracle   27931 14244  0 15:26 pts/1    00:00:00 grep emagent




Return from 'Kill Oracle process' back to 'Oracle script tutorials' .