Skip to Main Content
  • Questions
  • Execute package procedures in parallel

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Gijs.

Asked: November 05, 2018 - 12:25 pm UTC

Last updated: November 07, 2018 - 12:53 am UTC

Version: 12.1.0.2.0

Viewed 1000+ times

You Asked

Hi all,

For our customer, we start a process in the night to generate orders for 400 stores. Each store can regenerate its order during the day so the procedure is executed separately for each store.

For each store we start a scheduled job with the store number as a parameter. So during the night there are 400 scheduled jobs which each executes the same packaged procedure with another parameter and our monitor displays 400 job executions. If one job fails, we send an e-mail so we can take the appropriate action to restart the job.

My question(s). Does the Oracle scheduler execute these jobs in parallel? And is this the way to go? Since we want to trigger one mail after completion of 400 jobs, is it easier to create one job with a chain which has 400 chain steps? Or should we solve this multiple store issue in the sql code?

Kind regards,

Gijs.

and Connor said...

Does the Oracle scheduler execute these jobs in parallel?


Yes, based on the parameter 'job_queue_processes'

And is this the way to go?

If you need that level of concurrency, then yes. Of course, if it takes (say) 1 second to process a store, I'd be possibly inclined to run (say) 'n' shops in a single job so you don't flood the database with 400 concurrently running jobs when you don't need to.

Since we want to trigger one mail after completion of 400 jobs


Some logging can handle this. As you submit each store, log a row for each store in a table, and then have the each-store job update that row saying "completed" (or failed). Maybe even the standard dictionary views would suffice for this (depends on your app). Then submit an additional job which simply polls that each (say) minute to check if there are any still running jobs - if so, then do nothing, if all jobs finished, then send the email and remove itself.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

parallel wrapper

Racer I., November 06, 2018 - 7:33 am UTC

Hi,

Maybe DBMS_PARALLEL_EXECUTE (which uses dbms_job) can simplify this for you?
https://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_parallel_ex.htm#ARPLS67330

RUN_TASK then poll for TASK_STATUS FINISHED.

regards,
Connor McDonald
November 07, 2018 - 12:53 am UTC

Nice input. Yeah, I should have mentioned that.

More to Explore

Scheduler

All of the database utilities including the Scheduler are explained in the Utilities guide.