Free Oracle Tips

Oracle Consulting Oracle Training Development

Remote DBA

 

Remote DBA Plans
Remote DBA Service

 
Remote DBA Oracle Home
Remote DBA Oracle Training
Remote DBA SQL Tuning Consulting
Remote DBA Oracle Tuning Consulting
Remote DBA Data Warehouse Consulting
Remote DBA Oracle Project Management
Remote DBA Oracle Security Assessment
Remote DBA Unix Consulting
Burleson Books
Burleson Articles
Burleson Web Courses
Burleson Qualifications
Oracle Internals Magazine
Oracle Links
Remote DBA Oracle Monitoring
Remote DBA Support Benefits
Remote DBA Plans & Prices
Our Automation Strategy
What We Monitor
Oracle Apps Support
Print Our Brochure
Contact Us (e-mail)
Oracle Job Opportunities
Oracle Consulting Prices





   

 


        
 

 Oracle Scheduler Job Priority
Oracle Tips by Burleson Consulting

Advanced Oracle Utilities: The Definitive Reference by Rampant TechPress is written by the top Oracle database experts (Bert Scalzo, Donald Burleson, and Steve Callan).  The following is an excerpt from the book.

Job Priorities

When several jobs within the same job class are scheduled to start at the same time, the job coordinator uses the job priority to decide which job to execute first.  In the following example, a job is created and its job_priority attribute is set to one using the set_attribute procedure.

 

BEGIN

  DBMS_SCHEDULER.create_job (

    job_name        => 'test_priority_job',

    job_type        => 'PLSQL_BLOCK',

    job_action      => 'BEGIN DBMS_LOCK.sleep(10); END;',

    start_date      => SYSTIMESTAMP,

    repeat_interval => 'freq=minutely;',

    end_date        => SYSTIMESTAMP + 1/48,

    enabled         => FALSE,

    comments        => 'Job used to test priorities.');

 

  DBMS_SCHEDULER.set_attribute (

    name      => 'test_priority_job',

    attribute => 'job_priority',

    value     => 1);

   

  DBMS_SCHEDULER.enable (name => 'test_priority_job');

END;

/

 

The attribute can be set to any value in the range from one to five, in which one is the highest priority.  If a priority is not specified during the job creation, it is assigned the default value of three.

 

The priority of a job can be displayed using the dba_scheduler_jobs view, as shown by the following query:

 

select

   job_name,

   job_priority

from

   dba_scheduler_jobs

order by

   job_priority

;

 

JOB_NAME                       JOB_PRIORITY

------------------------------ ------------

TEST_PRIORITY_JOB                         1

GATHER_STATS_JOB                          3

PURGE_LOG                                 3

 

This introduction to priorities illustrates that assigning a priority to jobs within a job class is easy.  The next section will present information on scheduler logging that is available as part of the Oracle scheduler.

Scheduler Logging

The Oracle scheduler logs a number of events including job maintenance, job run activity and window activity.  It also gives some degree of control over the level of logging performed by the scheduler.

 

The log_history scheduler attribute can be used to control the volume of historical logging information.  However, if a specific job or job class has a different history requirement, the set_attribute  procedure can be used to override this value.

 

BEGIN

  -- Alter log history for a specific job.

  DBMS_SCHEDULER.set_attribute (

    name      => 'test_job',

    attribute => 'log_history',

    value     => 30);

 

  -- Alter log history for a specific job class.

  DBMS_SCHEDULER.set_attribute (

    name      => 'test_job_class',

    attribute => 'log_history',

    value     => 90);

END;

/

 

There are several types of scheduler logs which can be managed separately.  In the following sections, information will be presented on each type of logging available, starting with job logs.


Fo
r more details on Oracle utilities, see the book "Advanced Oracle Utilities" by Bert Scalzo, Donald K. Burleson, and Steve Callan.

You can buy it direct from the publisher for 30% off directly from Rampant TechPress.

     

Remote DBA Service
 

Oracle Tuning Book

Free Oracle dictionary reference poster

BC Oracle support

Oracle books by Rampant

Oracle monitoring software

North Carolina Oracle Users Group

 

 Arabian horse breeder

Seeing eye horses

 

 

 

 

 

Burleson is the American Team

American Flag

 

 

BC Remote Oracle Support
P.O. Box 511 • Kittrell, NC, 27544

Remote DBA

Remote DBA Services

 

Copyright © 1996 -  2011 by Burleson Enterprises. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation.