Google it ....

Showing posts with label DBMS_SCHEDULER. Show all posts
Showing posts with label DBMS_SCHEDULER. Show all posts

Wednesday, January 21, 2015

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

When I was trying to execute backup script from dbms_scheduler job, appears next error:
ORA-27369: job of type EXECUTABLE failed with exit code: 255
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 2
job looks like
begin
  sys.dbms_scheduler.create_job(job_name            => 'BACKUP_DB',
                                job_type            => 'EXECUTABLE',
                                job_action          => '/fra/backup_script/backup_full_disk.sh',
                                schedule_name       => 'BACKUP_DATABASE',
                                enabled             => true,
                                auto_drop           => false,
                                comments            => '');
end;

schedule is next
begin
  sys.dbms_scheduler.create_schedule(
schedule_name   => 'BACKUP_DATABASE',
start_date      => SYSDATE,
repeat_interval =>'Freq=Daily;
Interval=1;ByHour=09;ByMinute=00;
BySecond=00',
end_date        => to_date(null),
comments        => '');
end;

manual execution script:
begin
dbms_scheduler.run_job('BACKUP_DB');
end;

solution is very simple:
The script I was trying to execute was missing the
#!/bin/sh

as the first line of the script. This lets the exec function being called internally by the scheduler know that the script is a script, and not a binary executable. While this isn't required to run a script from the command line, it is required to run it through the DBMS_SCHEDULER function on a Linux system.

So I added #!/bin/sh in my executable script at the first line and it worked.