---------------------------------------------------------------------frequency 1 day-----------------------------------------
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'analyze',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN DBMS_STATS.gather_schema_stats(''LDBO'',CASCADE=>TRUE); END;',
start_date => '01-APR-12 11.00.00 PM ASIA/CALCUTTA',
repeat_interval => 'freq=DAILY',
end_date => '02-APR-13 11.00.00 PM ASIA/CALCUTTA',
enabled => TRUE,
comments => 'JOB to gather LDBO statistics');
END;
/
----------------- frequency 2 hours---------------------------------------
BEGIN
DBMS_SCHEDULER.create_job (
job_name => 'analyze1',
job_type => 'PLSQL_BLOCK',
job_action => 'BEGIN DBMS_STATS.gather_schema_stats(''LDBO'',CASCADE=>TRUE); END;',
start_date => '16-FEB-12 06.00.00 PM ASIA/CALCUTTA',
repeat_interval=> 'FREQ=HOURLY;INTERVAL=2',
end_date => '02-APR-13 11.00.00 PM ASIA/CALCUTTA',
enabled => TRUE,
comments => 'JOB to gather LDBO statistics every 2 hours');
END;
/
------------------------------------------frequency syntax
FREQ=[YEARLY | MONTHLY | WEEKLY | DAILY | HOURLY | MINUTELY | SECONDLY] ;
-------------------To run a job every Tuesday at 11:25
FREQ=DAILY; BYDAY=TUE; BYHOUR=11; BYMINUTE=25;
FREQ=WEEKLY; BYDAY=TUE; BYHOUR=11; BYMINUTE=25;
FREQ=YEARLY; BYDAY=TUE; BYHOUR=11; BYMINUTE=25;
------------------ To run a job Tuesday and Thursday at 11, 14 and 22 o'clock
FREQ=WEEKLY; BYDAY=TUE,THUR; BYHOUR=11,14,22;
No comments:
Post a Comment