P. 1
Oracle 11g

Oracle 11g

|Views: 650|Likes:
Published by srikantha76

More info:

Published by: srikantha76 on Jul 21, 2011
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/16/2013

pdf

text

original

In Oracle 11g, Schedule jobs are divided into two types: regular and lightweight jobs. Regular jobs are created
and dropped after each execution. Lightweight jobs inherit their characteristics, like privileges, from its template.
They do not cause re-creating overhead, faster to create and need less space the regular jobs. Use lightweight
jobs when you need to create and drop hundreds or thousands of jobs per second.

A job template is a database object that provides the necessary metadata needed for running a job (other than a
schedule) and provides a privilege infrastructure that can be inherited by any lightweight job.

The following example creates a lightweight job using a program as a template:

DBMS_SCHEDULER.CREATE_JOB (
JOB_NAME =>'Light_Job1',
PROGRAM_NAME =>'My_Prog', -- existing scheduler program
REPEAT_INTERVAL =>'freq=daily;by_hour=9',
ENABLED =>FALSE, -- default
AUTO_DROP =>TRUE, -- default
COMMENTS =>'Lightweight Job',
JOB_STYLE => 'LIGHTWEIGHT'); -- or REGULAR

The following example creates a set of lightweight jobs in one transaction:

declare

NEWJOB SYS.JOB;
NEWJOBARR SYS.JOB_ARRAY;

begin

NEWJOBARR := SYS.JOB_ARRAY();
NEWJOBARR.EXTEND(5);
FOR I IN 1..5 LOOP
NEWJOB := SYS.JOB(JOB_NAME => 'LWJOB_' || TO_CHAR(I),
JOB_STYLE => 'LIGHTWEIGHT',
JOB_TEMPLATE => 'My_Prog', -- not PROGRAM_NAME
REPEAT_INTERVAL => 'FREQ=MINUTELY;INTERVAL=15',
START_DATE => SYSTIMESTAMP + INTERVAL '10' SECOND,
ENABLED => TRUE );
NEWJOBARR(I) := NEWJOB;

END LOOP;
-- create multiple jobs in a single call
DBMS_SCHEDULER.CREATE_JOBS(NEWJOBARR, 'TRANSACTIONAL');

end;

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->