Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

È«ÃæѧϰORACLE SchedulerÌØÐÔ(1)´´½¨jobs

Ëùν³öÓÚjob¶øʤÓÚjob£¬ËµµÄ¾ÍÊÇOracle 10gºóµÄÐÂÌØÐÔSchedulerÀ²¡£ÔÚ10g»·¾³ÖУ¬ORACLE½¨ÒéʹÓÃSchedulerÌæ»»ÆÕͨµÄjob£¬À´¹ÜÀíÈÎÎñµÄÖ´ÐС£Æäʵ£¬½«SchedulerÃèÊö³É¹ÜÀíjobµÄ¹¤¾ßÒѾ­Ì«¹ýƬÃæÁË£¬10G°æ±¾ÖÐÐÂÔöµÄScheduler¾ø²»½ö½öÊÇ´´½¨ÈÎÎñÕâô¼òµ¥¡£¡£¡£¡£
Ìáʾ£ºORACLEÖйÜÀíSchedulerÊÇͨ¹ýDBMS_SCHEDULER°ü£¬±¾ÕÂÒ²ÒÔ´ËΪÇÐÈëµã£¬Í¨¹ýÏêϸ½éÉÜDBMS_SCHEDULER°üµÄʹÓã¬À´ÑÝʾÈçºÎʹÓÃScheduler¡£Ëƺõ±¾Ä©µ¹ÖÃÁË£¬Ã»¹Øϵ£¬"Èý˼±Ê¼Ç"£¬°³µÄµØÅÌ°³×öÖ÷¡£
Ò»¡¢Ê¹ÓÃJobs
¡¡¡¡ËùνJOBS£¬Æäʵ¾ÍÊÇScheduler¹ÜÀíµÄÒ»¸ö(»ò¶à¸ö)ÈÎÎñµÄÖ´Ðе÷¶È¡£
1.1 ´´½¨Jobs
¡¡¡¡Í¨¹ýDBMS_SCHEDULER°üÀ´´´½¨Jobs£¬ÊÇʹÓÃÆäCREATE_JOB¹ý³Ì¡£ÔÚ´´½¨Jobʱ£¬Óû§¿ÉÒÔÖ¸¶¨ÒªÖ´ÐеÄÈÎÎñ£¬µ÷¶ÈÐÅÏ¢(ɶʱºòÖ´ÐУ¬Ö´ÐÐÖÜÆÚ£¬ÖÕÖ¹ÈÕÆÚµÈ)ÒÔ¼°ÆäËüһЩÈÎÎñÏà¹ØµÄÊôÐÔ¡£CREATE_JOB¹ý³Ìµ÷Óû¹ÊDZȽϼòµ¥µÄ£¬ÀýÈ磺
SQL> BEGIN
2 DBMS_SCHEDULER.CREATE_JOB (
3 job_name => 'INSERT_TEST_TBL',
4 job_type => 'STORED_PROCEDURE',
5 job_action => ' P_ INSERT INTOTEST ',
6 start_date => sysdate,
7 repeat_interval => 'FREQ=DAILY;INTERVAL=1');
8 END;
9 /
PL/SQL ¹ý³ÌÒѳɹ¦Íê³É¡£
¡¡¡¡ÊÂʵÉÏ£¬ÓÐȨÏ޵Ļ°£¬Óû§Ò²¿ÉÒÔ´´½¨ÆäËüSCHEMAϵÄJOB£¬Ö»ÐèÒªÔÚÖ¸¶¨JOB_NAMEʱ£¬°´ÕÕschema.job_nameµÄ¸ñʽ¼´¿É¡£×¢ÒâÓ´£¬ÕâÖÖÇé¿öÏ´´½¨µÄJOB£¬ÆäCREATEDÓëOWNERÓпÉÄܲ¢²»ÏàͬµÄÓ´¡£
¡¡¡¡µ±Ê¹ÓÃCREATE_JOB¹ý³Ì´´½¨JOBʱ£¬¿ÉÖ¸¶¨µÄ²ÎÊýÖµºÜ¶à£¬Ö»²»¹ý¶àÊýÇé¿öÏÂÓû§½öÖ¸¶¨²¿·Ö²ÎÊý¼´¿ÉÂú×ãÐèÇó¡£
¡¡¡¡ÆäÖУ¬ÉÏÀýÖÐÖ¸¶¨µÄ²ÎÊý£¬·Ö±ð´ú±íµÄº¬ÒåÈçÏ£º
JOB_NAME £ºÖ¸¶¨ÈÎÎñµÄÃû³Æ£¬±ØÑ¡Öµ£¬×¢ÒâҪȷ±£Ö¸¶¨µÄÃû³ÆΨһ¡£
JOB_TYPE £ºÈÎÎñÖ´ÐеIJÙ×÷ÀàÐÍ£¬±ØÑ¡Öµ£¬ÓÐÏÂÁм¸¸ö¿ÉÑ¡Öµ£º
PLSQL_BLOCK £º±íʾÈÎÎñÖ´ÐеÄÊÇÒ»¸öPL/SQLÄäÃû¿é¡£
STORED_PROCEDURE £º±íʾÈÎÎñÖ´ÐеÄÊÇORACLE¹ý³Ì(º¬PL/SQL PROCEDUREºÍJAVA PROCEDURE)£¬±¾ÀýÖÐÕýÊÇÖ¸¶¨ÕâÒ»²ÎÊýÖµ¡£
EXECUTABLE £º±íʾÈÎÎñÖ´ÐеÄÊÇÒ»¸öÍⲿ³ÌÐò£¬±ÈÈç˵²Ù×÷ϵͳÃüÁî¡£
CHAIN £º±íʾÈÎÎñÖ´ÐеÄÊÇÒ»¸öCHAIN¡£
JOB_ACTION £ºÈÎÎñÖ´ÐеIJÙ×÷£¬±ØÑ¡Öµ£¬Ó¦ÓëJOB_TYPEÀàÐÍÖÐÖ¸¶¨µÄ²ÎÊýÏàÆ¥Åä¡£
±ÈÈç˵¶ÔÓÚPL/SQLÄäÃû¿é£¬´Ë´¦¾Í¿ÉÒÔ·ÅÖÃPL/SQL¿éµÄ¾ßÌå´ú±í£¬ÀàËÆDECLARE .. BEGIN ..ENDÕâÀࣻÈç¹


Ïà¹ØÎĵµ£º

Oracle Finalizes Acquisition of Sun


We are pleased to announce that Oracle has completed its acquisition of Sun Microsystems and Sun is now a wholly owned subsidiary of Oracle. With this news, we want to reiterate our commitment to deliver complete, open and integrated systems that help our customers improve the performance, reliabi ......

¹ØÓÚOracle to_char()º¯ÊýÖеÄIW,WW ÖܱðÏÔʾ

1£©wwµÄË㷨ΪÿÄê1ÔÂ1ÈÕΪµÚÒ»ÖÜ¿ªÊ¼£¬date+6ΪÿһÖܽáβ
¡¡¡¡ÀýÈç20050101ΪµÚÒ»ÖܵĵÚÒ»Ì죬¶øµÚÒ»ÖܵÄ×îºóÒ»ÌìΪ20050101+6=20050107
¡¡¡¡¹«Ê½ ÿÖܵÚÒ»Ìì £ºdate + ÖÜ * 7 - 7
¡¡¡¡Ã¿ÖÜ×îºóÒ»Ì죺date + ÖÜ * 7 - 1
2£©iwµÄË㷨ΪÐÇÆÚÒ»ÖÁÐÇÆÚÈÕËãÒ»ÖÜ£¬ÇÒÿÄêµÄµÚÒ»¸öÐÇÆÚһΪµÚÒ»ÖÜ£¬
¡¡¡¡ ÀýÈç20050101Î ......

oracleÈÕÆÚº¯Êý¼¯½õ

Ò»¡¢ ³£ÓÃÈÕÆÚÊý¾Ý¸ñʽ
1.Y»òYY»òYYY ÄêµÄ×îºóһ룬Á½Î»»òÈýλ
SQL> Select to_char(sysdate,'Y') from dual;
TO_CHAR(SYSDATE,'Y')
--------------------
7
SQL> Select to_char(sysdate,'YY') from dual;
TO_CHAR(SYSDATE,'YY')
---------------------
07
SQL> Select to_char(sysdate,'YYY') from d ......

oracle´¥·¢Æ÷

´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì£¬ËüÔÚ²åÈ룬ɾ³ý»òÐÞ¸ÄÌض¨±íÖеÄÊý¾Ýʱ´¥·¢Ö´ÐУ¬Ëü±ÈÊý¾Ý¿â±¾Éí±ê×¼µÄ¹¦ÄÜÓиü¾«Ï¸ºÍ¸ü¸´ÔÓµÄÊý¾Ý¿ØÖÆÄÜÁ¦¡£Êý¾Ý¿â´¥·¢Æ÷ÓÐÒÔϵÄ×÷Óãº
¡¡¡¡* °²È«ÐÔ¡£¿ÉÒÔ»ùÓÚÊý¾Ý¿âµÄֵʹÓû§¾ßÓвÙ×÷Êý¾Ý¿âµÄijÖÖȨÀû¡£
¡¡¡¡# ¿ÉÒÔ»ùÓÚʱ¼äÏÞÖÆÓû§µÄ²Ù×÷£¬ÀýÈç²»ÔÊÐíÏ°àºóºÍ½Ú¼ÙÈÕÐÞ¸ÄÊý¾Ý¿âÊý¾Ý¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ