oracleÊý¾Ý¿â׼ʱÆ÷Ó÷¨
oracle Êý¾Ý¿â׼ʱÆ÷ÔÊÐí°²ÅÅʹÃüÔÚָ׼ʱ¼äµã»òʱ¼ä¶ÎÄÚÖ´ÐУ¬°üÀ¨ÉèÖÃ×îÏȺͿ¢ÊÂÈÕÆÚ¡¢Öظ´¾àÀëµÈ¡£½¨Éè׼ʱÆ÷Éæ¼°½¨Éè job ºÍ schedule ¹¤¾ß£¬²¢½«ËüÃǹØÁªÆðÀ´¡£Ê¹Ãü¿ÉÒÔͨ¹ý´æ´¢Àú³Ì¡¢Íⲿ³ÌÐò»ò pl/sql Óï¾äÖ´ÐС£¿ÉÒÔËæʱÉó²é¡¢½ûÓûòÆôÓÃ׼ʱÆ÷£¬ÒÔÖÎÀíʹÃü¡£
Oracle Êý¾Ý¿â׼ʱÆ÷µÄÓ÷¨
Oracle Êý¾Ý¿â׼ʱÆ÷ÊÇÒ»¸öÄÚÖûúÖÆ£¬ÔÊÐíÔÚָ׼ʱ¼äµã»òʱ¼ä¶ÎÖ´ÐÐʹÃü¡£ËüÌṩÁËÒ»ÖÖ¿É¿¿ÇÒ¿ÉÀ©Õ¹µÄ·½·¨À´°²ÅÅÖظ´µÄʹÃü»òÔÚÌØ׼ʱ¿ÌÖ´ÐÐÊÂÎñ¡£
ʹÓÃ׼ʱÆ÷
ҪʹÓÃ׼ʱÆ÷£¬ÐèÒª½¨ÉèºÍÖÎÀíÁ½¸öÖ÷Òª¹¤¾ß£º
JOB£º´ú±íÐèÒªÖ´ÐеÄʹÃü¡£
SCHEDULE£ºÖ¸¶¨Ê¹ÃüºÎʱִÐС£
½¨Éè׼ʱÆ÷
ÒÔÏ°취˵Ã÷ÎúÔõÑù½¨Éè׼ʱÆ÷£º
½¨Éè JOB ¹¤¾ß£º
CREATE JOB job_name;
µÇ¼ºó¸´ÖÆ
½¨Éè SCHEDULE ¹¤¾ß£º
CREATE SCHEDULE schedule_name START_DATE date END_DATE date REPEAT_INTERVAL interval;
µÇ¼ºó¸´ÖÆ
start_date£ºÊ¹Ãü×îÏÈÖ´ÐеÄÈÕÆÚ¡£
end_date£ºÊ¹Ãü¿¢ÊÂÖ´ÐеÄÈÕÆÚ£¨¿ÉÑ¡£©¡£
repeat_interval£ºÖ´ÐÐʹÃüÖ®¼äµÄ¾àÀëʱ¼ä£¨ÀýÈ磬’1 DAY’£©¡£
½« JOB Óë SCHEDULE ¹ØÁª£º
BEGIN DBMS_JOB.SUBMIT( job => job_name, schedule => schedule_name ); END;
µÇ¼ºó¸´ÖÆ
Ö´ÐÐʹÃü
Óë JOB ¹ØÁªµÄʹÃü¿ÉÒÔͨ¹ýÒÔÏ·½·¨Ö´ÐУº
´æ´¢Àú³Ì£ºÊ¹Óà CALL Óï¾äŲÓô洢Àú³Ì¡£
Íⲿ³ÌÐò£ºÊ¹Óà DBMS_SCHEDULER.CREATE_PROGRAM ½¨ÉèÍⲿ³ÌÐò¡£
PL/SQL Óï¾ä£º½« PL/SQL Óï¾ä×÷ΪʹÃü½ç˵¡£
ÖÎÀí׼ʱÆ÷
¿ÉÒÔËæʱʹÓÃÒÔÏÂÏÂÁîÀ´ÖÎÀí׼ʱÆ÷£º
Éó²é׼ʱÆ÷£º
SELECT * FROM DBA_JOBS;
µÇ¼ºó¸´ÖÆ
Éó²éÍýÏ룺
SELECT * FROM DBA_SCHEDULES;
µÇ¼ºó¸´ÖÆ
½ûÓÃ׼ʱÆ÷£º
DBMS_JOB.BROKEN(job_name);
µÇ¼ºó¸´ÖÆ
ÆôÓÃ׼ʱÆ÷£º
DBMS_JOB.RESUME(job_name);
µÇ¼ºó¸´ÖÆ
ÒÔÉϾÍÊÇoracleÊý¾Ý¿â׼ʱÆ÷Ó÷¨µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡