Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, marwa.

Asked: September 14, 2017 - 10:27 am UTC

Last updated: April 21, 2021 - 3:16 am UTC

Version: oracle 10g

Viewed 1000+ times

You Asked

HI,
I created a bat file to run sqlldr to load the data from a csv file into Oracle,and I want to execute it automatically ,so I tried it by DBMS_SCHEDULER

exec DBMS_SCHEDULER.run_job('DAILY_LOAD');
Rapport d'erreur -
ORA-27369: échec du travail de type EXECUTABLE avec le code sortie : No such file or directory
ORA-06512: à "SYS.DBMS_ISCHED", ligne 196
ORA-06512: à "SYS.DBMS_SCHEDULER", ligne 486
ORA-06512: à ligne 1


dbms_scheduler.create_job (
job_name=>'DAILY_LOAD',
job_type => 'EXECUTABLE',
job_action => 'c:\Windows\System32\cmd.exe',
number_of_arguments => 2,
start_date => SYSTIMESTAMP,
repeat_interval => 'freq=hourly; byminute=0',
end_date => NULL,

enabled => false,
comments => 'TEST'
);


dbms_scheduler.set_job_argument_value (
job_name =>'DAILY_LOAD',
argument_position=>1,
argument_value=> '/c'

);
dbms_scheduler.set_job_argument_value (
job_name =>'DAILY_LOAD',
argument_position=>2,
argument_value=> 'C:\orant10\BIN\loadDB.bat'


);

DBMS_SCHEDULER.enable(
name => 'DAILY_LOAD');

and we said...

I just did this on my machine with no problems -



C:\>type c:\temp\demo.cmd
@echo off
echo Hello > c:\temp\demo.out
dir c:\temp >> c:\temp\demo.out
exit

SQL> declare
  2    vname varchar(20) := 'DEMOJOB';
  3  BEGIN
  4    begin dbms_scheduler.drop_job (vname); exception when others then null; end ;
  5    dbms_scheduler.create_job(
  6      job_name => vname,
  7      job_type => 'EXECUTABLE',
  8      job_action => 'C:\Windows\System32\cmd.exe',
  9      number_of_arguments => 2,
 10      enabled => FALSE);
 11    dbms_scheduler.set_job_argument_value( job_name => vname, argument_position => 1, argument_value => '/c');
 12    dbms_scheduler.set_job_argument_value( job_name => vname, argument_position => 2, argument_value => 'c:\temp\demo.cmd');
 13    dbms_scheduler.enable( vname);
 14
 15  END;
 16  /

PL/SQL procedure successfully completed.


So perhaps use a CMD file rather than a BAT file.

Also, on Windows, check the the "Oracle JobScheduler" service is running. If that isnt running you'll get errors in your alert log, eg, I disabled my service and I see this:

2017-09-15T08:46:30.042872+08:00
Errors in file C:\ORACLE\diag\rdbms\db122\db122\trace\db122_j000_10140.trc:
ORA-12012: error on auto execute of job "MCDONAC"."DEMOJOB"
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing job scheduler service failed with status: 2
ORA-27301: OS failure message: The system cannot find the file specified.
ORA-27302: failure occurred at: sjsec 5
ORA-27303: additional information: The system cannot find the file specified.



Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

marwa zerzeri, September 15, 2017 - 8:19 am UTC


munaf rafique, April 20, 2021 - 9:39 am UTC

enabling the OracleJobSceduler Service did the trick for me.
Thank you. Keep up the great work
Connor McDonald
April 21, 2021 - 3:16 am UTC

Glad we could help

More to Explore

Scheduler

All of the database utilities including the Scheduler are explained in the Utilities guide.