Using Dbms_scheduler Package For Running Executables On Unix Fails With ORA-27369

(Doc ID 300552.1)

Last updated on FEBRUARY 15, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 10.1.0.3 to 11.2.0.3 [Release 10.1 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 15-Feb-2017***


Symptoms

To reproduce the problem, here are the steps:

A- Create a shell script file named test.sh under the /tmp folder with the following contents:

$ cat /tmp/test.sh
ls >> /tmp/test.log



B- Grant the rwx privileges for the owner, the group and others for this file like the following:

$ chmod 777 test.sh



C- Create the job using the DBMS_SCHEDULER package like the following:

SQL> BEGIN
DBMS_SCHEDULER.CREATE_JOB(
job_name=>'test1',
job_type=>'EXECUTABLE',
job_action=>'/tmp/test.sh',
enabled=>true,
auto_drop=>false);
END ;
/



The job will fail with error code ORA 27369 with exit code Unknown Error.


Tests performed with the exact same steps used by the customer:

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

$ vi /tmp/test.sh
ls >> /tmp/test.log

 

SQL> connect system/manager
Connected.
SQL> BEGIN DBMS_SCHEDULER.CREATE_JOB
2 ( job_name=>'test1',
3 job_type=>'EXECUTABLE',
4 job_action=>'/tmp/test.sh',
5 enabled=>true,
6 auto_drop=>true);
7 END ;
8 /
PL/SQL procedure successfully completed.

SQL> select log_id, log_date, job_name, status, error#, additional_info
2 from dba_scheduler_job_run_details
3 where job_name like 'TEST%';

    LOG_ID
----------
LOG_DATE
---------------------------------------------------------------------------
JOB_NAME                       STATUS                             ERROR#
------------------------------ ------------------------------ ----------
ADDITIONAL_INFO
--------------------------------------------------------------------------------
      1070
03-MAR-05 11.13.46.011861 AM -07:00
TEST1                          FAILED                              27369
ORA-27369: job of type EXECUTABLE failed with exit code: 255



Also, simply running the job fails with the same error shown on the SQL command prompt:

SQL> exec DBMS_SCHEDULER.run_JOB(job_name=>'test1')
BEGIN DBMS_SCHEDULER.run_JOB(job_name=>'test1'); END;

*
ERROR at line 1:
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 1

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms