我在 Oracle 11 上添加 shell 脚本作为计划作业时遇到问题,无论是否添加凭据。
没有证书我得到
ORA-27369: job of type EXECUTABLE failed with exit code: 274662
ORA-06512: at "SYS.DBMS_ISCHED", line 154
ORA-06512: at "SYS.DBMS_SCHEDULER", line 450
ORA-06512: at line 17
27369. 00000 - "job of type EXECUTABLE failed with exit code: %s"
*Cause: A problem was encountered while running a job of type EXECUTABLE.
The cause of the actual problem is identified by the exit code.
*Action: Correct the cause of the exit code and reschedule the job.
此错误显然与 externaljob.ora 文件不属于 root 或组可写有关。这两者都不是。
使用我得到的凭据
Error report:
No more data to read from socket
这不是很有帮助。我在 Linux 上运行的 Oracle 版本是 11.1.0.6.0。我正在使用的示例脚本如下。我注释掉凭据以尝试该版本,凭据只是沼泽标准用户名和密码。
declare
namea varchar2(1000) := 'unix_command_job2';
BEGIN
DBMS_SCHEDULER.drop_job(namea, force=>true);
-- UNIX
DBMS_SCHEDULER.create_job(
job_name => namea,
job_type => 'EXECUTABLE',
number_of_arguments => 1,
job_action => '/bin/ls',
auto_drop => FALSE,
enabled => FALSE);
DBMS_SCHEDULER.set_job_argument_value(namea,1,'/tmp');
--DBMS_SCHEDULER.set_attribute(namea, 'credential_name', 'DCSCRED');
DBMS_SCHEDULER.run_job(namea);
DBMS_SCHEDULER.drop_job(namea);
END;
/