The DBMS_SCHEDULER package is used to manage scheduled tasks. It provides a set of functions and procedures that can be called from PL/SQL programs.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
Privilege requirements
The privileges on the objects of the DBMS_SCHEDULER package must be directly granted to users. The privileges on Scheduler objects (such as jobs) granted through roles are not recognized.
Only SYS can perform operations on objects in the SYS schema.
Considerations
Some procedures in the DBMS_SCHEDULER package support a comma-separated list of object names. If an error occurs for an object in the provided list, the Scheduler stops processing the list at the first object that returns an error and does not execute the remaining objects in the list.
When the DBMS_SCHEDULER package is executed, if an object does not exist, it returns a PL/SQL exception.
Subprograms
The following table lists the DBMS_SCHEDULER subprograms supported in the current version of OceanBase Database and their brief descriptions.
| Subprogram | Description |
|---|---|
| CREATE_JOB | Creates a job. |
| CREATE_JOB_CLASS | Creates a job class. |
| CREATE_PROGRAM | Creates a program. |
| DEFINE_PROGRAM_ARGUMENT | Defines a program argument whose value can be passed to the program as a string literal. |
| DISABLE | Disables programs, jobs, and so on. |
| DROP_JOB | Drops a job or all jobs in a job class. |
| DROP_PROGRAM | Drops a program. |
| DROP_JOB_CLASS | Drops a job class. |
| ENABLE | Enables programs, jobs, and so on. |
| GENERATE_JOB_NAME | Generates a unique name for a job. |
| RUN_JOB | Executes a job immediately. |
| SET_ATTRIBUTE | Modifies the attributes of a job, program, or other Scheduler object. |
| SET_JOB_ARGUMENT_VALUE | Sets the value of a job argument. |
| STOP_JOB | Stops a running job. |
| PURGE_LOG | Clears job logs. |