Delete a running job [message #62105] |
Fri, 25 June 2004 00:49 |
nadia azri
Messages: 8 Registered: February 2004
|
Junior Member |
|
|
Dear all,
Got a problem with deleting a running job.
I've nearly tried everything:
- Exec DBMS_JOB.REMOVE(JOB#) gives the error: ORA-23421 Job number xx is not a job in the job queue. I cannot understand because I see the job in tables DBA.JOBS and DBA.JOBS_RUNNING.
- Tried also Exec DBMS_JOB.BROKEN(JOB#, true) without success.
- Tried ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0, this command didn't give any error but the JOB still exists.
- Tried to kill the thread through Orakill but I could not identify the process, didn't find any match when using: Select s.sid, p.spid from v$session s, v$process p where s.paddr=p.addr and s.sid=<sid>; (sid identified from DBA.JOBS.RUNNING).
Note: I'm using Oracle8.1.7 and INTS.
Any help will be appreciated.
Thanks.
Nadia azri
|
|
|
|
|
Re: Delete a running job [message #62119 is a reply to message #62105] |
Fri, 25 June 2004 16:31 |
Thomas Anderson
Messages: 9 Registered: January 2003
|
Junior Member |
|
|
You can use:
dbms_job.broken(<id>,TRUE)
However this won't stop a job that's already running - it will only prevent it from starting. To stop a running job, corresponding session should be killed, which is not that trivial to do - you gotta locate the session in v$session and then alter system kill session '<v$session.sid> <v$session.serial#>' immediate (of course, <v$session.xxx> should be replaced with actual values for these
columns).
The most tricky part here is locating the session for the running job. Of course, job status must be also set to broken before killing its session, because Oracle will start new SNP process to replace killed one and this process will immediately pick up the job again since it was interrupted. And note that
if you set broken flag while job is running, and it then completes successfully, broken flag will be reset, so you really really need to kill running job before you set its broken flag.
Hope that helps,
clio_usa - 8/8i/9i OCP DBA
Oracle DBA Resources | Oracle DBA Forums & Usenet Newsgroups
|
|
|
Re: Delete a running job [message #268637 is a reply to message #62119] |
Wed, 19 September 2007 04:25 |
nayana
Messages: 33 Registered: August 2007 Location: Bangalore
|
Member |
|
|
Hi,
I want to delete a running job. So I used
dbms_job.broken(job => 3962, Broken => TRUE);
and also used the following command.
But still job is running. Could you please tell me how to stop this.
Regards,
Nayana
|
|
|
|
|
|
Re: Delete a running job [message #268666 is a reply to message #268652] |
Wed, 19 September 2007 05:37 |
nayana
Messages: 33 Registered: August 2007 Location: Bangalore
|
Member |
|
|
Hi,
kill -9 means? how to use this command?
When I used this command,
ORA-00900: invalid SQL statement
How to stop please advice.
Regards,
Nayana
|
|
|
|
|
|
|
Re: Delete a running job [message #268917 is a reply to message #268841] |
Thu, 20 September 2007 02:01 |
nayana
Messages: 33 Registered: August 2007 Location: Bangalore
|
Member |
|
|
Hi,
Using HTMLDB application and tried the following commands:
select * from DBa_jobS_running;
No data found
ALTER SYSTEM KILL SESSION 'sid,serial#';
But still job is running. How to stop
|
|
|
Re: Delete a running job [message #269185 is a reply to message #268917] |
Fri, 21 September 2007 00:45 |
mson77
Messages: 208 Registered: August 2007 Location: Brazil
|
Senior Member |
|
|
Thomas Anderson wrote: | You can use:
dbms_job.broken(<id>,TRUE)
However this won't stop a job that's already running - it will only prevent it from starting. To stop a running job, corresponding session should be killed, which is not that trivial to do - you gotta locate the session in v$session and then alter system kill session '<v$session.sid> <v$session.serial#>' immediate (of course, <v$session.xxx> should be replaced with actual values for these
columns).
The most tricky part here is locating the session for the running job. Of course, job status must be also set to broken before killing its session, because Oracle will start new SNP process to replace killed one and this process will immediately pick up the job again since it was interrupted. And note that if you set broken flag while job is running, and it then completes successfully, broken flag will be reset, so you really really need to kill running job before you set its broken flag.
|
Please, after running these commands... tell us what solved this issue.
Thanks,
mson77
|
|
|
|
Re: Delete a running job [message #269284 is a reply to message #269267] |
Fri, 21 September 2007 08:24 |
mson77
Messages: 208 Registered: August 2007 Location: Brazil
|
Senior Member |
|
|
Hello nayana,
Issue:
ALTER SYSTEM KILL SESSION '23,1455' IMMEDIATE;
Regards,
mson77
[edited... complemented]=========================
Hello nayana,
Did you realize that after you issuing "alter system kill session.." command... when you run "select..." you get new sid/serial# ?
Did you pay attention on:
Thomas Anderson wrote: | Of course, job status must be also set to broken before killing its session, because Oracle will start new SNP process to replace killed one and this process will immediately pick up the job again since it was interrupted
|
Regards,
mson77
[Updated on: Fri, 21 September 2007 09:18] Report message to a moderator
|
|
|
|
|
|
Re: Delete a running job [message #270532 is a reply to message #269791] |
Thu, 27 September 2007 06:33 |
nayana
Messages: 33 Registered: August 2007 Location: Bangalore
|
Member |
|
|
Hi,
Thanks!
But my problem is every time when run the below command as you said i will get new SPID no.. How to kill the running job please help me out from this issue.
Regards,
Nayana
|
|
|
|
|
|
Re: Delete a running job [message #270746 is a reply to message #270738] |
Thu, 27 September 2007 23:13 |
nayana
Messages: 33 Registered: August 2007 Location: Bangalore
|
Member |
|
|
Hi,
select * from dba_jobs_running;
no data found
select job, what , broken, failures, last_date, last_sec from dba_jobs;
and output for this is:
JOB BROKEN FAILURES LAST_DATE LAST_SEC WHAT
4001 N 0 19-SEP-07 08:55:08 wwv_flow_cache.purge_sessions(p_purge_sess_older_then_hrs => 24);
4002 N 0 19-SEP-07 16:47:17 wwv_flow_mail.push_queue(wwv_flow_platform.get_preference('SMTP_HOST_ADDRESS'
3982 Y 0 19-SEP-07 13:37:16 BDAY_PKG.BDAY_PROC;
Two jobs created one is for every 10 sec..and one for every midnight.
For every 10 sec.. job I used dbms_job.broken and dbms_job.remove. But still this job is running bcz every 10 sec..I will get a new mail.
Please help me ..
|
|
|
|
|
|
|
|
Re: Delete a running job [message #271127 is a reply to message #271063] |
Sat, 29 September 2007 13:49 |
OracleDisected
Messages: 25 Registered: September 2007 Location: Mexico
|
Junior Member |
|
|
Just for the record...
The operating system process for job queue is ora_jxxx ...where xxx is a consecutive number. When issued the scheduler disable it should go away.
Regards
[Edit MC: url to poster blog removed. We don't care about your blog in this post. If you have an answer on your site, post a link to this answer. If you don't, post your blog url in Marketplace]
[Updated on: Thu, 11 October 2007 12:42] by Moderator Report message to a moderator
|
|
|
|