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

When i was trying to execute backup script from dbms_scheduler job, which 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;

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

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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s