1 2 3 4 5 Previous Next 70 Replies Latest reply: May 28, 2013 5:48 AM by VinodrajJayaraman Go to original post RSS
      • 30. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
        614085
        This is the part that messed me up on Solaris. Have you done this? Also, be aware that the Unix shell environment variables are not fully populated with the Oracle 10g Scheduler, but you can get around that by writing a generic script.

        -------------------------

        To configure externaljob.ora (which determines which Unix account the Oracle Scheduler will run as—the default is “nobody,” and most scripts will fail with that setting)—if this database resides on a SunCluster, these changes will need to be made on both nodes of the cluster:

        1. Log onto the server with the oracle account

        2. Display a directory of externaljob.ora

        cd $ORACLE_HOME/rdbms/admin

        ls -l externaljob.ora


        -rw-r----- 1 root dba 1531 Dec 13 11:06 externaljob.ora


        3. Use the root account to edit externaljob.ora

        a. Update run_user from nobody to oracle
        b. Update run_group from nobody to dba
        c. Save and exit the file

        4. Use the oracle account to display the contents of the updated externaljob.ora file

        cd $ORACLE_HOME/rdbms/admin

        cat externaljob.ora


        # $Header: externaljob.ora 16-dec-2005.20:47:13 rramkiss Exp $
        #
        # Copyright (c) 2005, Oracle. All rights reserved.
        # NAME
        # externaljob.ora
        # FUNCTION
        # This configuration file is used by dbms_scheduler when executing external
        # (operating system) jobs. It contains the user and group to run external
        # jobs as. It must only be writable by the owner and must be owned by root.
        # If extjob is not setuid then the only allowable run_user
        # is the user Oracle runs as and the only allowable run_group is the group
        # Oracle runs as.
        #
        # NOTES
        # For Porters: The user and group specified here should be a lowly privileged
        # user and group for your platform. For Linux this is nobody
        # and nobody.
        # MODIFIED
        # rramkiss 12/09/05 - Creation
        #
        ##############################################################################
        # External job execution configuration file externaljob.ora
        #
        # This file is provided by Oracle Corporation to help you customize
        # your RDBMS installation for your site. Important system parameters
        # are discussed, and default settings given.
        #
        # This configuration file is used by dbms_scheduler when executing external
        # (operating system) jobs. It contains the user and group to run external
        # jobs as. It must only be writable by the owner and must be owned by root.
        # If extjob is not setuid then the only allowable run_user
        # is the user Oracle runs as and the only allowable run_group is the group
        # Oracle runs as.

        run_user = oracle
        run_group = dba
        • 31. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
          662719
          Ravi/Any one,

          could some body help below error.

          I am trying to run the .bat script in the 10g scheduler in windows and giving 'c:\windows\system32\cmd.exe /c f:\xxxx\yyyy\test.bat' path. it giving errors below errors.

          ORA-27370: job slave failed to launch a job of type EXECUTABLE ORA-27300: OS system dependent operation:getting external job pid failed with status: 2 ORA-27301: OS failure message: No such file or directory ORA-27302: failure occurred at: sjsec 6a


          Thanks,
          Srini
          • 32. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
            614085
            Did you run the following commands to verify that the files are located where you expect them to be?

            dir c:\windows\system32\cmd.exe
            dir f:\xxxx\yyyy\test.bat

            If F: is a network drive, it may be possible that Windows will not see that drive during the launch of the job. (We had that problem when working with other schedulers. If the script is on a network drive, move it to a local drive, update the job, and see if it can run from a local directory.
            • 33. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
              Rnr-Oracle
              Hi,

              Can you post the code you are using to create the job? If you are passing in the entire string as the job/program action, this error may be thrown. You need to use just the c:\windows\system32\cmd.exe as the action and the other pieces as argument values.

              Also have you checked that the Oracle Scheduler service is enabled and running ?

              Hope this helps,
              Ravi.
              • 34. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                orsteve
                Thank you Ravi for your help to the community. I am having trouble running a simple sqlplus script (UNIX) from the scheduler (Oracle 10.2.0.3 on Solaris). I would like to understand better how the whole thing works...

                1) Create a job as a user (who has the create job, create external job permissions - but isn't necessarily the user in externaljob.ora). Since I am setting up a GUI front end using Application Express, I am guessing that the user creating the job is the schema owner for the workspace.

                2) If it is an "immediate" run, the scheduler goes to the location identified for the script (shell script in my case which does specifically set the environment variables ORACLE_HOME, ORACLE_SID, LD_LIBRARY_PATH) and tries to run it. What user does it do this as? The schema and job owner does not have an OS userid...

                3) The script includes a direct call to sqlplus ($ORACLE_HOME/bin/sqlplus << EOF etc...) - does the scheduler try to get into sqlplus as the schema/job owner?

                If I see a 0 on the returned error and there is "SUCCESS" - but no spooled file or proof that the sql code ran, what was successful?

                If I see "ORA-27369: job of type EXECUTABLE failed with exit code: Not owner" - does this refer to the directory where I want to create the spool file? (or what?)

                I have read and re-read your how-to and a lot of the forum entries - and have set the permissions/ownerships accordingly - without success.

                What exactly does Oracle do with nobody:nobody? Use that as the OS user? What happens if the user isn't an OS user?

                I tried with nobody:nobody in externaljob.ora but that didn't work. (there is not an OS user called nobody so I'm not sure how it could).
                I tried with oracle:dba and was able to get a successful run (but, as mentioned, I'm not sure what was successful since there isn't a .lst file that I can find).


                Thanks,
                Steve
                • 35. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                  orsteve
                  A little more information...

                  I was able to get it to run if I put in the username/password between the sqlplus and the << EOF

                  I don't want to do that - it puts username and password in clear text.

                  Steve
                  • 36. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                    614085
                    Steve,

                    The Oracle 10g Scheduler is pretty brain dead in terms of security. 11g fixes a lot of that.

                    In 10g, every external job runs under the same account, the one specified in $ORACLE_HOME/rdbms/admin/externaljob.ora . If you want your job to work, I recommend using:

                    run_user = oracle
                    run_group = dba

                    Be aware that Solaris, at least at our site, does not have some of the standard environment variables defined when the Oracle job starts executing the script. We had to "go around the barn" to populate them. For example, we wrote a generic Korn script (named dbms_scheduler_shell.ksh below) to populate the missing variables and then call the real script that we wanted to run. Our dbms_scheduler_shell.ksh script also translates our goobledygook server names into something readable--your code will not likely need to do that. Following that is the SQL that we used to define the DBMS_SCHEDULER job. If you want a log file, you have to handle the redirection yourself in 10g. 11g handles that. Please see the "argument_value" in the SQL below for an example of the redirection that we use.

                    By the way, the only way I know to avoid hardcoding a password is to connect to the database with:

                    sqlplus / as sysdba

                    I highly recommend executing the following in your shell script for debugging purposes. You will likely be amazed at what is missing, at least on Solaris.

                    env | sort

                    Hope this helps. I spent WEEKS on getting this to work at our site for the first time.

                    Jonathan

                    ------------------------------------------------------------------------

                    #!/usr/bin/ksh

                    set +x # Make sure that command echo is turned off (to clean up output)

                    # ****************************************************************
                    # *
                    # * Script name: dbms_scheduler_shell.ksh
                    # *
                    # * Description: Shell script wrapper used to populate the
                    # * missing shell environment variables for a
                    # * script running under Oracle Scheduler
                    # *
                    # * Syntax: dbms_scheduler_shell.ksh p1 [p2|http://forums.oracle.com/forums/] [p3|http://forums.oracle.com/forums/] [p4|http://forums.oracle.com/forums/] [p5|http://forums.oracle.com/forums/] [p6|http://forums.oracle.com/forums/] [p7|http://forums.oracle.com/forums/] [p8|http://forums.oracle.com/forums/]
                    # *
                    # * p1 = Required Target shell
                    # * script file specification
                    # * (for example,
                    # * /usr/oracle/scripts/rman_backup.ksh)
                    # *
                    # * p2-p8 = Optional Parameters to
                    # * be passed to the target shell script
                    # *
                    # * OS Version: Solaris 10
                    # *
                    # * Database Ver.: Oracle 10.2.0.3
                    # *
                    # * Edit History:
                    # *
                    # * 01/09/2008--JPS--Created command file
                    # *
                    # **********************************************+*****************

                    date +"%n%D %T %A%n"

                    ScriptName=$(basename $0) # Equivalent shorthand code is: ${0##*/}
                    ScriptPath=$0 # $0 gets set by the preceeding $(basename $0) syntax

                    # echo "\n****************************************************************"
                    # echo "*"
                    # echo "* Translate hostname into a more readable format--this code needs"
                    # echo "* to execute *after* the call to the .profile shell script and"
                    # echo "* the alternate environment configuration shell script so that"
                    # echo "* \$DBA_SCRIPTS will be defined properly"
                    # echo "*"
                    # echo "******************************************+*********************"
                    #
                    # date +"%n%D %T %A%n"

                    export Translated_Host_NME=$(hostname)
                    # echo Translated_Host_NME=$Translated_Host_NME

                    TranslateScript_NME=/usr/oracle/scripts/translate_hostname_to_readable_name.ksh

                    if [-a $TranslateScript_NME |http://forums.oracle.com/forums/]# This syntax is similar to NT DOS "if exist"
                    then
                    . $TranslateScript_NME
                    else
                    echo " WARNING:"
                    echo "\n $TranslateScript_NME"
                    echo " does not exist; hostname cannot be translated into a more"
                    echo " readable format\n"
                    fi

                    set +x # Turn off command echo
                    if
                    then
                    set -x # Turn on command echo if the bdebug variable is defined and exported
                    fi

                    # echo Translated_Host_NME=$Translated_Host_NME

                    echo "Starting the execution of:"
                    echo "\n $Translated_Host_NME:$ScriptPath" # Display a message that indicates the script's file specification
                    echo "\nwhich will call:"
                    echo "\n $1" # Display a message that indicates the script's file specification

                    echo "\n****************************************************************"
                    echo "*"
                    echo "* Set missing shell environment variables for dbms_scheduler jobs"
                    echo "*"
                    echo "******************************************+*********************"

                    date +"%n%D %T %A%n"

                    id | read input_line

                    USERNAME=`echo $input_line | cut -d"(" -f2 | cut -d")" -f1`

                    grep "$USERNAME:" /etc/passwd | read input_line

                    if [
                    then
                    export USER=`echo $input_line | cut -d: -f1`
                    echo "Missing USER environment variable is now set to: $USER"
                    fi

                    if [
                    then
                    export LOGNAME=$USER
                    echo "Missing LOGNAME environment variable is now set to: $LOGNAME"
                    fi

                    if [
                    then
                    export HOME=`echo $input_line | cut -d: -f6`
                    echo "Missing HOME environment variable is now set to: $HOME"
                    fi

                    if [
                    then
                    export PATH=/usr/bin:/usr/local/bin:/usr/ccs/bin:/usr/local/sbin
                    echo "Missing PATH environment variable is now set to: $PATH"
                    fi

                    export ORACLE_DBMS_SCHEDULER_JOB=Y

                    echo "\n****************************************************************"
                    echo "*"
                    echo "* Set the default directory"
                    echo "*"
                    echo "******************************************+*********************"

                    date +"%n%D %T %A%n"

                    echo "Setting the default directory to: $HOME"

                    cd $HOME

                    # The following section is commented out because scripts executed under cron have
                    # to call $HOME/.profile manually too; this allows a given script to run under
                    # cron and dbms_scheduler without any code changes

                    # echo "\n****************************************************************"
                    # echo "*"
                    # echo "* Source \$HOME/.profile"
                    # echo "*"
                    # echo "******************************************+*********************"
                    #
                    # date +"%n%D %T %A%n"
                    #
                    # . $HOME/.profile
                    #
                    echo "\n****************************************************************"
                    echo "*"
                    echo "* Display debug information"
                    echo "*"
                    echo "******************************************+*********************"

                    date +"%n%D %T %A%n"

                    echo "Output from id command:"
                    echo "\n $(id)"

                    echo "\nFile mode creation mask (umask):"
                    echo "\n $(umask)"
                    echo "\n $(umask -S)"

                    echo "\nShell information:\n"
                    echo " SHELL=$SHELL"

                    echo "\nParemeters passed to this script:\n"

                    echo " Parameter 1=$1"
                    echo " Parameter 2=$2"
                    echo " Parameter 3=$3"
                    echo " Parameter 4=$4"
                    echo " Parameter 5=$5"
                    echo " Parameter 6=$6"
                    echo " Parameter 7=$7"
                    echo " Parameter 8=$8"

                    echo "\nEnvironment variables:\n"

                    env | sort

                    # echo "\n****************************************************************"
                    # echo "*"
                    # echo "* Display Oracle Scheduler (dbms_scheduler) information"
                    # echo "*"
                    # echo "******************************************+*********************"
                    #
                    # date +"%n%D %T %A%n"
                    #
                    # export ORACLE_SID=drtest
                    # echo ORACLE_SID=$ORACLE_SID
                    #
                    # export ORACLE_HOME=/u01/app/oracle/product/10g
                    # echo ORACLE_HOME=$ORACLE_HOME
                    #
                    # /u01/app/oracle/product/10g/bin/sqlplus / as sysdba &lt;&lt; EOF
                    #select name as DB_NAME from v\$database;
                    #
                    #exit;
                    #EOF
                    #
                    # unset ORACLE_SID
                    # echo ORACLE_SID=$ORACLE_SID
                    #
                    # unset ORACLE_HOME
                    # echo ORACLE_HOME=$ORACLE_HOME

                    echo "\n****************************************************************"
                    echo "*"
                    echo "* Call the target script: $1"
                    echo "*"
                    echo "* Due to the way Unix works, when a parent shell script (i.e.,"
                    echo "* this shell script) calls a child shell script (i.e., the target"
                    echo "* script that the Oracle Scheduler will be running), the target"
                    echo "* script reports the name of the parent script by default when"
                    echo "* evaluating:"
                    echo "*"
                    echo "* ScriptName=\$(basename \$0)"
                    echo "*"
                    echo "* This script places the name of the target script into the"
                    echo "* TargetScriptSpec_NME shell variable so that the target script"
                    echo "* can use it for reporting job failures"
                    echo "*"
                    echo "******************************************+*********************"

                    date +"%n%D %T %A%n"

                    export TargetScriptSpec_NME=$1

                    set -x
                    . $TargetScriptSpec_NME $2 $3 $4 $5 $6 $7 $8






                    -- We then define a job as such (this is crude, but effective; I am looking forward to 11g to get rid of this!); also, please see argument_value in the SQL below:


                    -- set echo on

                    --******************************************************************************
                    --
                    -- Script Name: define_show_info--every_5_minutes.sql
                    --
                    -- Description: Schedule a job to display shell environment information; see
                    -- [http://www.dbforums.com/archive/index.php/t-1311101.html]
                    -- for additional information; this job can be used to verify
                    -- that the Oracle Scheduler is workingn properly
                    --
                    -- Syntax: @define_show_info--every_5_minutes.sql
                    --
                    -- Oracle Version: 10.2.0.3
                    --
                    -- Edit History:
                    --
                    -- 12/19/07--JPS--Created script
                    --
                    --******************************************************+***********************

                    -- Drop the job so that it can be redefined

                    begin
                    dbms_scheduler.drop_job('JPS_SHOW_INFO_EVERY_5_MIN');
                    end;
                    /

                    --******************************************************************************
                    --
                    -- Scheduled run
                    --
                    -- To add day, hour, minute, or second to sysdate, specify any of the
                    -- following:
                    --
                    -- Date
                    -- Part Value
                    -------

                    -----
                    -- Day 1
                    -- Hour 1/24
                    -- Minute 1/1440
                    -- Second 1/86400
                    --
                    --******************************************************+***********************

                    begin
                    dbms_scheduler.create_job(
                    job_name =&gt; 'JPS_SHOW_INFO_EVERY_5_MIN',
                    job_type =&gt; 'EXECUTABLE',
                    repeat_interval =&gt; 'freq=hourly; byminute=0,5,10,15,20,25,30,35,40,45,50,55; bysecond=0',
                    job_action =&gt; '/usr/bin/ksh',
                    number_of_arguments =&gt; 2,
                    job_class =&gt; 'DEFAULT_JOB_CLASS',
                    enabled =&gt; FALSE,
                    auto_drop =&gt; FALSE,
                    comments =&gt; 'Display shell information'
                    );

                    dbms_scheduler.set_job_argument_value (
                    job_name =&gt; 'JPS_SHOW_INFO_EVERY_5_MIN',
                    argument_position =&gt; 1,
                    argument_value =&gt; '-c'
                    );

                    dbms_scheduler.set_job_argument_value (
                    job_name =&gt; 'JPS_SHOW_INFO_EVERY_5_MIN',
                    argument_position =&gt; 2,
                    argument_value =&gt; './usr/oracle/scripts/dbms_scheduler_shell.ksh /usr/oracle/scripts/show_info.ksh&gt;/s01/oracle_scheduler_logs/show_info--every_5_minutes.log 2&gt;' || chr(38) || '1'
                    );

                    dbms_scheduler.set_attribute (
                    name =&gt; '"JSHEWBRIDGE"."JPS_SHOW_INFO_EVERY_5_MIN"',
                    attribute =&gt; 'logging_level',
                    value =&gt; DBMS_SCHEDULER.LOGGING_FULL
                    );

                    dbms_scheduler.enable('JPS_SHOW_INFO_EVERY_5_MIN');
                    end;
                    /

                    begin
                    dbms_scheduler.set_attribute (
                    name =&gt; 'JPS_SHOW_INFO_EVERY_5_MIN',
                    attribute =&gt; 'start_date',
                    value =&gt; to_date('10:30', 'hh24:mi')
                    );
                    end;
                    /

                    ### End of Script ###

                    Edited by: shew01 on Nov 19, 2008 3:34 PM
                    • 37. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                      orsteve
                      Jonathan,

                      Thank you not only for the script, but also for helping me understand that it isn't my inability to follow documentation... Will try it out and let you know how it went. As you saw in my post, I am providing a GUI way for the systems group supporting an application to manage scheduled jobs (it was either that or cron - and I thought this would be less complicated than cron...lol). It works great for stored procedures - but for external jobs - well, your answer and this thread shows that it isn't as straight forward as we all would like (yet).

                      Leaving for a cruise tomorrow so I may not provide feedback for a week-and-a-half... :-)

                      Steve
                      • 38. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                        Rnr-Oracle
                        Hi Steve,

                        Sorry I wasn't able to get back to you before . I have some specific answers to your questions.

                        1) I think so but don't know. Easy enough to figure out though - create the job and then query the all_scheduler_jobs view to see the owner.

                        2) This is covered in the parent post for this thread - in summary
                        - in 11g if you specify a credential , it runs as the OS user specified there
                        - in 10.2.0.2 and up it runs as the OS user/group specified in $ORACLE_HOME/rdbms/admin/externaljob.ora
                        - prior to 10.2.0.2, it runs as the owner of the $ORACLE_HOME/bin/extjob executable

                        3) No. The external job has no knowledge of the oracle schema it is running as. If you are running PL/SQL code you should try to use regular pl/sql jobs if possible. If you absolutely need sqlplus, you can use OS authentication for sqlplus so you don't have to specify a password.

                        4) This just means that the script ran to completion and the final line of the script returned a error number (return code) of zero (every OS command has a return code / error number). It is not a guarantee that every line of the script ran successfully. For 10gR2 and before you should redirect stderr (and probably stdout) to a file for future analysis . For 11g if you use a credential we store stderr and stdout in separate files and allow for their retrieval from pl/sql .

                        What the script is responsible for doing is ensuring that it returns 0 whenever it has succeeded and non-zero whenever it fails. This is fairly standard.

                        5) "Not owner" is not really the error message. Instead the scheduler is converting the error number into a system error message which happens to be "not owner" . What you need to find is what error number corresponds to that system error message on your operating system (probably 1) and then figure out why your script is returning that error code.

                        6) Where exactly are you seeing nobody:nobody ? the contents of externaljob.ora should look like
                        run_user = nobody
                        run_group = nobody

                        Jobs with no credential specified will run with the run-user and run-group specified (as the OS user and group). If either does not exist, the Scheduler should throw an error. It is possible that the user nobody does exist but doesn't have required permissions to run the required actions.

                        Hope this helps, reply if you have any further questions.

                        -Ravi
                        • 39. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                          Rnr-Oracle
                          Hi Jonathan,

                          Thanks for those very useful tips and the utility shell script. There are some pretty good ideas in there and I am sure it will be very helpful to some people.

                          -Ravi
                          • 40. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                            710042
                            Hi,
                            Can you help me...

                            It is mandatory for creating the external job logging with the SYS user?

                            I created the JOB like this:

                            Oracle 10.2.0.4
                            HP-UX 64 bits

                            externaljob.ora :
                            run_user = oracle
                            run_group = oinstall


                            sqlplus /nolog
                            conn / as sysdba
                            create user1 identified by user1;
                            grant connect, resource to user1;
                            grant create job to user1;
                            grant create extenal job to user1;

                            conn user1/user1

                            begin
                            dbms_scheduler.create_job(
                            job_name => 'P_10',
                            job_type => 'EXECUTABLE',
                            repeat_interval => 'FREQ=MINUTELY; INTERVAL=5',
                            job_action => '/usr/bin/ksh',
                            number_of_arguments => 2,
                            job_class => 'DEFAULT_JOB_CLASS',
                            enabled => FALSE,
                            auto_drop => FALSE,
                            comments => 'Job'
                            );

                            dbms_scheduler.set_job_argument_value (
                            job_name => 'P_10',
                            argument_position => 1,
                            argument_value => '-c'
                            );

                            dbms_scheduler.set_job_argument_value (
                            job_name => 'P_10',
                            argument_position => 2,
                            argument_value => '/home/user1/prueba.sh');


                            dbms_scheduler.enable('P_10');
                            end;
                            /


                            exec DBMS_SCHEDULER.run_job(job_name=>'P_10');


                            PL/SQL procedure successfully completed.


                            In the execution the problem is:


                            SQL> exec DBMS_SCHEDULER.run_job(job_name=>'P_10');
                            BEGIN DBMS_SCHEDULER.run_job(job_name=>'P_10'); END;

                            *
                            ERROR at line 1:
                            ORA-27370: job slave failed to launch a job of type EXECUTABLE
                            ORA-27300: OS system dependent operation:spawning external job failed with
                            status: 65543
                            ORA-27302: failure occurred at: sjsec 4
                            ORA-06512: at "SYS.DBMS_ISCHED", line 150
                            ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
                            ORA-06512: at line 1


                            __________________

                            ls -l /home/user1/prueba.sh

                            -rwxrwxrwx 1 user1 users


                            more /home/user1/prueba.sh

                            #!/usr/bin/ksh
                            kD=`date +%Y%m%d`
                            echo "1" >> /tmp/prueba_$kD.txt


                            Regards

                            Joseph
                            • 41. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                              Ronald Rood
                              Hi,

                              no, it is not mandatory to create your objects as sys, on the contrary, you normally should not use sys to create application objects at all.
                              You jobs are going to run using oracle:oinstall. You script has 777 permissions but how about the directories. Your directory /home/user1 should at least have 711 for oracle:oinstall to be able to start your script.

                              I hope this helps,
                              Ronald
                              http://ronr.blogspot.com
                              • 42. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch fi
                                704192
                                Hi,
                                Thanks for all the information on this post. It has been very useful.
                                I have an issue with scheduler setup on 11g on hp unix,
                                I followed all the steps for the file permissions and the settings in the externaljob.ora file and got the scheduler working. However, we have two nodes working in active-passive mode, (both configured to run the scheduler), when the node was switched over and we got back to the old node, the scheduler throws 274668 - run_group error.
                                I have checked the error# and the additional_info in the user_scheduler_job_run_details - "Invalid or missing run_group in configuration"
                                I have checked the externaljob.ora file.Its contents are
                                run_user = oracle
                                run_group = oinstall
                                File permissions are:
                                -rw-r--r-- 1 root oinstall 1536 Sep 3 13:57 externaljob.ora
                                -rwsr-x--- 1 root oinstall 21340 Sep 2 17:48 extjob
                                -rwxr-xr-x 1 oracle oinstall 21340 Sep 2 17:48 extjobo
                                -rwsr-x--- 1 root oinstall 21520 Sep 2 17:48 jssu

                                Any pointers on what could be wrong?

                                My scheduler code is :
                                create or replace
                                PROCEDURE p_test_scheduler
                                AS
                                l_bchfile VARCHAR(200) := '/TESToracle/AASEJBAPP/UPLOAD/test.sh';
                                l_time_to_run date;
                                l_time_to_stop date;
                                --max allowed length for job name is 30 characters
                                l_job_name VARCHAR2(30) := 'TEST_SCHEDULER';
                                l_count NUMBER := 0;
                                BEGIN
                                select sysdate+10/(24*60*60) into l_time_to_run from dual;
                                select sysdate+30/(24*60) into l_time_to_stop from dual;
                                dbms_output.put_line('run time ' || to_char(l_time_to_run, 'DD-MM-YY HH:MI:SS'));
                                dbms_output.put_line('stop time ' || to_char(l_time_to_stop, 'DD-MM-YY HH:MI:SS'));
                                dbms_output.put_line(l_job_name);
                                dbms_output.put_line(l_bchfile);

                                DBMS_SCHEDULER.CREATE_JOB (
                                job_name => l_job_name,
                                job_type => 'EXECUTABLE',
                                job_action => l_bchfile ,
                                start_date => l_time_to_run,
                                repeat_interval => '', -- job to be run only once
                                -- -- end_date => l_time_to_stop,
                                -- number_of_arguments => 5,
                                -- --job_class          =>  'batch_update_jobs',
                                comments => 'File Upload');

                                dbms_scheduler.enable(l_job_name);
                                dbms_output.put_line('scheduled...');
                                END;

                                the shell script test.sh is :
                                #!/usr/bin/sh

                                echo executing test.sh
                                export workingfolder=/TESToracle/AASEJBAPP


                                export DATA_PATH=$workingfolder/INBOX
                                export TMPFILE_PATH=$workingfolder/UPLOAD/Temp

                                export SCRIPT_PATH=$workingfolder/UPLOAD/
                                export REMOTE_FTPPATH=INBOX/$upldtype/$finyr
                                export PATH=$workingfolder:$SCRIPT_PATH:$PATH
                                export LOGPATH=$workingfolder/LOG

                                echo trying to execute test.sh > $LOGPATH/log.txt
                                echo just testing >> $LOGPATH/log.txt

                                #----------------------------------------
                                #Set Basic FileName Parameters
                                export TIMESTAMP=`date +%d%m%y%H%M%S`
                                echo TIMESTAMP is $TIMESTAMP >> $LOGPATH/log.txt
                                export LOGFILE=$LOGPATH/$TIMESTAMP.log

                                #----------------------------------------
                                # Processing
                                echo --timestamp $TIMESTAMP >> $LOGFILE
                                echo test.sh > $LOGFILE
                                echo --- END >> $LOGFILE

                                -Nagashree
                                • 43. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
                                  736688
                                  Thanks for your guide that was very helpful to understand a process to execute a shell script.

                                  I've done as you wrote, but I still have a problem.

                                  1. I checked the permissions of executable file which is 755, is OK.
                                  2. I checked the externaljob.ora because I'm using oracle 10.2.0.3. of course, it's owned by root, and permission is 644
                                  There are two things,
                                  run_user = nobody
                                  run_group = nobody
                                  Those are OK, too.
                                  3. I checked environment variables, ORACLE_HOME, ORACLE_SID and PATH that are OK :)
                                  4. I checked a full named executable file. Permission is 755.
                                  Contents of an executable file, test. sh
                                  #!/usr/bin/ksh

                                  /usr/bin/mkdir /tmp/test

                                  When I made a job and that was executed, I would found an error in SCHEDULERJOB_RUN_DETAILS:
                                  ORA-27369: ............................... <= because I use my own language :)
                                  : Unknown error
                                  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"

                                  Is there anything I missed?

                                  Thanks a lot in advance,
                                  Plz, give me a tip~ :)

                                  Jinbae Kim
                                  • 44. Re: Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files
                                    Rnr-Oracle
                                    Hi,

                                    What are the owners/permissions on $ORACLE_HOME/bin/extjob ?

                                    -Ravi