8 Replies Latest reply on Nov 7, 2012 3:57 PM by 971785

    Problem running DBMS_SCHEDULER external job

    971785
      I've recently stated working with Oracle DBMS_SCHEDULER and it's always worked with jobs that run inside the database. Now I need to run an external job and could manage to get it working at one server with the following configuration:

      BEGIN
      SYS.DBMS_SCHEDULER.CREATE_JOB
      (
      job_name => 'JOBNAME'
      ,start_date => TO_TIMESTAMP_TZ('2012/11/01 02:00:00.000000 -03:00','yyyy/mm/dd hh24:mi:ss.ff tzh:tzm')
      ,repeat_interval => 'FREQ=DAILY; BYDAY=MON,TUE,WED,THU,FRI,SAT; BYHOUR=02; BYMINUTE=00; BYSECOND=00'
      ,end_date => NULL
      ,job_class => 'DEFAULT_JOB_CLASS'
      ,job_type => 'EXECUTABLE'
      ,job_action => 'D:\FOLDER1\FOLDER2\BatchFile.bat'
      ,comments => NULL
      );
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'RESTARTABLE'
      ,value => TRUE);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'LOGGING_LEVEL'
      ,value => SYS.DBMS_SCHEDULER.LOGGING_FULL);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
      ( name => 'JOBNAME'
      ,attribute => 'MAX_FAILURES');
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
      ( name => 'JOBNAME'
      ,attribute => 'MAX_RUNS');
      BEGIN
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'STOP_ON_WINDOW_CLOSE'
      ,value => FALSE);
      EXCEPTION
      WHEN OTHERS THEN
      NULL;
      END;
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'JOB_PRIORITY'
      ,value => 1);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE_NULL
      ( name => 'JOBNAME'
      ,attribute => 'SCHEDULE_LIMIT');
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'AUTO_DROP'
      ,value => FALSE);
      SYS.DBMS_SCHEDULER.SET_ATTRIBUTE
      ( name => 'JOBNAME'
      ,attribute => 'RAISE_EVENTS'
      ,value => SYS.DBMS_SCHEDULER.JOB_STARTED + SYS.DBMS_SCHEDULER.JOB_SUCCEEDED + SYS.DBMS_SCHEDULER.JOB_FAILED + SYS.DBMS_SCHEDULER.JOB_BROKEN + SYS.DBMS_SCHEDULER.JOB_COMPLETED + SYS.DBMS_SCHEDULER.JOB_STOPPED + SYS.DBMS_SCHEDULER.JOB_SCH_LIM_REACHED + SYS.DBMS_SCHEDULER.JOB_DISABLED + SYS.DBMS_SCHEDULER.JOB_CHAIN_STALLED);

      SYS.DBMS_SCHEDULER.ENABLE(name => 'JOBNAME');
      END;
      /

      The problem is: every other server I try to schedule it, the job just doesn't work appropriately. The job does run, but doens't seem to get permission on Windows environment to do what it is supposed to.
      --
      Doen anyone know anything that should be done to get this working?