In Oracle : Kill an Oracle process / job from OS (Linux, AIX, UNIX)

Oracle Applications EBS 11i, R12      Oracle Database      Data Warehouse & BI      Oracle Middleware      PL/SQL      Linux ...

Oracle DBA

Real Application Cluster (RAC) Maintenance tasks Backup and Recovery Database Architecture Replication Oracle Performance Tuning Oracle DBA - Other articles Oracle scripts/ Selects for DBA Oracle Errors (ORA-nnnnn)

The last articles in the site (HOT)

The most visited articles in the site

In-Oracle.com  -> Oracle DBA -> Oracle Maintenance Tasks

-> Kill an Oracle process / job from OS (Linux, AIX, UNIX)

 

 Kill an Oracle process / jobs from OS (Linux, AIX, UNIX)

 

 

Here are the steps for killing a particular Oracle job at the OS level :

  1. Find the job we what to kill and the session associated with the job

  2. Mark the job as Broken

  3. Kill the Oracle Session

  4. Kill the O/S Process

1.  Find the job we what to kill and the session associated with the job

 

             select j.sid,

                       s.spid,

                       s.serial#,

                       j.log_user,

                       j.job,

                       j.broken,

                       j.failures,

                       j.last_date||':'||j.last_sec last_date,

                       j.this_date||':'||j.this_sec this_date,

                       j.next_date||':'||j.next_sec next_date,

                       j.next_date - j.last_date interval,

                       j.what

              from ( select djr.SID, dj.LOG_USER, dj.JOB, dj.BROKEN, dj.FAILURES,

                                   dj.LAST_DATE, dj.LAST_SEC, dj.THIS_DATE, dj.THIS_SEC,

                                   dj.NEXT_DATE, dj.NEXT_SEC, dj.INTERVAL, dj.WHAT

                             from dba_jobs dj, dba_jobs_running djr

                             where dj.job = djr.job ) j,

                      (select p.spid, s.sid, s.serial#

                             from v$process p, v$session s

                             where p.addr = s.paddr ) s

             where j.sid = s.sid;

 

 


2.  Mark the job as Broken

 

                  begin

                     DBMS_JOB.BROKEN(job#,TRUE);

                     commit;

                  end;

 

             NOTE: After executing this command the job is still running.

 


 

3.  Kill the Oracle Session

 

ALTER SYSTEM KILL SESSION 'sid, serial#';

 

NOTE: In many situations the session is marked 'KILLED' but is not killed.  

 

 

4.  Kill the O/S Process

 

For UNIX:
kill -9 spid

For Windows at the DOS Prompt: 
orakill sid spid

 

 

In-Oracle.com  -> Oracle DBA -> Oracle Maintenance Tasks

-> Kill an Oracle process / job from OS (Linux, AIX, UNIX)

Oracle Applications EBS 11i, R12      Oracle Database      Data Warehouse & BI      Oracle Middleware      PL/SQL      Linux ...

 

     Copyright (c) 2011-2015  www.in-oracle.com  |  Disclaimer: The views expressed on this web site are my own and do not reflect the views of Oracle Corporation. You may use the information from this site only at your risk.