DBMS_SCHEDULER
The new
dbms_scheduler package, available in 10g and
later, is a monumental improvement over the
older dbms_jobs facility. In fact, not only is
it more capable in Oracle functionality and
integration terms, but it also incorporates
numerous real world job scheduler concepts, such
that in some cases it even competes with actual
real world job scheduling solutions outside the
database world. Not that this is necessarily an
alternative, but it is believed that Oracle took
a flawed and overly simple implementation and
built the best scheduler inside the database one
could hope for. Three areas where they have
greatly improved the capabilities are:
-
Easier specification
of start and interval values
-
Ability to schedule
executables as well as PL/SQL
-
Tight integration with
Oracle’s Resource Manager
In
fact, the new Oracle dbms_scheduler package is
so robust that the following book is highly
recommended where the author, Dr. Timothy Hall,
does an excellent job of detailing every aspect
that the new scheduler has to offer.
Oracle Job Scheduling:
Creating Robust Task Management with
dbms_job and Oracle 10g dbms_scheduler
Author: Dr. Timothy S.
Hall
Publisher: Rampant Tech
Press
ISBN: 0-9744486-6-4
ISBN-13: 978-0974448664
And
while the PL/SQL API will be investigated here
in a little detail so that a fundamental
understanding of its basic operation and
capabilities is conveyed, another recommendation
is using the OEM graphical interface shown next
so that one can concentrate on the “what” needs
to be done rather than the “how” it works.
This is so because the employers assume
the DBA generally knows how things work and they
are paying to get real-world things done.
Besides, as will be shown in the next few pages,
Oracle has so enhanced the concept of what
dbms_scheduler can do or be used for that the
OEM GUI becomes the most efficient way to work
with it.
Figure 6.10:
OEM
Main Menu – Scheduler Section
The first concept needing to
be done is to appreciate the hierarchy of
objects that are now available to work with. The
DBA should familiarize himself with the
definitions below, and then examine the data
model that follows in order to begin to see the
nature of the things that are now possible.
These concepts represent the metadata necessary
to define, instantiate, and execute complex job
schedules.
-
Program:
a program invocation command,
parameter list, and definition
-
Argument:
parameters required to be passed in
and/or out at runtime
-
Schedule: a named
object for when and how many times something
runs
-
Job: combination of
what needs executed (program) and when (
schedule)
-
Job Instance: the
occurrence of a job currently executing
and/or running
-
Event: message raised
by the scheduler or application and passed
along
-
Chain: grouping of
programs linked or combined for a singular
objective
-
Job Class: a named set
of attributes assignable to or for a job
description
-
Window: periods of time
to which resource allocations can be
assigned
-
Windows Groups: simple
grouping of windows for ease of scheduling
That is a lot of terms to
have to think about all at once, so Figure 6.11
shows a data modeling diagram of how they are
generally related:
Figure 6.11:
Data
Model for Scheduler Objects