The Oracle DBMS_JOB package is a built-in database scheduler for Oracle Database that allows for the scheduling and execution of jobs. Jobs, in this context, refer to PL/SQL blocks or stored procedures that are executed at scheduled times or based on certain events. This package has been a fundamental part of Oracle Database for managing scheduled tasks before the introduction of the more advanced DBMS_SCHEDULER package in Oracle 10g, which provides enhanced functionality and flexibility.

Key Features of DBMS_JOB

Scheduling Jobs: Users can schedule jobs to run at specific times or intervals. This is useful for tasks like nightly data warehousing processes, periodic cleanup of temporary tables, or any routine tasks.

Job Execution: The package automatically manages the execution of jobs based on their schedule. Once a job is defined and submitted, the Oracle Database takes care of running the job at its scheduled time.

Intervals: Jobs can be scheduled to run at regular intervals, using date arithmetic to specify the next run time. For example, a job can be set to run every day, every week, or after certain intervals.

Job Management: Users can manage jobs by altering their attributes, such as changing the next date of execution or the interval between executions. Jobs can also be manually run or removed.

Basic Components

Submitting Jobs: The DBMS_JOB.SUBMIT procedure is used to create a new job. Parameters include the job’s PL/SQL block or the name of a stored procedure, the start date, the interval for subsequent executions, and optionally, job attributes.

Altering Jobs: The DBMS_JOB.CHANGE procedure allows for modifying the attributes of an existing job, such as its execution schedule or the PL/SQL block it executes.

Removing Jobs: The DBMS_JOB.REMOVE procedure is used to delete a job from the database, stopping any future executions.

Running Jobs Manually: The DBMS_JOB.RUN procedure allows for the manual execution of a job, regardless of its scheduled time.

Checking Job Execution: The DBMS_JOB.WHAT and DBMS_JOB.NEXT_DATE procedures can be used to check what a job will execute next and when its next execution date is, respectively.

Differences Between DBMS_JOB and DBMS_SCHEDULER

While DBMS_JOB is simpler and sufficient for basic scheduling needs, DBMS_SCHEDULER offers more advanced features such as:

More complex scheduling options, including dependency-based scheduling where jobs can be started based on the completion of other jobs.
The ability to create lightweight jobs that are ideal for high-frequency tasks.
Enhanced logging and error handling capabilities.
Support for external jobs that can run scripts on the host operating system.
Resource management features, allowing jobs to be grouped and prioritized.


Although DBMS_SCHEDULER is recommended for new applications due to its advanced features and flexibility, DBMS_JOB remains supported and useful for simpler scheduling requirements or for maintaining existing applications that already use it. Understanding both DBMS_JOB and DBMS_SCHEDULER is beneficial for Oracle Database administrators and developers to effectively manage and schedule database tasks.