Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

dbms_job vs. dbms_scheduler

Oracle Tips by Burleson Consulting

Starting with Oracle Database 10g, the Oracle scheduler was greatly improved with the dbms_scheduler package.  Replacing the dbms_job with dbms_scheduler offers additional features by adding the ability to tie jobs with specific user-type privileges and roles:

Features Comparison between dbms_job and dbms_scheduler

 

Feature

dbms_job

dbms_scheduler

Provide full integration of job creation and modification in Oracle Enterprise Manager.

Yes

Yes

Provide privileges and roles specifically for the scheduler to increase control over the scheduling of jobs.

No

Yes

Table 1.1 - Features comparison between the dbms_job and dbms_scheduler package

See from Dr. Timothy Hall's book "Oracle Job Scheduling" these tips on migrating from dbms_job to dbms_scheduler:

-- Old using dbms_job scheduler.

VARIABLE l_job NUMBER;
BEGIN
  DBMS_JOB.submit (
    job       => :l_job,
    what      => 'BEGIN NULL; /* Do Nothing */ END;',
    next_date => SYSDATE,
    interval  => 'SYSDATE + 1 /* 1 Day */');
   
  COMMIT;
END;
/
PRINT l_job

 

-- New with dbms_scheduler scheduler.

BEGIN
  DBMS_SCHEDULER.create_job (
    job_name        => 'dummy_job',
    job_type        => 'PLSQL_BLOCK',
    job_action      => 'BEGIN NULL; /* Do Nothing */ END;',
    start_date      => SYSTIMESTAMP,
    repeat_interval => 'SYSTIMESTAMP + 1 /* 1 Day */');
END;
/

By comparing these examples, it is noted that conversion of basic jobs is quite simple, involving the following steps:

  • Define a meaningful job_name for the new job.
     

  • Assign a job_action of PLSQL_BLOCK.
     

  • Use the what value from the old job as the job_action value in the new job.
     

  • Use SYSTIMESTAMP for the start_date value.
     

  • Use the interval value from the old job as the repeat_interval value in the new job, making sure the result of the expression is a TIMESTAMP not a DATE.

Once this conversion has been completed for all jobs, there is freedom from using the old scheduler, so the job_queue_processes parameter can now be set to zero.

 

The new 10g job scheduling views

Oracle MOSC also offers advice on moving from dbms_job to dbms_scheduler and notes that the dba_jobs view is obsolete with dbms_scheduler and we use dba_scheduler_jobs:

select
   job_name,
   enabled
from
   user_scheduler_jobs;
 
and this:
 
select
   job_id,
   freq_type,
   freq_interval,
   freq_subday_type,
   freq_subday_interval,
   freq_relative_interval,
   freq_recurrence_factor,
   active_start_date,
   active_end_date,
   active_start_time, 
   active_end_time, 
   schedule_id
from
   dba_scheduler_jobs;

MOSC also notes that internally-scheduled tasks (job queues, automatic statistics) can be seen by querying the dba_scheduler_jobs view:

As the SYS user, use the following query to check for this job:

SELECT STATE
FROM DBA_SCHEDULER_JOBS
WHERE JOB_NAME = ’GATHER_STATS_JOB’;

This DBASupport article shows the main DBA Scheduler views and a handy query:

  • DBA_SCHEDULER_SCHEDULES - provides me with information about the schedules that are in effect in the database.
     

  • DBA_SCHEDULER_PROGRAMS - shows all program objects and their attributes, while view DBA_SCHEDULER_PROGRAM_ARGS shows all program arguments for programs that have them.
     

  • DBA_SCHEDULER_JOBS - shows all job objects and their attributes.


    For more dbms_job_scheduler tips see:

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

    Buy direct from the publisher and save 30%!


 

 

��  
 
 
 
 

 
 
 

 
 
Oracle performance tuning software 
 
oracle dba poster
Oracle Linux poster
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2014

All rights reserved by Burleson

Oracle © is the registered trademark of Oracle Corporation.