Schedule Background and Asynchronous Jobs

Background jobs are scheduled by using the CLOUD_SCHEDULER package. Since the Oracle Database Cloud Schema Service is a true multi-tenant environment, some aspects of the Oracle Database must be restricted to protect the integrity of both the data and the performance characteristics of Schema Service.

Schema Service cannot be allowed to have unlimited access to the creation and execution of jobs, as this would allow a single service, either by accident or due to malicious intent, to overrun the underlying hardware resources. To address this situation, Schema Service includes an interface which allows the limited use of database jobs.

This interface has the following characteristics:

  • Users are allowed to submit jobs for immediate execution in the current database session or as scheduled tasks.

  • Users are limited to the number of immediate and scheduled jobs. These limits are public. There is a limit of 10 background jobs and 5 active jobs.

  • When a user submits a job, the interface checks to see if the limit for the number of jobs (of the type of the submitted job) has been reached. If the limit has been reached, the call to the interface returns an error.

  • All jobs use a set of Resource Manager consumer groups of different priorities. If a job forces a consumer group to exceed the resource limits of its consumer group, the job is moved to a consumer group with a lower priority.

  • Users are able to use the standard USER_SCHEDULER_% views to determine the status and number of jobs submitted, so they can prevent the return of an error from the submission process and take appropriate corrective actions.

    Note:

    There is a limit of 10 scheduled or defined background jobs and 5 active or running jobs.

The CLOUD_SCHEDULER package is a wrapper that exactly mirrors the DBMS_SCHEDULER package. The only difference between the packages is the CLOUD_SCHEDULER includes a simple procedure for running an immediate job in the current database session. The following example illustrates the immediate execution of the My_PLSQL_Procedure job:

Begin
   CLOUD_SCHEDULER.RUN_JOB( 'My_PLSQL_Procedure' ); 
End;
/

For examples, see Examples of Using the Scheduler in Oracle Database Administrator's Guide.