Skip to Main Content
  • Questions
  • DBMS Scheduler executable external job getting failed

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, umair.

Asked: May 09, 2017 - 12:38 pm UTC

Last updated: September 02, 2021 - 2:04 am UTC

Version: 5.0.2

Viewed 10K+ times! This question is

You Asked

i have created dbms schedular executable external job to run shell script ,it is getting failed.
please find below

begin
dbms_scheduler.create_job
( job_name => 'change_ip_address',
job_type => 'EXECUTABLE',
job_action => '/home/dell/changeipaddress.sh',
start_date => sysdate,
enabled => TRUE,
auto_drop => TRUE,
comments => 'Changing ip address of system');
end;

shell script contains following

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
ORACLE_BASE=/u01/app/oracle
export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
export ORACLE_HOME
ORACLE_SID=XE
export ORACLE_SID
PATH=$ORACLE_HOME/bin:$PATH
export PATH
echo "12345" | sudo -S ifconfig eth0 192.168.1.101 netmask 255.255.255.0








ERROR# LOG_DATE STATUS ADDITIONAL_INFO

274666 09-MAY-17 05.15.48.715668 PM +05:30 FAILED ORA-27369: job of type EXECUTABLE failed with exit code: 274666 STANDARD_ERROR="Oracle Scheduler error: Cannot access or open configuration file."


and Chris said...

The 274666 exit code means Oracle Database "cannot access or open externaljob.ora file".

So you need to check that the file $ORACLE_HOME/rdbms/admin/externaljob.ora exists on the database server. And it's owned by root and have the permissions 644 set.

You can read more about configuring the scheduler for executables at:

https://community.oracle.com/thread/557102?tstart=0
http://docs.oracle.com/cd/B28359_01/server.111/b28310/schedover004.htm#BGBHJCHH
MOS note 979186.1

But: Running this job will change the IP of the database server! Why on earth are you doing that?! This sounds like a recipe for disaster to me...

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Fofana, September 01, 2021 - 5:10 pm UTC

Hi we are trying run shell_script under Oracle 11g XE and failed; turn out this file is just not there at all, where should be.
$ORACLE_HOME/rdbms/admin/externaljob.ora
Under oracle standard edition 11gR2 it's there.
My question before we waste time. Should we just copy it there from standard edition to XE? Will this work or is there other way to get shell_script run under XE?
Connor McDonald
September 02, 2021 - 2:04 am UTC

externaljob.ora is for backward compatibility. You don't need it. From 11g onwards you can use scheduler credentials,

dbms_scheduler.create_credential(
  credential_name => 'MY_OS_CREDS',
  username        => 'connor',
  password        => 'mysecret');


and then for a scheduler program, you nominate the credentials as an attribute

dbms_scheduler.set_attribute('MY_UNIX_PROGRAM', 'credential_name', 'MY_OS_CREDS');    

More to Explore

DBMS_SCHEDULER

More on PL/SQL routine DBMS_SCHEDULER here