1 Reply Latest reply: Jul 5, 2012 4:25 PM by Rose Elle RSS

    ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function

    Rose Elle
      Hello,

      I am calling a windows bat file using dbms_scheduler and getting the following error. I have searched the forum and the internet and tried different switches and options. None of them solved my problem.


      Oracle Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
      OracleJobScheduler is running as a service


      Error starting at line 1 in command:
      execute GET_RESULTS();
      Error report:
      ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
      ORA-06512: at "SYS.DBMS_ISCHED", line 185
      ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
      ORA-06512: at "PS.GET_RESULTS", line 67
      ORA-06512: at line 1
      27369. 00000 - "job of type EXECUTABLE failed with exit code: %s"
      *Cause:    A problem was encountered while running a job of type EXECUTABLE.
      The cause of the actual problem is identified by the exit code.
      *Action:   Correct the cause of the exit code and reschedule the job.


      Here is the code for scheduler
            dbms_output.put_line(os_commandline || utlPath || fileSeparator || 'get.bat >nul')
      
            dbms_scheduler.create_job
            (   job_name          =>'PS_GET_RESULTS'
                  , job_action        => os_commandline || utlPath || fileSeparator || 'get.bat >nul'
                  , job_type          =>'executable'
                  , enabled           =>false
                  , auto_drop         =>false
                  , start_date        =>systimestamp
            ); 
      
            dbms_scheduler.run_job(job_name =>'PS_GET_RESULTS');
      The dbs_output prints a line which shows that the parameters os_commandline, utlPath and fileSeparator are set correctly.
           C:\windows\system32\cmd.exe /q /c E:\UTLDir\get.bat >nul
      The windows file (get.bat) is:
           "C:\Program Files (x86)\WinSCP\Winscp.exe" /script=e:\utldir\get_results
      This batch file passes a script file to the executable winscp.exe to get files from another server.

      The script file (get_results) is:
           option batch abort
           option confirm off
           open sftp://username:password@ipnumber:port -hostkey="ssh-rsa 1024 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
           cd /usr/dropbox/
           option transfer binary
           get *.results E:\UTLDir\Results\
           close
           exit
      I tested the batch file directly and works fine and "gets" the files from the server. But, invoking from Oracle dbms_scheduler fails with ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.


      Appreciate your help and time in suggesting additional guidelines or pointers.

      Thanks,
      Rose