Question

It's probably just the vocabulary I am missing to find out how to do this:

A job scheduled to run regularly every 5 mins, however keeping track that there are never two instances of it running at the same time, i.e. the next instance would be postponed or skipped if the prior runs longs than 5 mins.

What is the easiest/most elegant way to achieve this?

Was it helpful?

Solution

DBMS_JOB takes care of that. Just use it.

OTHER TIPS

From the Oracle 10g administrators guide:

"The DBMS_JOB package has been superseded by the DBMS_SCHEDULER package. In particular, if you are administering jobs to manage system load, you should consider disabling DBMS_JOB by revoking the package execution privilege for users."

DBMS_SCHEDULER is Oracle's recommended way to do this now. One advantage it has is that you can manage your jobs via Enterprise Manager/Grid Control if you're using this.

an other advantage that dbms_scheduler has above dbms_job is that you can better control the load, resource usage and that you can also run jobs external to the database.

hth, Ronald.

If for some reason dbms_job or dbms_scheduler doesn't work for you, you could also use DBMS_APPLICATION_INFO.SET_APPLICATION_INFO to set the module name of your job and you could query v$session to see how many sessions are currently executing that module.

What type of job is this? A PL/SQL stored procedure?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top