Ничего интересного, просто для памяти. BYMONTHDAY=-2 - второй день от конца.
Код:
BEGIN
SYS.DBMS_SCHEDULER.CREATE_JOB
(
job_name => 'SYS.MV_UPDATE_430_OCT2012'
,start_date => TO_TIMESTAMP_TZ('2012/10/22 09:00:19.807075 +04:00','yyyy/mm/dd hh24:mi:ss.ff tzr')
,repeat_interval => 'FREQ=MONTHLY; BYMONTHDAY=-2'
,end_date => NULL
,job_class => 'DEFAULT_JOB_CLASS'
,job_type => 'PLSQL_BLOCK'
,job_action => 'begin dbms_mview.refresh(''"FDC_EXEC"."FDC_MV_REPORT_430_OCT2012"''); end;'
,comments => NULL
);
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'RESTARTABLE'
,VALUE => FALSE);
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'LOGGING_LEVEL'
,VALUE => SYS.DBMS_SCHEDULER.LOGGING_RUNS);
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'MAX_FAILURES');
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'MAX_RUNS');
BEGIN
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'STOP_ON_WINDOW_CLOSE'
,VALUE => FALSE);
EXCEPTION
-- could fail if program is of type EXECUTABLE...
WHEN OTHERS THEN
NULL;
END;
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'JOB_PRIORITY'
,VALUE => 3);
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'SCHEDULE_LIMIT');
SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
( name => 'SYS.MV_UPDATE_430_OCT2012'
,attribute => 'AUTO_DROP'
,VALUE => TRUE);
SYS.DBMS_SCHEDULER.ENABLE
(name => 'SYS.MV_UPDATE_430_OCT2012');
END;
/