Sunday, December 20, 2009

Scheduled Job Running Shell Script Fails With ORA-27369


Applies to:


Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 10.2.0.4
Oracle Server - Standard Edition - Version: 10.1.0.2 to 10.2.0.4
Sun Solaris SPARC (64-bit)
Linux x86
"ORA-27369: job of type EXECUTABLE failed with exit code: Unknown error" was still occurring for non oracle users running DBMS_SCHEDULER executed shell scripts. Problem was fixed when filesystem where ORACLE_HOME was mounted on was found to have been mounted w/ nosetuid. Changing mount option to setuid resolved problem




Symptoms


@Checked for relevance on 16-MAY-2008


A Scheduler job has been configured using the DBMS_SCHEDULER package. The job executes a shell script using the option job_type=>’EXECUTABLE’. The script performs a write operation to an output file, for example a redirect operation or touch. The write operation fails with:


ORA-27369: job of type EXECUTABLE failed with exit code: Operation not permitted


 Or


ORA-27369: job of type EXECUTABLE failed with exit code: 274662


Or


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




In dba_scheduler_job_run_details.additional_info, the following details are recorded:


ORA-27369: job of type EXECUTABLE failed with exit code: Operation not permitted
STANDARD_ERROR="touch: cannot touch `’: Permission denied"

Or

ORA-27369: job of type EXECUTABLE failed with exit code: 274662
STANDARD_ERROR="Oracle Scheduler error: Config file is not owned by root or is
writable by group or other or extjob is not setuid and owned by root"



Cause

If $ORACLE_HOME/rdbms/admin/externaljob.ora exists then external jobs run as the user and group specified in this file, which by default is a lowly privileged user (nobody).
The user ‘nobody’ and the group ‘nobody’ do not have the proper privileges for write operations.
As a result, the message ‘Permission denied’ is returned when attempting to write to files.
Solution


Root access is required for the steps below.


1. Ensure the configuration file $ORACLE_HOME/rdbms/admin/externaljob.ora is owned by root:


# cd $ORACLE_HOME/rdbms/admin/
# chown root externaljob.ora


2. Ensure the file permissions are correctly set for $ORACLE_HOME/rdbms/admin/externaljob.ora.
Remove write privileges from group and other.
# chmod 640 externaljob.ora
# ls -la externaljob.ora
-rw-r—– 1 root oinstall 1537 Sep 13 09:24 externaljob.ora


3. Edit $ORACLE_HOME/rdbms/admin/externaljob.ora and set run_user to the OS account that owns the Oracle installation and the database and run_group to the OS group that owns the Oracle_Home.


Example:
OS account: oracle
OS group: oinstall
run_user = oracle
run_group = oinstall
 4. Ensure the setuid bit is set on the $ORACLE_HOME/bin/extjob executable.  Also make sure the filesystem is mounted with setuid option.
# cd $ORACLE_HOME/bin
# chmod 4750 extjob
# ls -la extjob
-rwsr-x— 1 root oinstall 64988 Mar 29 18:22 extjob

No comments: