| |
 |
|
Oracle Tips by Burleson |
Chapter 4 -
Chaining Oracle Jobs Together
Conditional Job Enabling
Care must be taken when running the pre-10g version of this code due
to the way the broken procedure works. When a job has its broken
flag set to FALSE, its next run date is set to the value specified
by the next_date parameter. If this is not specified, it
defaults to the current datetime. As a result, the enabled job will
not run at the expected time. In this example, the next_date
parameter has been specified as a two minute interval for the
convenience of testing, but in a real example, it must be set to an
appropriate datetime value.
Conditional Job Runs Using Oracle Advanced
Queuing
In this method, all tasks in the chain are
scheduled as regular repeating jobs. When a task completes
successfully, it places a message on a queue for the next task to
read. With the exception of the first task, the first operation a
task performs is read from its queue. If there is a message on the
queue, the task can proceed; otherwise, it waits indefinitely for
the message to arrive.
Before any code can be written, a queuing
infrastructure needs to be set up using the
job_chain_aq_setup.sql script and background information must be
introduced. A full introduction to Oracle Advanced Queuing is
beyond the scope of this book, so explanations will be limited to
just those elements necessary to build a simple working system.
 |
For more details and scripts, see my new book "
Oracle
Tuning: The Definitive Reference", over 900 pages
of BC's favorite tuning tips & scripts.
You can buy it direct from the publisher for 30%-off and get
instant access to the code depot. |
|