13 Respuestas Respuesta más reciente: 23/09/2011 12:28 PM por Rnr-Oracle RSS

    ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di

    629628
      I am receiving the error "ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory" when trying to run a job.

      begin

      DBMS_SCHEDULER.CREATE_JOB (
      job_name => 'BrianTest',
      job_type => 'EXECUTABLE',
      job_action => '/usr/bin/ksh /u01/appfiles/billdev/bhjob.ksh',
      repeat_interval => 'FREQ=YEARLY',
      enabled => TRUE
      );

      dbms_scheduler.run_job('BrianTest');

      end;

      Results:
      ORA-27369: job of type EXECUTABLE failed with exit code: No such file or directory
      ORA-06512: at "SYS.DBMS_ISCHED", line 185
      ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
      ORA-06512: at line 12


      My executable (/u01/appfiles/billdev/bhjob.ksh) is very basic.
      /bin/echo BHTEST >> /u01/appfiles/billdev/bh.txt
        • 1. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
          56219
          What Oracle DB version do you have? Does bhjob.ksh execute successfully from the command line when you manually run it? What OS username do you use to execute bhjob.ksh?
          In any case this thread Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files should help you.
          • 2. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
            629628
            We are on Oracle 11.2.02
            Using a Linux server
            I can run the bhjob.ksh successfully
            When running manually, I use the user billdev to sign on to the OS. I am not sure what user would is being used when running from Oracle. How do I determine that?

            Thanks
            • 3. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
              Rnr-Oracle
              Hi Brian,

              When the job type is executable, the job action is supposed to point to an executable without any arguments. So what is happening here is that the scheudler is looking for the file called "/usr/bin/ksh /u01/appfiles/billdev/bhjob.ksh" and not finding it.

              Instead you should set the job action to just "/usr/bin/ksh", set number_of_arguments to 1, enabled to FALSE, then call set_job_argument_value with "/u01/appfiles/billdev/bhjob.ksh" then enable the job.

              Hope this helps,
              Ravi.
              • 4. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                629628
                Ideally, I would like to just call '/u01/appfiles/billdev/bhjob.ksh' like below. However, when doing so, I receive the error ORA-27369: job of type EXECUTABLE failed with exit code: Permission denied.

                What is causing this? Is this a config issue?

                DBMS_SCHEDULER.CREATE_JOB (
                job_name => 'BrianTest',
                job_type => 'EXECUTABLE',
                job_action => '/u01/appfiles/billdev/bhjob.ksh',
                repeat_interval => 'FREQ=YEARLY',
                enabled => FALSE
                );

                When running with the job_action set to '/usr/bin/ksh' and the argument of '/u01/appfiles/billdev/bhjob.ksh'. I receive the error ORA-27369: job of type EXECUTABLE failed with exit code: Required key not available

                I can successfully run when setting the job_action to '/bin/echo' and no arguments.
                • 5. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                  Rnr-Oracle
                  Hi,

                  Please check the following,

                  - the user you are running as has read and execute permissions on the script i.e. the script is +rx .

                  - The script has a line at the beginning that looks like
                  #!/bin/ksh .

                  - to determine the user you are using see the guide here. If you are running on 11.1 or higher, you should be using a credential to specify which user to use
                  Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

                  - for the second issue you should check the error messages in dba_scheduler_job_run_details

                  Hope this helps,
                  Ravi.
                  • 6. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                    629628
                    Two steps forward two steps back :-)

                    I was unable to include #!/bin/ksh . When doing so, I couldn't manually run the script. Is ther an equivelant in LINUX?

                    The file is setup rwx across the board.

                    I setup the credentials and then was able to run an echo command in LINUX Script that I created. However, when I tied to move a file, I get the following error ORA-27369: job of type EXECUTABLE failed with exit code: Operation not permitted. See scripts below.

                    Linux Script with echo command:
                    . /u01/appfiles/billdev/.bash_profile
                    /bin/echo Rabbit

                    Linux Script with Move command:
                    . /u01/appfiles/billdev/.bash_profile
                    /bin/mv bh.txt bh.bh

                    Edited by: Brian H on Apr 27, 2011 4:00 PM
                    • 7. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                      629628
                      The issue above was that I was not fully qualifying the file names.

                      Changed to this and it worked.

                      /bin/mv /u01/appfiles/billdev/bh.txt /u01/appfiles/billdev/bh.bh


                      Hopefully, I am on my way.
                      • 8. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                        Rnr-Oracle
                        Hi,

                        If your script does not have the initial line that starts with #! then you must include the interpreter (in this case /bin/ksh) when you create a scheduler job to run the script (otherwise you can just point to the script directly). I'm not sure why including the #! line causes an error when manually running the script, since this is a unix standard.

                        For the other errors, viewing the additional_info column of dba_scheduler_job_run_details may be useful. As you have already found you must include full paths to executables and files (the job starts with no environment variables set).

                        Thanks,
                        Ravi.
                        • 9. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                          629628
                          Thanks Ravi and Eddie. You were very helpful.

                          The main issues I had were:
                          1. I was not specifying a credential name to run the script.
                          2. You must fully qualify all commands, filename, etc. in your LINUX scripts. i.e. for echo, you must use /bin/echo, for files, you must specify the directory, etc.

                          We are using Oracle 11.2.0.2 on Linux

                          ----------------------------------------------------------------------------------------------------------------------
                          --
                          -- Run this once
                          --
                          -- dbms_scheduler.create_credential(credential_name => 'brian', username => 'brian', password => 'pass');
                          --
                          ----------------------------------------------------------------------------------------------------------------------
                          Declare
                          n_jobexists number := 1;
                          begin

                          DBMS_SCHEDULER.CREATE_JOB (
                          job_name => 'BrianTst',
                          job_type => 'EXECUTABLE',
                          job_action => '/u01/appfiles/brian/test.ksh',
                          repeat_interval => 'FREQ=YEARLY',
                          credential_name => 'brian',
                          enabled => FALSE,
                          number_of_arguments => 2
                          );
                          dbms_scheduler.set_job_argument_value(job_name => 'BrianTst',
                          argument_position => 1,
                          argument_value => '000947652_20110428120045.dat');

                          dbms_scheduler.set_job_argument_value(job_name => 'BrianTst',
                          argument_position => 2,
                          argument_value => '947652');

                          dbms_scheduler.enable(name => 'BrianTst');

                          begin
                          dbms_scheduler.drop_job('BrianTst');
                          exception
                          When Others then
                          n_jobexists := 0;
                          end;

                          end;
                          /
                          • 10. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                            890181
                            Hi,

                            The last example you gave, I could not understand what command will it actually fire at the unix command line
                            Where from I am coming is even after much effort and lot of googling I am not being able to achieve this

                            Execute a shell script with argument from the dbms scheduler

                            My target is to run the below command from dbms_scheduler which runs perfectly fromU UNIX

                            sattam:>/sattam/rnd/tst.sh /sattam/rnd

                            The shell tst.sh is as below

                            ##### beginning of shell script #####
                            #!/usr/bin/ksh
                            scriptloc=$1

                            /usr/bin/rm $scriptloc/tst.log
                            echo "do not delete this file!!!" >> $scriptloc/tst.log
                            /usr/bin/chmod 777 $scriptloc/tst.sh

                            ##### end of shell script #####



                            The file tst.sh is owned by OS user sattam and having 777 permission (so is the entire path /sattam/rnd)

                            sattam:>ls -ltr tst.sh
                            -rwxrwxrwx 1 sattam dba 325 Sep 23 17:43 tst.sh


                            Below is what I am doing in sys I have a procedure

                            CREATE OR REPLACE PROCEDURE PR_EXEC_OS_COMMAND(P_OS_COMMAND IN VARCHAR2) IS
                            BEGIN

                            DBMS_SCHEDULER.CREATE_JOB (job_name => 'RUN_OS_COMMAND',
                            schedule_name => '"SYS"."DAILY_PURGE_SCHEDULE"',
                            job_type => 'EXECUTABLE',
                            job_action => P_OS_COMMAND,
                            number_of_arguments => 0,
                            job_class => 'DEFAULT_JOB_CLASS',
                            enabled => true,
                            auto_drop => TRUE,
                            comments => NULL);

                            DBMS_SCHEDULER.RUN_JOB (job_name => 'RUN_OS_COMMAND');
                            DBMS_SCHEDULER.DROP_JOB (job_name => 'RUN_OS_COMMAND');

                            END;

                            BEGIN
                            pkg_sat_util.PR_EXEC_OS_COMMAND('sattam/rnd/tst.sh /sattam/rnd');
                            END;

                            and getting an error


                            ORA-27369: job of type EXECUTABLE Failed with exit code: No such File or directory
                            ORA-06512: at "SYS.DBMS_ISCHED, line 150
                            ORA-06512: at "SYS.DBMS_5CHEDULER, line 441
                            ORA-06512: at line 2
                            View program sources of error stack?

                            Can anybody suggest Where am I going wrong?
                            I am using Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
                            Connected as SYS
                            • 11. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                              Rnr-Oracle
                              Hi,

                              Your job is looking for a single executable file called 'sattam/rnd/tst.sh /sattam/rnd' which does not exist.

                              Instead set job_action to 'sattam/rnd/tst.sh' and set number_of_arguments=>1 and set enabled=>false

                              then call set_job_argument_value to set the first argument to '/sattam/rnd' and finally enable the job.

                              There are lots of examples of using set_job_argument_value to set argument values for a job which is what you want to do here.

                              Hope this helps,
                              Ravi.
                              • 12. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                                Rnr-Oracle
                                Hi,

                                Your job is looking for a single executable file called 'sattam/rnd/tst.sh /sattam/rnd' which does not exist.

                                Instead set job_action to 'sattam/rnd/tst.sh' and set number_of_arguments=>1 and set enabled=>false

                                then call set_job_argument_value to set the first argument to '/sattam/rnd' and finally enable the job.

                                There are lots of examples of using set_job_argument_value to set argument values for a job which is what you want to do here.

                                Hope this helps,
                                Ravi.
                                • 13. Re: ORA-27369: job of type EXECUTABLE failed with exit code: No such file or di
                                  Rnr-Oracle
                                  Hi,

                                  Your job is looking for a single executable file called 'sattam/rnd/tst.sh /sattam/rnd' which does not exist.

                                  Instead set job_action to 'sattam/rnd/tst.sh' and set number_of_arguments=>1 and set enabled=>false

                                  then call set_job_argument_value to set the first argument to '/sattam/rnd' and finally enable the job.

                                  There are lots of examples of using set_job_argument_value to set argument values for a job which is what you want to do here.

                                  Hope this helps,
                                  Ravi.