Job Class
A job class is a collection of properties. I can create a job class with DBMS_SCHEDULER’s CREATE_JOB_CLASS procedure . When I create a job, I can specify the name of an already created job class using the job_class parameter in CREATE_JOB. Here is how to create a scheduler job class that follows the resource allocation group OLTP_GROUP.
1 BEGIN 2 DBMS_SCHEDULER.create_job_class 3 (job_class_name => 'OLTP_JOBS', 4 logging_level => dbms_scheduler.logging_full, 5 log_history => 45, 6 resource_consumer_group => 'OLTP_GROUP', 7 comments => 'OLTP Related Jobs' 8 ); 9 END;
Let’s examine the lines in detail in the following table.
Line |
Description |
3 |
Name of the job class. |
4 |
When a job executes, it creates a log of its activities in a SYS-owned table named SCHEDULER$_EVENT_LOG. You can expose this table to others via the DBA_SCHEDULER_JOB_LOG view . The log entries can be full or partial. (See the "Managing Logging" section for an explanation.) |
5 |
If the execution of the job is logged, then the log entries must be purged periodically; otherwise, the log will become unmanageably large. The log_history parameter determines how many days of logs must be kept. The default is 30 days. In this example, I increase the number of days to 45. |
6 |
This job class is assigned the resource group OLTP_GROUP, which governs the resource allocation and utilization of the jobs defined in this job class. |
7 |
Comments for this job class. |
After the job class is created, I can check its attributes ...
Get Oracle PL/SQL for DBAs now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.