0

I've created DBMS_SCHEDULER job, which type is CHAIN. Chain has 2 steps and 2 rules. Each step has PL/SQL "program" (which inserts SYSDATE to table). First rule's condition is TRUE. Second rule has condition checks if step 1 is completed and then runs second step. After I enabled CHAIN and JOB, then DBA_SCHEDULER_JOB_RUN_DETAILS table shows SUCCEEDED for both chain steps. Table keeping date has new values. So I would say that chain has ran successfully.

Problem here is that JOB does not execute second time. Job is suppose to run every 5 minutes.

DBMS_SCHEDULER.CREATE_JOB (
    job_name          => 'RUN_REFRESH',
    job_type          => 'CHAIN',
    job_action        => 'QUICK_REFRESH_CHAIN',
    repeat_interval   => 'FREQ=MINUTELY;INTERVAL=5',
    start_date       => SYSTIMESTAMP,
    enabled      => TRUE
);
END;
/

Job is also active in DBA_SCHEDULER_RUNNING_JOBS table.

Additional info:

SELECT START_DATE, LAST_START_DATE, NEXT_RUN_DATE 
FROM DBA_SCHEDULER_JOBS 
WHERE job_name = 'RUN_REFRESH'; 

shows: 
21.01.2015 12:58:18,000000000   
21.01.2015 12:58:18,328107000   
21.01.2015 12:58:18,000000000 

Questions:

  1. Does DBA_SCHEDULER_RUNNING_JOBS show only currently running jobs instead or enabled/scheduled jobs?
  2. Why doesn't JOB run second time, even though CHAIN ran successfully?
9
  • what is the STATE of the job in that view?
    – Raj
    Jan 23, 2015 at 19:03
  • Hi Raj, The state of the job is RUNNING (got from table ALL_SCHEDULER_JOBS)
    – R.P
    Jan 26, 2015 at 7:08
  • 1
    if it is running then you have a problem. you expect job to run every 5 minutes but it still running. until it either fails or succeeds, next run wont be scheduled. looks like you have some debugging to do.
    – Raj
    Jan 26, 2015 at 12:27
  • But both chain steps have successfully ran. What else could the job stil run? Does CHAIN require somekind of "special" step for marking chain as finished?
    – R.P
    Jan 26, 2015 at 13:36
  • 1
    we don't know your code, but you do. Take a look at what job process is doing/waiting on. Trace it and make sure there is a proper exit condition.
    – Raj
    Jan 26, 2015 at 14:28

1 Answer 1

0

If a job has to run in an interval, the job needs to be in the state 'SCHEDULED' in between. In case of a job chain, make sure that it actually has an ending, otherwise it will remain running forever.

  1. DBA_RUNNING_JOBS only shows the jobs that are in state 'RUNNING'
  2. make sure the chain has an END action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.