Re: Help getting an EXECUTABLE to run under DBMS_SCHEDULER



On 21 Dec 2005 06:18:08 -0800, "GeoPappas" <PappasG@xxxxxxxxx> wrote:

>The following command (which just executes the date command) says that
>it completes successfully:
>
>BEGIN
>DBMS_SCHEDULER.CREATE_JOB(
> job_name => 'test',
> job_type => 'EXECUTABLE',
> job_action => '/usr/bin/date',
> enabled => TRUE
>);
>END;
>/
>
>But the following command (which appends the output of the date command
>to a file in the tmp directory) fails:
>
>BEGIN
>DBMS_SCHEDULER.CREATE_JOB(
> job_name => 'test',
> job_type => 'EXECUTABLE',
> job_action => '/usr/bin/date>>/tmp/date.log',
> enabled => TRUE
>);
>END;
>/
>
>The error that is thrown is "ORA-27369: job of type EXECUTABLE failed
>with exit code: No such file or directory".
>
>I have tried this without the existence of a date.log file and with the
>existence of a date.log file in the /tmp directory. Both commands fail
>with the same error (above).

Probably because Oracle is (quite rightly) taking the job_action column
literally, and looking for a file named '/usr/bin/date>>/tmp/date.log' to run -
which doesn't exist.

>> as append to file is a shell construct, whereas this is just running an
executable direct.

Consider the following which does work (had to adjust paths for my system as
date is in /bin on mine, not /usr/bin) - this runs it through a shell and adds
the rest as arguments:

BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name => 'test',
job_type => 'EXECUTABLE',
job_action => '/bin/sh',
number_of_arguments => 2
);

DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'test',
argument_position => 1,
argument_value => '-c'
);

DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
job_name => 'test',
argument_position => 2,
argument_value => '/bin/date>>/tmp/date.log'
);

DBMS_SCHEDULER.ENABLE('test');
END;
/

--
Andy Hassall :: andy@xxxxxxxxxxx :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
.



Relevant Pages

  • Re: xp_cmdshell default path (system32) problem
    ... purge all files from a given directory. ... that xp_cmdshell ALWAYS executes under the security context of defined ... I'm use xp_cmdShell to execute "erase" command like ... I haven't executed the actual erase statements yet but rather have been ...
    (microsoft.public.sqlserver.programming)
  • Re: Newbie question on C library system() function
    ... rest of my app executes. ... printer to see whether it completed a command yet. ... the characters to the printer, but the characters are getting buffered ... Most operating systems provide ways outside of C to wait gracefully; ...
    (comp.lang.c)
  • Re: Using os.system() and string concatenation
    ... > I think take those lists and provide them to an os.systemcall. ... > This executes without any errors, but doesn't execute the command ... > supply it to os.systemit executes just fine. ... a shell command out of data from files, ...
    (comp.lang.python)
  • Re: RH 9.0 log in question: seems a bit long
    ... No lag after I enter my password. ... in my username. ... When I type in command, it executes right away. ...
    (RedHat)
  • Re: Unable to filter records using a command button
    ... continuous view form which is not a subform on another form? ... > I created a command button on the form that executes a macro. ...
    (microsoft.public.access.forms)