Administering Job Classes - Oracle 10g

Jobs can be difficult to manage on an individual basis, so the Scheduler uses job classes, which group jobs with common characteristics and behavior together. Prioritization among job classes is possible using resource plans.

There is a default job class that is created with the database. If you create a job without specifying a job class, the job will be assigned to this default job class (DEFAULT _JOB _CLASS). The default job class has the EXECUTE privilege granted to PUBLIC so any database user who has the privilege to create a job can create a job in the default job class. Job classes are created in the SYS schema.

This section introduces you to basic job class tasks, and discusses the following topics:

  • Job Class Tasks and Their Procedures
  • Creating Job Classes
  • Altering Job Classes
  • Dropping Job Classes

Job Class Tasks and Their Procedures

We illustrates common job class tasks and their appropriate procedures and privileges:

Job Class Tasks and Their Procedures

Job Class Tasks and Their Procedures

You create a job class using the CREATE _JOB _CLASS procedure. For example, the following statement creates a job class for all finance jobs:

To query job classes, use the *_SCHEDULER _JOB _CLASSES views.

Job classes are created in the SYS schema. For users to create jobs that belong to a job class, the job owner must have EXECUTE privileges on the job class. Therefore, after the job class has been created, EXECUTE privileges must be granted on the job class so that users create jobs belonging to that class. You can also grant the EXECUTE privilege to a role.

Altering Job Classes

You can alter a job class by using the SET _ATTRIBUTE procedure. With the exception of the default job class, all job classes can be altered. Other than the job class name, all the attributes of a job class can be altered. The attributes of a job class are available in the *_SCHEDULER _JOB _CLASSES views.

When a job class is altered, running jobs that belong to the class are not affected. The change only takes effect for jobs that have not started running yet.

See PL/SQL Packages and Types Reference for detailed information about the SET _ ATTRIBUTE procedure and "Configuring the Scheduler"

Dropping Job Classes

You can drop a job class using the DROP _JOB _CLASS procedure. Dropping a job class means that all the metadata about the job class is removed from the database.

If there are jobs that belong to this job class, the DROP _JOB _CLASS call generates an error. The job class can still be dropped by setting the force option to TRUE, in which case the jobs belonging to the class are disabled and moved to the default class. If you drop a job class with a running job, the job continues running.

You can also drop several job classes in one call by providing a comma -delimited list of job class names to the DROP _JOB _CLASS procedure call. For example, the following statement drops three job classes:

Dropping a job class that does not exist will generate an error that will list the name of the job class that failed. Note that if it is not possible to drop jobclass2, then the DROP _JOB _CLASS call will fail. jobclass1 will be dropped but jobclass2 and jobclass3 will not be dropped.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd Protection Status

Oracle 10g Topics