Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

How to kill an Oracle process on Windows

Oracle Database Tips by Donald BurlesonOctober 20, 2015

 

Question:  I'm used to the "kill -9" syntax in UNIX for killing an Oracle process, but I don't know how to kill an Oracle process on Windows.

 

Answer:  In Windows Server, we have several options for killing processes.  In UNIX, we can simply issue a kill -9 to kill a running process.  In Windows, it is not always that straightforward!  
 
We have the ability to use several methods to kill a process, and many will depend on the circumstances.  For example, we can use the Task Manager for jobs we have direct permissions on, and then use the Task Manager called by the at command to kill any others.  We can also kill a process from the command line using the taskkill or orakill commands.  Lastly, we can delete a stuck Windows Service by finding the process ID using the sc queryex and then using taskkill.

As a quick review, you can kill an Oracle session from within Oracle, but that does not always terminate the OS process.  First, you get the SID and serial number of the session that you want to kill:

 

select
   spid,
   osuser,
   s.program
from
   v$process p,
   v$session s
where
   p.addr=s.paddr;

 

Next, you kill the session from inside SQL*Plus:

 

alter system mill session 'mysid, myserial_no';

 

You can also invoke the dbms_sql.kill_session procedure to kill a Windows session from inside Oracle.

Also see Kill stuck Windows service using sc queryex and taskkill

 

Killing a Windows Task
 

In Windows we have several utilities, the Oracle-centric "orakill" utility and the Windows "taskill" program.  The Windows command to kill this session would be as follows.

C:\oracle9i\bin>orakill ORCL92 768

In this example, the windows thread corresponding to the Oracle session can be killed in the operating system without ever logging into the database.

 

You can also use the Windows taskkill utility to remove an Oracle Windows process:

 

c:>tasklist

oracle.exe 9311 Console 0 5,072 K
 

c:>taskkill /pid 9311

SUCCESS: The process with PID 9311 has been terminated.

 

Using the Windows Task Manager to Kill a Process

The simplest way to delete a process, if you can tell which you want to delete, is by using the Task Manager.  In the example seen in Figure 9.1, the cmd.exe process is highlighted and then End Process is clicked.   That will kill the process, as long as we have permissions to it.


Figure 9.1

However, sometimes the process you need to kill is running under another user's credentials and Task Manager will not allow you to kill it.  There is a solution.  If you recall from the chapter on Batch Jobs, we learned that the at command submits jobs as the system user.  Here we use that to our advantage.
 
To kill a job regardless of owner, we simply open a command prompt and submit a Task Manager process to start interactively within the next few minutes.
 
For example, if it is 9:58am and we need to do this, we tell it to start at 10am (2 minutes later). 
 
C:\>  at 10:00 /interactive taskmgr.exe
 
When 10:00am arrives, a Task Manager window will pop up on your screen, running as System.  From there you will have full permissions to kill any process you need to.

Killing Processes Using taskkill

The way you delete processes from the command prompt is to use the taskkill command.  The syntax is:
 
C:\>  taskkill /PID
 
So, for example, to delete process ID 223, you would type:
 
C:\>  taskkill /PID 223
 
The process ID can be had from using the tasklist command.

 
   
Windows for the Oracle DBA

The landmark book Windows for the Oracle DBA is a comprehensive overview of everything an Oracle DBA needs to know to manage Oracle on Windows.  Order directly from Rampant and save 30%. 
 

 

 

See my related notes on killing Oracle processes here:


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2017

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.

Remote Emergency Support provided by Conversational