In my previous article I have given multiple examples of PL/SQL; In this article I would like to give the very useful concept – Oracle Kill Job with multiple real life examples. There are so many situations in real world where user require to kill the running jobs or processes. As a developer you should also know to to check the running jobs and how to kill the jobs which are time consuming or unused. There are so many times the scheduled jobs and its respective sessions keeps open and we require to kill those sessions and job.
What you will see on this article?
What is Scheduled Oracle job with Example?
How to kill Oracle Scheduled jobs with Examples?
What is Scheduled Oracle Job?
Before starting the steps to kill oracle job we require to check what is scheduled oracle jobs. The task which needs to be run on specified interval for successful processing of application is called as scheduled tasks. We require to write scheduled jobs to perform those tasks in specific intervals. Sometimes the jobs will run the tasks which are time consuming and it will slow down your application or specific functionality of application. So we require to kill those scheduled jobs.
Example :
If in Central Banking Application you are running the Oracle job to consolidate the data from multiple branches. If the branches data is very huge and it is impacting the performance of application then we require to kill that oracle job. In next section we can check Oracle Kill Job steps in detail.
How to kill Oracle Scheduled jobs or Sessions? | Oracle Kill Jobs with example
In this section we can see how to kill the oracle scheduled jobs or sessions in detail with the examples. We have already seen the information about oracle jobs. This is very simple three steps process where we can kill Oracle jobs. You must know about system tables in detail to kill sessions of oracle job.
Oracle Kill Job Steps :
Step 1 : Search the Job which you want to kill
You require to search the Job which you want to kill. We need to use the system table named ‘dba_scheduler_running_jobs’ of oracle to find that specific job.
Query :
select * from dba_scheduler_running_jobs;
Lets say if you want to find the job named J_Bank_Consolidation then you can write query.
select * from dba_scheduler_running_jobs where job_name like ‘ J_Bank_Cons%’;
Step 2 : Kill the Job
You can kill the job using stop_job procedure of DBMS_Scheduler package.
exec DBMS_SCHEDULER.STOP_JOB(job_name => ‘Complexsql.J_Bank_Consolidation’,force => TRUE);
There are few attributes of this procedure. We require to pass parameters as job name and force = true or false. We are forcefully stopping this job using above query.
Step 3 : Check status of the job
select * from dba_scheduler_running_jobs;
Theses are 3 most important steps to kill the jobs in oracle side.
I hope you got the correct steps to kill the oracle jobs. Sometimes user/dba needs to kill the sessions as well associated with the oracle jobs. If you like this article on Oracle Kill Job or if you have any issues with the same kindly comment in comments section.
You’re a lifesaver Sir!
Thank you so much dear priyanka!
Hi, Amit thanks a lot . this will definitely help us.is it is possible to send me all pdf? if possible please send me pdf of all series of oracle .my email ketan4500@gmail.com
Thanks Ketan..Shared you notes
Good artice
ThanksRaj …Appreciated your good comment