Tutorials
Oracle SchedulerThe result is that all of the jobs waiting for the GO message are started at the same time. With the health of the backup system in mind, it would be wiser to query the jobs view, find the backup job that was scheduled first, and give that job its specific event. In that case, the BCKUP_01 job will wait for the message BCKUP_01; and BCKUP_02 will wait for the message "BCKUP_02".
Another option is that Oracle can allow us to define an event that is delivered to exactly one waiting job at a time. An enhancement request has been filed for this. It will make this kind of waiting a bit easier because normal queuing behavior is then saved. This means that things such as job priorities will be honored. When we define a separate event for every job, we have manual control but we cannot influence the selection order of the jobs in the queue, for example, by raising the priority of a job.
When a backup is ready, the backup system can handle the next backup. We can utilize the enqueue operation by putting our next GO message into the queue in the epilogue of the backup script. However, what will happen if the script crashes? The next backup will never be released. Again, a smarter location for this code would be in an event handler routine that just waits for termination messages from the Scheduler event queue. As soon as it sees the termination of a backup, it can decide to call in the next one by giving that waiting job a signal at its location.
Summary
This chapter gave you a quick look at the two basic types of events that play a role in the Scheduler: the event generated by status changes in a running job and the event that causes a job to run. Both are very important factors in the power of the Scheduler. The objects that we have discussed in the chapter are:
• How we can schedule time-based and event-based jobs
• How jobs can generate events
• How jobs can wait for events to get the job running
• How to listen to events
• How to generate events
• How to get the payload of an event (de-queue)
• How to find the step name that caused the event to happen
• Why we need quota when using a user event queue
• What privileges we need to be able to use scheduler events
• What is the advantage of monitoring jobs using the event system
• Which events a job can cause
• How to write a short form containing all possible events
Scheduler is an impressive tool that enables us to build complex systems. In the next chapter, we will see a few tricks to help you when debugging it.