È«Ãæѧϰ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 £º¼Ç¼ÈÎÎñËùÓÐÏà¹ØÐÅÏ¢£¬²»½öÓÐÈÎÎñµÄÔËÐÐÇ
Ïà¹ØÎĵµ£º
SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
A A ZERO ......
SQLÖеĵ¥¼Ç¼º¯Êý
1.ASCII
·µ»ØÓëÖ¸¶¨µÄ×Ö·û¶ÔÓ¦µÄÊ®½øÖÆÊý;
SQL> select ascii('A') A,ascii('a') a,ascii('0') zero,ascii(' ') space from dual;
A A ZERO SPACE
--------- --------- -- ......
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_ch ......
OracleÈÕÆÚº¯Êý¼¯½õ(Èý)
Èý¡¢Ò»Ð©Êµ¼ùºóµÄÓ÷¨£º
1.ÉÏÔÂÄ©Ì죺
select to_char(add_months(last_day(sysdate),-1),'yyyy-MM-dd') LastDay from dual£»
2.ÉÏÔ½ñÌì
SQL> select to_char(add_months(sysdate,-1),'yyyy-MM-dd') PreToday from dual;
3.ÉÏÔÂÊ×Ìì
SQL> select to_char(add_months(last_day(sysdate ......
×òÌìÔÚÕûÀíÎļþ¼ÐµÄʱºò²»Ð¡ÐĽ«Ò»¸ödbfÊý¾ÝÎļþÒƶ¯ÁË£¬½ñÌìµÇ¼plsqlʱȴ·¢ÏÖÌáʾora-01033£ºoracle initialization or shutdown in progressµÄ´íÎ󣬿ªÊ¼ÒÔsqlnet.oraµÄÎļþÅäÖÃÎļþ£¬µ«ÊǸÄÀ´¸ÄÈ¥»¹ÊǵǼ²»ÁË¡£×îºó°´ÕÕÍøÓѵÄÌáʾ½«sqlnet.oraÎļþÖеÄSQLNET.AUTHENTICATION_SERVICES= (NTS)¸Ä³ÉÁËSQLNET.AUTHENTICATI ......