试图将作业与窗口相关联。连接应该使用 schedule_name 工作,但它似乎不起作用。
可重现的例子
创建窗口每隔一分钟打开一次
SQL> begin
2 DBMS_SCHEDULER.CREATE_WINDOW (
3 window_name => 'traffic_window',
4 resource_plan => null,
5 repeat_interval => 'FREQ=minutely;interval=2',
6 duration => interval '1' minute
7 );
8 END;
9 /
PL/SQL procedure successfully completed.
SQL> select WINDOW_NAME,SCHEDULE_NAME,SCHEDULE_TYPE,ENABLED,ACTIVE from all_scheduler_windows;
WINDOW_NAME SCHEDULE_NAME SCHEDULE ENABL ACTIV
------------------------------ ----------------------------------- -------- ----- -----
TRAFFIC_WINDOW CALENDAR TRUE TRUE
好的,正在关联作业
SQL> exec dbms_scheduler.drop_job('test_window_job',true);
PL/SQL procedure successfully completed.
SQL> begin
2 dbms_scheduler.create_job (
3 job_name => 'test_window_job',
4 job_type => 'PLSQL_BLOCK',
5 job_action => 'begin test_func(70,''start'',0,null); end;',
6 schedule_name => 'traffic_window',
7 enabled => false,
8 auto_drop => true
9 );
10
11 dbms_scheduler.set_attribute ('test_window_job','max_runs',1);
12 dbms_scheduler.set_attribute ('test_window_job','stop_on_window_close',true);
13 end;
14 /
PL/SQL procedure successfully completed.
SQL> exec dbms_scheduler.enable('test_window_job');
BEGIN dbms_scheduler.enable('test_window_job'); END;
*
ERROR at line 1:
ORA-27481: "HAKI.TEST_WINDOW_JOB" has an invalid schedule
ORA-27476: "HAKI.TRAFFIC_WINDOW" does not exist
ORA-06512: at "SYS.DBMS_ISCHED", line 2751
ORA-06512: at "SYS.DBMS_SCHEDULER", line 1794
ORA-06512: at line 1
create_job
明确说明的文档
schedule_name - 与此作业关联的计划、窗口或窗口组的名称。
有什么问题 ???
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Prod
PL/SQL Release 10.2.0.3.0 - Production
CORE 10.2.0.3.0 Production
TNS for 32-bit Windows: Version 10.2.0.3.0 - Production
NLSRTL Version 10.2.0.3.0 - Production