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


-- FREE --
IT Magazine
Subscriptions

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

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

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
NoAdware Free Trial

NoAdware Remove
harmful
adware,
spyware,
trojans,
dialers
and worms!
- 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

Kill Oracle Processes
Free your shutdown immediate


Never implement this kill oracle processes script on a production server !
It is not supported by Oracle.
When I first saw this 'kill oracle processes' script being used by a sharp collegue, I was horrified.
Killing a process before it completes elegantly ?
Unheard of.
Definitely not part of the Oracle training manuals.

However, I started realizing its value when I was waiting for the hundredth time for a
shutdown immediate to complete on a unix system.

So I relented, and even though I still get nervous, I use it regularly.

I must repeat that you should never do this on a production system.
Oracle does not support this.

Follow these steps at your own risk.

The logic behind the script is as follows:

  • Run a script which lists all the process ids of the 'LOCAL=NO' connections and pipe a kill command
    with those process ids to a second file.

  • Execute the second file which effectively kills the processes.

Assumption :

There is only one database instance on the server.
If you have more than one database running, you will need to adapt the script,
otherwise you will end up killing connections to the other databases too.

Risk:

  • Once the second script (runkill.sh) has been created, it contains hard-coded process ids.
  • If you run runkill.sh at a later stage, without repopulating it with fresh process ids,
    you will kill processes which are totally unrelated to the ones you wanted to kill.
  • For the same reason, you must run runkill.sh as quickly as possible after it has been created,
    so that there is no chance of killing the wrong process by accident.
  • You need to change the permissions of both scripts to be executable before they can run.
    • chmod 744 *Kill.sh

So: the script is by no means perfect, carries a security risk and is totally unsupported by Oracle.

Use at your own peril.

 

The scripts:

First script: BuildKill.sh

ps -ef | grep "LOCAL=NO" | awk {'print "kill -9 " $2'} > RunKill.sh

To run the first script:
./BuildKill.sh

To run the second script:
./RunKill.sh


Recommended reading:

  • OraMag article: OraKill.exe , Killing Sessions on NT Using Thread Number


  • Return from kill oracle processes back to oracle-script-tutorials.