We help IT Professionals succeed at work.

DBMS SCHEDULER job fails with "The system cannot find the file specified" error

sath350163
sath350163 asked
on
I got the following code from:
https://forums.oracle.com/forums/thread.jspa?messageID=2737501&tstart=0

This job fails with the following error:
ORA-27369: job of type EXECUTABLE failed with exit code: Incorrect function.
STANDARD_ERROR="The system cannot find the file specified."


I'm running the above code in Oracle 10g Express edition.
The OracleJobSchedulerXR is running.
The test.bat file does exist in c:\temp\test.bat.

Is it due to some sort of permission issue?

Thanks!


BEGIN
 
sys.dbms_scheduler.create_job( 
 
job_name => 'testjob',
 
job_type => 'EXECUTABLE',
 
job_action => 'C:\WINDOWS\system32\cmd.exe',
 
repeat_interval => 'FREQ=WEEKLY;BYDAY=MON,TUE,WED,THU,FRI;BYHOUR=21;BYMINUTE=45;BYSECOND=0',
 
--start_date => systimestamp at time zone 'US/Eastern',
 
job_class => 'DEFAULT_JOB_CLASS',
 
comments => 'test job',
 
auto_drop => FALSE,
 
number_of_arguments => 3,
 
enabled => FALSE);
 
sys.dbms_scheduler.set_job_argument_value( job_name => 'testjob', argument_position => 1, argument_value => '/q'); 
 
sys.dbms_scheduler.set_job_argument_value( job_name => 'testjob', argument_position => 2, argument_value => '/c'); 
 
sys.dbms_scheduler.set_job_argument_value( job_name => 'testjob', argument_position => 3, argument_value => '"c:\temp\test.bat"'); 
 
sys.dbms_scheduler.enable( 'testjob' ); 
 
END;

Open in new window

Comment
Watch Question

Commented:
What happens if you change

_name => 'testjob', argument_position => 3, argument_value => '"c:\temp\test.bat"');

to

_name => 'testjob', argument_position => 3, argument_value => 'c:\temp\test.bat');

Author

Commented:
I tried that and it still gives the same error.

Thanks!
Commented:
This example demonstrates how to create a local external job on Windows that runs a DOS built-in command (in this case, mkdir). The job runs cmd.exe with the /c option. Default credentials are used.

BEGIN
DBMS_SCHEDULER.CREATE_JOB(
   job_name             => 'MKDIR_JOB',
   job_type             => 'EXECUTABLE',
   number_of_arguments  => 3,
   job_action           => '\windows\system32\cmd.exe',
   auto_drop            => FALSE);

DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE('mkdir_job',1,'/c');
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE('mkdir_job',2,'mkdir');
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE('mkdir_job',3,'\temp\extjob_test_dir');
DBMS_SCHEDULER.SET_ATTRIBUTE('MKDIR_JOB', 'credential_name', 'STEVE');
DBMS_SCHEDULER.ENABLE('MKDIR_JOB');
END;
/
Commented:
It seems if you drop the drive directive you may have better luck.

Also, turn off the /Q and maybe you will get more information back (although that bit is unlikely).