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

[轉載]ORACLE¼Æ»®(schedule)Ïê½â

. ´´½¨job
jobÊÇʲôÄØ? ¼òµ¥µÄ˵¾ÍÊǼƻ®(schedule)¼ÓÉÏÈÎÎñ˵Ã÷. ÁíÍ⻹ÓÐһЩ±ØÐëµÄ²ÎÊý.
ÕâÀïÌáµ½µÄ"ÈÎÎñ"¿ÉÒÔÊÇÊý¾Ý¿âÄÚ²¿µÄ´æ´¢¹ý³Ì,ÄäÃûµÄPL/SQL¿é,Ò²¿ÉÒÔÊDzÙ×÷ϵͳ¼¶±ðµÄ½Å±¾.
¿ÉÒÔÓÐÁ½ÖÖ·½Ê½À´¶¨Òå"¼Æ»®":
1) ʹÓÃDBMS_SCHDULER.CREATE_SCHEDULE ¶¨ÒåÒ»¸ö¼Æ»®;
2) µ÷ÓÃDBMS_SCHDULER.CREATE_JOBE¹ý³ÌÖ±½ÓÖ¸¶¨ (ÏÂÃæ»áÏêϸ˵Ã÷)
ÔÚ´´½¨Ò»¸ö¼Æ»®Ê±£¬ÄãÖÁÉÙÐèÒªÖ¸¶¨ÏÂÃæµÄÊôÐÔ£¬ËüÃÇÊÇjobÔËÐÐËù±ØÐëµÄ:
¿ªÊ¼Ê±¼ä (start_time);
Öظ´ÆµÂÊ (repeat_interval);
½áÊøʱ¼ä (end_time)
ÁíÍ⣬¶ÔÓÚÒ»¸öjob¶øÑÔ£¬»¹ÓкܶàµÄ¸½¼Ó²ÎÊý:
job_class
job_priority
auto_drop
restartable
max_runs
max_failures
schedule_limit
logging_level
ÏÂÃ棬ÎÒÒÔÎÊ´ðµÄÐÎʽÀ´¾ßÌå½âÊÍ.
Q1:Ôõô´ÓÊý¾Ý¿âÖвéѯjobµÄÊôÐÔ ?
A1: ÓÐÁ½ÖÖ·½·¨:
1) ²éѯ(DBA|ALL|USER)_SCHEDULER_JOBS ÊÓͼ
(Ìáʾ: ¸ù¾ÝÓû§È¨Ï޵IJ»Í¬£¬Ñ¡ÔñÐԵIJéѯ DBA|ALL|USERÊÓͼ)
2) µ÷ÓÃDBMS_SCHEDULER°üÖеÄGET_ATTRIBUTE ¹ý³Ì
Q2: ÔõôÉèÖÃÕâЩÊôÐÔÄØ?
A2: Ò²ÊÇÓÐÁ½ÖÖ·½·¨
1) ÔÚ´´½¨jobʱֱ½ÓÖ¸¶¨
2) µ÷ÓÃDBMS_SCHEDULER°üÖеÄSET_ATTRIBUTE ¹ý³Ì
Q3: "ÎÒÐèҪʲôȨÏÞ²ÅÄÜ´´½¨job" ?
A3: ÄãÖÁÉÙÐèÒªcreate_jobÕâ¸öϵͳȨÏÞ¡£Èç¹ûÓû§ÓµÓÐcreate any jobÕâ¸öȨÏÞ£¬
Ëü¿ÉÒÔ´´½¨ÊôÖ÷ΪÈκÎÓû§(SYSÓû§³ýÍâ)µÄjob.
ȱʡÇé¿öÏÂ,job»á±»´´½¨ÔÚµ±Ç°µÄschemaÏ£¬²¢ÇÒÊÇûÓ줻îµÄ; Èç¹ûҪʹjobÒ»´´½¨
¾Í×Ô¶¯¼¤»î£¬ÐèÒªÏÔʽµÄÉèÖÃenabled ÊôÐÔΪtrue, À´¿´Ò»¸öÀý×Ó:
begin
dbms_scheduler.create_job
(
job_name => 'ARC_MOVE',
schedule_name => 'EVERY_60_MINS',
job_type => 'EXECUTABLE',
job_action => '/home/dbtools/move_arcs.sh',
enabled => true,
comments => 'Move Archived Logs to a Different Directory'
);
end;
/
Q4: Äܲ»ÄÜÏêϸµØ½²ÊöÒ»ÏÂÉÏÃæÕâ¸ö¹ý³ÌÓõ½µÄ¸÷¸ö²ÎÊý?
A4:
job_name: ¹ËÃû˼Òå,ÿ¸öjob¶¼±ØÐëÓÐÒ»¸öµÄÃû³Æ
schedule_name: Èç¹û¶¨ÒåÁ˼ƻ®£¬ÔÚÕâÀïÖ¸¶¨¼Æ»®µÄÃû³Æ
job_type: Ä¿Ç°Ö§³ÖÈýÖÖÀàÐÍ:
PL/SQL¿é: PLSQL_BLOCK,
´æ´¢¹ý³Ì: STORED_PROCEDURE
Íⲿ³ÌÐò: EXECUTABLE (Íⲿ³ÌÐò¿ÉÒÔÊÇÒ»¸öshell½Å±¾,Ò²¿ÉÒÔÊDzÙ×÷ϵͳ¼¶±ðµÄÖ¸Áî).
job_action: ¸ù¾Ýjob_typeµÄ²»Í¬£¬job_actionÓв»Í¬µÄº¬Òå.
Èç¹ûjob_typeÖ¸¶¨µÄÊÇ´æ´¢¹ý³Ì£¬¾ÍÐèÒªÖ¸¶¨´æ´¢¹ý³ÌµÄÃû×Ö;
Èç¹ûjob_typeÖ¸¶¨µÄÊÇPL/SQL¿é£¬¾ÍÐèÒªÊä


Ïà¹ØÎĵµ£º

oracle¸´Ï°£¨Ò»£© Ö®OracleÌåϵ½á¹¹

      ѧϰOracle DBAÒ²°ë¸ö¶àѧÆÚÁË£¬½ñÌìÃÍÈ»²Å·¢ÏÖ£¬Ô­À´ÎÒµÄÊ黹ÊǺÜеģ¬ÉϿβÙ×÷ʱºòÒ²Ö»ÊÇÖªµÀ´ó¸ÅÔõô×ö£¬µ«ÊÇÒªÕæµÄÈ«²¿×Ô¼º×ö£¬¶ø²»È¥·­Ê黹ÊÇÓÐÒ»¶¨µÄÄѶȵģ¬ËùÒÔÄØ£¬½ñÌ쿪ʼ½«DBA´ÓÍ·¸´Ï°Ò»±é£¬Í¬Ê±ÔÙ²Ù×÷Ò»±é¡£
      µÚÒ»Õ£¬Ñ§µÄÊÇOracleµÄÌåϵ½á¹¹£ ......

OracleÖÐ×ÔÔö×ֶεĴ´½¨

²½Ö裺
1.Ê×ÏÈ£¬ÄãÒªÓÐÒ»ÕÅ±í£¡
       CREATE TABLE example(
             ID Number(4) NOT NULL PRIMARY KEY,
             NAME VARCHA ......

MsSql ºÍ Oracle ¿çÊý¾Ý¿â²éѯ

SQL
insert into   table_name(colum1,colum2)
select  colum1,colum2
 from  opendatasource('sqloledb','data source=·þÎñÆ÷Ãû;user id=Óû§Ãû ;password=ÃÜÂë ').database_name.dbo.table_name
ÈçÖ´ÐгöÏÖÒÔÏ´íÎó”sql server ×èÖ¹Á˶Ô×é¼þ \'ad hoc distributed queries\' µÄ·ÃÎÊ&l ......

oracleÖÐÅжÏÒ»¸ö×Ö·û´®ÊÇ·ñÈ«²¿ÎªÊý×ֵĺ¯Êý

參¿¼:http://blog.csdn.net/rainnyzhong/archive/2009/01/09/3740660.aspx
×÷ÕߣºRainny
ÈÕÆÚ£º2009-1-8
´´½¨²âÊÔ±í£º
create table test(c_id   varchar2(20));
²åÈë²âÊÔÊý¾Ý£º
insert into test values ('1234');
 insert into test values ('45678');
 insert into test values ('-12 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ