Scheduling Concurrent Programs to Run Between Specific Times of the Day

I’ve seen this question come up a few times on the Oracle Community Forums recently, so I thought I’d write a quick blog post about it. The question is along the lines of “How can I schedule a concurrent program to run every X minutes between Y o’clock and Z o’clock each day?”. For this example, we’ll assume we have a program “Active Users” that we wish to run every 20 minutes between the hours of 09:00 and 17:30, Monday to Friday. First we need to define a new work shift to match our timing requirements. This can be accessed from System Administrator responsibility, Concurrent > Manager > Workshifts. Work Shifts Next we define the new manager via Concurrent > Manager > Define. Manager Definition We then define the work shift that we just created against this new manager along with the number of concurrent processes limit for that window. Note that you can define combinations of work shifts to achieve more complex scheduling, however we will keep it simple for this example. Define the sleep seconds as you see fit (note a small value will get picked up quicker, but adds additional overhead to the system). Manager Schedule We then need to include our “Active Users” concurrent program on this manager, and exclude it from the standard manager using the Specialization Rules.
Working Hours Manager Standard Manager
Manager Rules 1 Manager Rules 2
Finally we activate the new manager using Concurrent > Manager > Administer Manager Activation … and we also restart the Standard Manager from the same screen. When scheduling our request we now simply choose to run periodically on a 20 minute schedule (ignore the warning about no end date). Program Schedule We see that the program runs as expected during the work hours. Running Program Running the following script we can see that the new manager has picked up the program.
 select q.concurrent_queue_name   from fnd_concurrent_requests r   join fnd_concurrent_processes p on p.concurrent_process_id = r.controlling_manager   join fnd_concurrent_queues q on q.concurrent_queue_id = p.concurrent_queue_id  where r.request_id = 10619012;     CONCURRENT_QUEUE_NAME          ------------------------------ WORK_HOURS
When we get outside the work shift that we defined against the manager, the request goes into “Inactive – No Manager” and will wait in that status until we’re back within the manager work shift window, at which time it will start running automatically again until the end of the window. Running Program Clearly it’s not sensible to create a new manager for every individual program you wish to run in this style, so it’s advisable to create your manager somewhat generically, as we did in the example above. Then any future programs that need to run within working hours can simple be included on this manager and excluded from the standard manager.

Leave a Reply

Your email address will not be published. Required fields are marked *

nine + 18 =

This site uses Akismet to reduce spam. Learn how your comment data is processed.