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

È«ÃæѧϰORACLE SchedulerÌØÐÔ(2)¹ÜÀíjobs

1.2 ¹ÜÀíJobs
1.2.1 ÆôÓÃJobs
¡¡¡¡Ç°Ãæ´´½¨JOBʱ£¬ÓÉÓÚδÏÔʽµÄÖ¸¶¨ENABLED²ÎÊý£¬Òò´Ë¼´Ê¹Ö¸¶¨ÁËSTART_DATE£¬²»¹ýĬÈÏÇé¿öÏÂJOB²»»á×Ô¶¯Ö´ÐС£¶ÔÓÚÕâÖÖÇé¿ö£¬DBMS_SCHEDULER°üÖÐÌṩÁËÒ»¸ö¹ý³ÌENABLE£¬¿ÉÒÔÓÃÀ´ÐÞ¸ÄJOBµÄÆôÓÃ״̬£¬µ÷Ó÷½Ê½·Ç³£¼òµ¥£¬ÀýÈ磺
SQL> exec dbms_scheduler.enable(¨INSERT_TEST_TBL¨);
PL/SQL procedure successfully completed.
1.2.2 ½ûÓÃJobs
¡¡¡¡DBMS_SCHEDULER.ENABLE ½öÓÃÀ´½«JOB(Æäʵ²»½ö½ö¶ÔJOBÓÐЧ£¬¶ÔÓÚCHAIN¡¢PROGRAMµÈÒ²ÓÐЧ)µÄÆôÓÃ״̬ÖÃΪTRUE¡£Èç¹ûÏ뽫ÆäÆôÓÃ״̬ÖÃΪFALSE£¿¼òµ¥£¬»¹ÓÐÒ»¸öÓë¸Ã¹¦ÄܶÔÓ¦µÄ¹ý³Ì£ºDBMS_SCHEDULER.DISABLE£¬ÀýÈ磺
SQL> exec dbms_scheduler.disable(¨INSERT_TEST_TBL¨);
PL/SQL procedure successfully completed.
¡¡¡¡ÕâÁ½¸ö¹ý³Ì½öÓÃÀ´ÖØÖöÔÏóµÄ״̬£¬Òò´Ë¾ù¿ÉÒÔÎÞÏÞ´ÎÖ´ÐУ¬¼´Ê¹Ö´ÐÐʱ¶ÔÏóÒѾ­±»ÖÃΪҪָ¶¨µÄ״̬¡£
1.2.3 ÐÞ¸ÄJobs
¡¡¡¡ÓÉÓÚJOBµÄÊôÐÔÖڶ࣬ÄÑÃâʱ²»Ê±µÄ¿ÉÄÜ»áÓöµ½ÐèÒªÐ޸ĵÄÇé¿ö£¬±ÈÈç˵ǰÃæ´´½¨JOBʱ²»Ð¡ÐÄ£¬Ö¸¶¨ÒªÖ´ÐеĹý³ÌÃûÊäÈë´íÎó(ÍêÈ«ÓпÉÄÜ£¬CREATE_JOBÔÚ´´½¨Ê±²»»á×Ô¶¯¼ì²éÖ¸¶¨µÄ¹ý³ÌÊÇ·ñÓÐЧ£¬´ÓÕâ·½Ã濼ÂÇ£¬SCHEDULER²»ÈçÆÕͨJOBÑϽ÷ÄÄ)£¬ÕâÖÖÇé¿öϾͱØÈ»Éæ¼°µ½¶ÔJOBµÄÐÞ¸Ä(»òÕß˵Öض¨Òå)£¬Ã»ÎÊÌ⣬DBMS_SCHEDULER°üÖÐרÃÅÌṩÁËÒ»¸ö¹ý³ÌSET_ATTRIBUTE£¬¿ÉÒÔÓÃÀ´ÐÞ¸ÄÈÎÎñµÄÊôÐÔÖµ¡£
¡¡¡¡ÀýÈ磬Ð޸ĸոմ´½¨µÄJOB£ºINSERT_TEST_TBLÖ´ÐеĹý³Ì£¬Ö´ÐÐÓï¾äÈçÏ£º
SQL> exec dbms_scheduler.set_attribute(¨INSERT_TEST_TBL¨,¨JOB_ACTION¨,¨P_ INSERT INTOTEST¨);
PL/SQL procedure successfully completed
¡¡¡¡µ±È»À²£¬ÎÒÃÇÕâÀïÖ´ÐеÄÕâÌõÓï¾ä£¬Ö´ÐиúûִÐÐûÓÐÇø±ð£¬´Ë´¦½ö×öʾÀý£¬´ó¼Ò±íÉ¡£
¡¡¡¡SET_ATTRIBUTE ¹ý³ÌËäÈ»½öÓÐÈý¸ö²ÎÊý£¬²»¹ýÄܹ»Ð޸ĵÄÊôÐÔÖµ¿ÉÊDz»ÉÙ£¬ÒÔÏÂÁоټ¸¸ö½Ï³£Óõ½µÄ£º
LOGGING_LEVEL £ºÖ¸¶¨¶ÔjobsÖ´ÐÐÇé¿ö¼Ç¼µÄÈÕÖ¾ÐÅÏ¢¼¶±ð¡£
SCHEDULER ¹ÜÀíµÄJOB¶ÔÈÎÎñµÄÖ´ÐÐÇé¿öרÃŽøÐÐÁ˼Ǽ£¬Í¬Ê±Óû§»¹¿ÉÒÔÑ¡ÔñÈÕÖ¾ÖмǼÐÅÏ¢µÄ¼¶±ð£¬ÓÐÏÂÁÐÈýÖÖÑ¡Ôñ£º
DBMS_SCHEDULER.LOGGING_OFF £º¹Ø±ÕÈÕÖ¾¼Ç¼¹¦ÄÜ£»
DBMS_SCHEDULER.LOGGING_RUNS £º¶ÔÈÎÎñµÄÔËÐÐÐÅÏ¢½øÐмǼ£»
DBMS_SCHEDULER.LOGGING_FULL £º¼Ç¼ÈÎÎñËùÓÐÏà¹ØÐÅÏ¢£¬²»½öÓÐÈÎÎñµÄÔËÐÐÇé¿ö£¬ÉõÖÁÁ¬ÈÎÎñµÄ´´½¨¡¢Ð޸ĵÈÒ²¾ù½«¼ÇÈëÈÕÖ¾¡£
Ìáʾ£º²é¿´SCHEDULER¹ÜÀíµÄJOB£¬¿ÉÒÔͨ¹ýUSER_


Ïà¹ØÎĵµ£º

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 xmltype¼ò½é

ÕÒ²»µ½Ô­ÌûÁË  ¾ÍÌùÕâÀï°É£¡
ÔÚÏò´ó¼ÒÏêϸ½éÉÜOracle֮ǰ£¬Ê×ÏÈÈôó¼ÒÁ˽âÏÂOracle xmltypeÊÇʲô£¬Oracle´Ó9i¿ªÊ¼Ö§³ÖÒ»ÖÖеÄÊý¾ÝÀàÐÍ----
xmltype£¬ÓÃÓÚ´æ´¢ºÍ¹ÜÀíxmlÊý¾Ý£¬²¢ÌṩÁ˺ܶàµÄfunctions£¬ÓÃÀ´Ö±½Ó¶ÁÈ¡xmlÎĵµºÍ¹ÜÀí½Úµã¡£ÏÂÃ潫½éÉÜOracle
xmltypeµÄһЩ»ù±¾Ê¹Óá£
1.½¨Á¢º¬ÓÐOracle xmltypeÊý¾Ý ......

¹ØÓÚOracle 10g scottÓû§½âËøµÄ·½·¨

ÒÔsystemµÇ¼½øÈ¥Ö®ºó£¬Ö´ÐÐÏÂÃæµÄÃüÁ
SQL> alter user scott account unlock; £¨Íê³É½âËøµÄ²Ù×÷£©
 Óû§ÒѸü¸Ä¡£
SQL> alter user scott identified by tiger; £¨ÖØиøscottÕâ¸öÓû§É趨ÃÜÂ룩
 Óû§ÒѸü¸Ä¡£
SQL> conn scott/tiger  
ÒÑÁ¬½Ó¡£ ......

ORACLEµ÷ÓÅÖ® ¶à»º´æ³ØÃüÖÐÂÊ£¨Õª×ÔÎÄƽÊ飩

ÆÀ¹ÀÊý¾Ý¸ßËÙ»º´æЧÂʵÄÖ¸±êÊÇÃüÖÐÂÊ¡£¸ÃÃüÖÐÂÊͨ¹ý²éѯV$SYSSTAT ºÍ$BUFFER_POOL_STATISTICSÊÓͼ¿ÉÒԵõ½¡£Õâ¸öÊÓͼ¿ÉÒÔ
²éѯÿ¸ö»º´æ³Ø¸÷×ÔµÄÃüÖÐÂÊ¡£»º´æ³ØµÄÃüÖÐÂʵļÆËã²ÉÓÃÏÂÃæµÄ¹«Ê½:
   1-(physical_reads/(db_block_gets+consistent_gets))
   ÏÂÃæµÄSQLÓï¾ä³£ÓÃÀ´²éѯµ±Ç°¸÷¸ö»º´æ³ØµÄÃüÖ ......

Oracle 10g schedule jobµÄ³£ÓòÙ×÷

OracleÊý¾Ý¿â10g schedule jobµÄ³£ÓòÙ×÷:
-- job ȨÏÞ
grant create job to somebody;
-- job ´´½¨
begin
dbms_scheduler.create_job (
job_name => 'AGENT_LIQUIDATION_JOB',
job_type => 'STORED_PROCEDURE',
job_action => 'AGENT_LIQUIDATION.LIQUIDATION', --´æ´¢¹ý³ÌÃû
start_date => ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ