Oracle-11g-R2

無法執行執行 shell 腳本的作業

  • May 17, 2017

我有以下pl/sql應該執行 shell 腳本的腳本script.sh。當我在 SQLDeveloper 中執行下面的程式碼時,我得到:

   Error report -
ORA-27370: job slave failed to launch a job of type EXECUTABLE
ORA-27300: OS system dependent operation:accessing login executable failed with status: 2
ORA-27301: OS failure message: No such file or directory
ORA-27302: failure occurred at: sjseccel 1
ORA-06512: at "SYS.DBMS_ISCHED", line 185
ORA-06512: at "SYS.DBMS_SCHEDULER", line 486
ORA-06512: at line 20
27370. 00000 -  "job slave failed to launch a job of type EXECUTABLE"
*Cause:    The scheduler ran into an error when the job slave tried to start
          a job of type EXECUTABLE. The rest of the error stack will provide
          more detailed information on what the exact problem was.
*Action:   Correct the problem specified in the error stack and reschedule
          the job.

該文件存在並且在我的系統上具有正確的權限。我做錯了什麼嗎?此外,提供的憑據似乎是正確的。

這是程式碼:

set serveroutput on;

BEGIN
   DBMS_SCHEDULER.create_credential(
       credential_name => 'user_cred',
       username        => 'user',
       password        => 'pass');  
END;   
/

begin
     DBMS_SCHEDULER.CREATE_JOB (
       job_name           => 'test_prog',
        job_type           => 'EXECUTABLE',
       job_action         => '/home/user/Desktop/foo/script.sh',
        enabled            => TRUE,
        credential_name => 'user_cred'
     );
   dbms_scheduler.run_job('test_prog');
end;
/

看起來外部調度程序作業在 XE 版中不可用。

引用自:https://dba.stackexchange.com/questions/173611