0

I have a Linux Oracle Server. The database is generating CSV files with a custom stored procedure, now at the end of this procedure. I want to execute a bash/shell script in linux to push this files to Amazon S3 Bucket.

I am getting errors trying to schedule the process in oracle:

EXTERNAL_LOG_ID="job_2369137_852690", ORA-27369: job of type EXECUTABLE failed with exit code: Argument list too long

Using DBM_SCHEDULER to create a JOB type Sript, External

#!/bin/bash
echo hello world

DBMS_SCHEDULER.CREATE_JOB (
job_name => '"ODSMGR"."TEST_JOB"',
job_type => 'EXTERNAL_SCRIPT',
job_action => '#!/bin/bash
echo hello world',
number_of_arguments => 0,
start_date => NULL,
repeat_interval => NULL,
end_date => NULL,
enabled => FALSE,
auto_drop => FALSE,
comments => '');
1
  • Now i am getting this error: ORA-27369: job of type EXECUTABLE failed with exit code: 7 Commented Jan 15, 2019 at 20:10

1 Answer 1

1

The DBMS_SCHEDULER.CREATE_JOB you are using has incorrect arguments. You should preferably follow these standard steps for running a program.

First create a program with appropriate name and define what to run. In the below example I'm running a bash command directly, You may put them into a separate shell script with relevant permissions and add its name under program_action

BEGIN
DBMS_SCHEDULER.CREATE_PROGRAM (
 program_name=> 'COPY_PROGRAM',
 program_type=> 'EXECUTABLE',
 program_action  => '/bin/bash -c "echo hello world"',
 enabled=> TRUE,
 comments=> 'Push files to Amazon S3 Bucket.'
);
END;
/

Then, create the job using that program.

BEGIN
DBMS_SCHEDULER.CREATE_JOB (
   job_name     => 'TEST_JOB',
   program_name => 'COPY_PROGRAM',
   start_date => NULL,
   repeat_interval => NULL,
   end_date => NULL,
   enabled => FALSE,
   auto_drop => FALSE,
   comments => '');
END;
/

Refer this link for more details.

Sign up to request clarification or add additional context in comments.

4 Comments

Hi and thanks for your answer. I did the same as your example and I am getting this error code: "ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory "
What about the credentials? This is a linux server in the Amazon cloud and we are not using password, Do I need to send login credentials?
@JorgeFlores :Check your bash path, it should be somewhere else ( not in /bin/bash) . Regarding your question about Amazon cloud, I'm not sure and that's beyond the scope of this question. You should consider asking a new one.
Thanks for your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.