3

I managed to run a job from DBMS_SCHEDULER. But is running since yesterday and I cannot stop it. The code for the job is:

 begin
  sys.dbms_scheduler.create_job(job_name            => 'FTREC.EXE_1',
                            job_type            => 'EXECUTABLE',
                            job_action          => 'C:\Users\WWLSERVER\Desktop\test.bat',
                            start_date          => to_date(null),
                            repeat_interval     => '',
                            end_date            => to_date(null),
                            job_class           => 'MY_JOB_CLASS',
                            enabled             => false,
                            auto_drop           => false,
                            comments            => '');
 end;

I tried to stop the job/drop it but with no luck.
When I run:

begin
   dbms_scheduler.stop_job('FTREC.EXE_1',true);
end;

I get no error, but

SELECT * FROM USER_SCHEDULER_RUNNING_JOBS;

returns EXE_1 and if I try to drop the job

begin
   dbms_scheduler.drop_job('FTREC.EXE_1',true);
end;

I get this error:

ORA-27478: job "FTREC.EXE_1" is running
ORA-06512: at "SYS.DBMS_ISCHED", line 213
ORA-06512: at "SYS.DBMS_SCHEDULER", line 657
ORA-06512: at line 2

I have restarted the server but I had no luck. Any ideas how I can stop/drop this job?

Nianios
  • 1,391
  • 3
  • 20
  • 45
  • which exact version are you using? 11g is a bit to vague. Upgrading to 11.2.0.4 if possible would be a good start. –  Nov 06 '13 at 11:47
  • I use 11.2.0.1. I will upgrade ASAP – Nianios Nov 06 '13 at 12:02
  • @ik_zelf: I told the guy, responsible for Oracle to do it, but it will take some time(days actually because his hand are full). Do you have other idea how to stop/drop it? – Nianios Nov 06 '13 at 12:26
  • whats the session's status ? is there a transaction ? is it possible that the job is the process of a rollback ? – haki Nov 06 '13 at 13:26
  • Have you tried killing the session [in the database](http://stackoverflow.com/a/9546094/458741) or [on the OS](http://stackoverflow.com/questions/49988/really-killing-a-process-in-windows)? – Ben Nov 06 '13 at 13:36
  • @haki Ben : I am kind of new in oracle. I can get the sessions from V$SESSION but what exactly am I looking for? – Nianios Nov 06 '13 at 13:51
  • @Ben:I can kill a session using SELECT * FROM USER_SCHEDULER_RUNNING_JOBS; but which session am I looking for? – Nianios Nov 06 '13 at 13:57
  • Since you restarted the server and still have the job running, this could be a corruption issue (or the job did restart at database restart time) Start with disabling the job. –  Nov 06 '13 at 14:22
  • @ik_zelf: I tried begin dbms_scheduler.disable('EXE_1',true); end; but job stil running – Nianios Nov 06 '13 at 14:58
  • strange, but maybe try renaming the bat file on file system, see if it breaks. – tbone Nov 06 '13 at 21:03
  • @tbone: I can rename it, move it, even delete it – Nianios Nov 07 '13 at 09:01
  • I found it!!!. I had installed a Oracle Remote Agent. I stopped it and I was able to stop/drop the Job. Thank you everyone for your help – Nianios Nov 07 '13 at 09:03

1 Answers1

2

I want to put the answer in case someone new in Oracle guy face the same problem.
I had installed a Oracle Remote Agent to run the executable.
So I had first to stop the service (Oracle Remote Agent) and then stop the job.

Thank you for your time and your help.

Nianios
  • 1,391
  • 3
  • 20
  • 45