Oracle Database 10g offers a brand-new job-scheduling facility, known as The Scheduler. The Scheduler is controlled via the new Oracle Database 10g-supplied package dbms_scheduler. This package replaces the dbms_job package that has been around for some time.
The new Scheduler offers much added functionality over the dbms_job package. The Scheduler enables you to execute a variety of stored code (such as PL/SQL), a native binary executable, and shell scripts. The object that is being run by The Scheduler is known as the program. The program is more than just the name; it includes related metadata about the program, such as the arguments to be passed to it and the type of program that is being run.
Different users can use a program at different times, eliminating the need to have to redefine the program every time you wish to schedule a job. Programs can be stored in program libraries, which allows for easy reuse of program code by other users.
Each program, when scheduled, is assigned to a job. A job can also just contain an anonymous PL/SQL block instead of a program. The job is a combination of the program (or anonymous PL/SQL block) and the schedule associated with the program, which defines when the job is to run. Also associated with the job is other metadata related to the job, such as the job class and the window or window group.
The job class is a category of jobs that share various characteristics, such as resource consumer group assignments and assignments to a common, specific, service name. The job class is related to the job window.
The job window, or window group, essentially allows the job to take advantage of specific resource plans. For example, if the schedule for a job is for it to run every hour, the job window will allow it to run under one resource group in the morning and a different resource group in the evening. That way, you can control the resources the job can consume at different times throughout the day.
Oracle provides two different interfaces into The Scheduler. The first is the dbms_scheduler package and the second is through the Oracle Enterprise Manager (OEM).
There are a few steps to follow when you want to assign a job to The Scheduler:
Create the program (optional)
Create the job