How to Build up an Event Based Job - An Example (Doc ID 1431664.1)

Last updated on DECEMBER 06, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.

Goal

There are two kinds of events:

· Events Raised by the Scheduler:
set up a job so that the Scheduler raises an event when the job changes state. You do so by setting the raise_events job attribute in the SET_ATTRIBUTE procedure. The Scheduler raises events by enqueuing messages to the Scheduler event queue SYS.SCHEDULER$_EVENT_QUEUE. Then the application must subsribe to this event queue and take apropriate actions.

Note: To prevent unlimited growth of the scheduler event queue, events will expire in 24 hours by default.
But this time can be changed with attribute event_expiry_time in procedure SET_SCHEDULER_ATTRIBUTE.

Example: Due to a high system load, a job is not started after 30 min after the scheduled start time. The scheduler can raise an event to send an email notification. (event raised by the scheduler)

· Events Raised by an Application: The Application raises an event to notify the Scheduler to start a job. A job started in this way is called event-based job. Create a schedule that references an event instead of timeframe. Then assign a job to this event schedule . The job runs when the event is raised.

Solution

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms