Parameters for Shell Script running through DBMS_SCHEDULER as Executable

Hi,
I'm using Oracle 10.2.0.1 on Solaris.
I have a shell script to run through DBMS_SCHEDULER.
DBMS_SCHEDULER.CREATE_PROGRAM (
program_name => 'PROGRAM_NAME',
program_type => 'EXECUTABLE',
program_action => '/home/oracle/test.sh',
enabled => TRUE,
comments => 'Test Shell Script'
But how do I define the parameters for the shell script?
Lets say if I run the shell script from the Unix promt I will enter as below:
/home/oracle/test.sh PITS aed5 XYZ
How do I define it in the DBMS_SCHEDULER.define_program_argument?
Thanks,
Shail

When you create the program you define the number of parameters it will accept:
DBMS_SCHEDULER.CREATE_PROGRAM (
program_name => 'PROGRAM_NAME',
program_type => 'EXECUTABLE',
program_action => '/home/oracle/test.sh',
enabled => TRUE,
comments => 'Test Shell Script',
number_of_arguments     => 3
);then you define your job arguments and set default values. This is optional - but if you don't then you will have to define the values using the set_job_argument_value:
-- defines the first argument
DBMS_SCHEDULER.DEFINE_PROGRAM_ARGUMENT(
   program_name   => 'PROGRAM_NAME',
   argument_position   => 1,
   argument_name           => 'arg1',
   argument_type           'CHAR',
   default_value          => 'PITS',
);You can set the argument vaues using:
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
   job_name => 'JOB1',   
   argument_position  => 1,
   argument_value => 'PITS');or using the argument name defined using the define_program argument
DBMS_SCHEDULER.SET_JOB_ARGUMENT_VALUE (
   job_name => 'JOB1',   
   argument_name  => 'arg1',
   argument_value => 'PITS');where JOB1 is a job for program PROGRAM_NAME created using the dbms_scheduler.create_job procedure
see docmentation: http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_sched.htm for more details...

Similar Messages

  • Parameters for Shell Script running DBMS_SCHEDULER as Executable

    Hi,
    I have a shell script to run through DBMS_SCHEDULER.
    DBMS_SCHEDULER.CREATE_PROGRAM (
    program_name => 'PROGRAM_NAME',
    program_type => 'EXECUTABLE',
    program_action => '/home/oracle/test.sh',
    enabled => TRUE,
    comments => 'Test Shell Script'
    But how do I define the parameters for the shell script?
    Lets say if I run the shell script from the Unix promt I will enter as below:
    /home/oracle/test.sh -d aed5 -p "XYZ"
    How do I define it in the DBMS_SCHEDULER.define_program_argument?
    Thanks in advance,
    Samujjwal Basu

    Re: Excute Unix command Using PL SQL might help.

  • Passing parameters from shell script to OWB process flow

    Hi all,
    I am running OWB process flow (using the template script provided by oracle) and i want to pass two date parameters as shown below:
    sqlplus -s $SQL_USER/$SQL_PWD@$ORACLE_SID @$HOME_DIR/src/vmc_oem_exec_script.sql OWB_OWNER VMC_POST_DW_PF_LOC_SIT PROCESS VMC_NM1_PORT_MAIN "," "P_DATE_FROM=$DATE_FROM,P_DATE_TO=$DATE_TO"
    How do i catch those values in process flow and pass those to mappings in Process flow?
    Do i need to create PF variables with same names or any name will do?
    Thanks in advance

    This document is explaining how to pass data between activities in process flow.
    I am passing parameters from a shell script.
    Any ideas,how to pass parameters from shell script and then initialize the process flow variables based on those values and then pass them further to mappings.
    Thanks

  • How to Prompt for User/Pass Running Shell Script Remotely through ARD

    So I finally got my Active Directory Script working! However, I realized that I'm not the only one going to be running this script and to have my user name and password in the script itself is beyond foolish. While I know it's possible just to have whoever's running the script to manually add their username and password, I'd prefer to have prompts to make things easier for the rest of my team.
    Here's my current script. I've tested it on the machine I'm connecting to Active Directory and it works fine if you run it on the machine itself in terminal. However, I'm going to be doing this on about 150 machines and the whole point of the script is to do it remotely.
    #! /bin/bash
    MACNAME=$(scutil --get ComputerName)
    read -p "User Name: " USER
    read -p "Password for $USER: " PASS
    dsconfigad -add "CORP.DOMAIN.NET" \
    -username $USER \
    -password $PASS \
    -computer $MACNAME \
    -mobile disable \
    -mobileconfirm disable \
    -localhome enable \
    -useuncpath enable \
    -shell /bin/bash \
    -ou OU=Macs,CN=Computers,DC=corp,DC=DOMAIN,DC=net \
    -force \
    -localpassword "PASSWORD" \
    -groups "GROUPS"
    When I run the UNIX script through ARD to a machine, I get no prompts for USER or PASS. In fact, it gives me the following error "dsconfigad: Authentication server encountered an error while attempting the requested operation. (5202)" So it's not asking for a user name and password.
    Is there any way to make a shell script prompt you for a User Name and Password when you're sending commands remotely through ARD? Or is there another way to do this?
    Any suggestions would be greatly appreciated.
    -rks

    Best solution is to create an account that is exclusive to binding machines.  By doing this, you can embed the user name and password in the script.  Heck, you can post it on your website.  If the account is configured properly, it will only be able to create machine records in a defined container.  If you are mixing Macs and PCs in your AD domain, I also recommend creating an isolated container for your Mac records.  Now, the account has even less access rights as you can make it so it only has rights to the Mac container.
    Otherwise, ARD does not prompt.  You can play around with an expect script but the reality is that you are still embedding the credentials in the script so it really does not achieve what you want.  ARD is not an interactive shell scripting tool.  It is more a fire and forget.
    Reid
    Apple Consultants Network
    Apple Professional Services
    Author "Mavericks Server – Foundation Services" :: Exclusively available in Apple's iBooks Store

  • How do i print parameters in shell script through java

    Hi,
    I am sorry if have posted this query in wrong thread!!!
    How do i print the parameter in shell script which are passed from java programm?
    i have tried in different ways.. but the actual param value is not printing when i execute the java programm
    java code is here
    import java.io.IOException;
    public class TestShell {
          * @param args
    public static void main(String[] args) {
             String inputFilePath=args[0];
              String inputFileName=args[1];
              String outputFileName=args[2];
              String outputFilePath=args[3];
              Runtime r = Runtime.getRuntime();
              String[] cmdArray = new String[]{"Test.sh",inputFilePath, inputFileName, outputFileName, outputFilePath};
              try {
                   r.exec(cmdArray);
                   System.out.println("Test.sh executed successfully.");
              } catch (IOException e) {
                   e.printStackTrace();
    }I need a shell script to print paramenters (inputFilePath, inputFileName, outputFileName, outputFilePath)
    Thanks,
    Jasmin

    user13836688 wrote:
    But my code is something look like thisWell unless I've completely lost my marbles (possible) or Java Runtime.exec() does something I've never heard of, I can't even see how that will execute. For a start, assignments in the Bourne shell take the form ofinfile = $inputFilename;orinfile = "inputFilename";not what you've got; and the first form would only work if you've set the appropriate environment variables.
    Are you sure you're not confusing this with a Javascript script?
    Winston
    Edited by: YoungWinston on Apr 18, 2011 12:51 PM
    And BTW, you don't need to put ';' at the end of each statement, unless there's more than one on a line.
    Edited by: YoungWinston on Apr 18, 2011 12:54 PM
    BTW2: 'printf "%d", inpath' also looks very dodgy, since 'inpath' is unlikely to be a number (in fact, it's unlikely to be anything).
    I think you might want to get a book on scripting.

  • Substitute for shell scripts in windows?

    In linux, I believe shell scripts would be useful for simulating user load on oracle. But in windows what could serve that purpose? Dos?

    In windows it's called batch file scripting
    run these script in cmd mode. similiar to a DOS screen
    type cmd at Start--> Run
    http://labmice.techtarget.com/articles/batchcmds.htm

  • Command line parameters and Shell Script -- URGENT

    Hi folks,
    I am facing some problem in the Shell script and the command line parameter.
    The scenario is -- I am picking a file from a directory, whose path is <b>/interfaces/xid/receive/filename.dat</b>
    I have to encrypt filename.dat and move it to another folder, whose path is <b>/interfaces/xid/send</b>. So, the encrypted file will reside in the <b>send</b> directory.
    Now, I don't want to hardcode the new path, where the encrypted file has to be moved. Please let me know how to achieve this. Please consider this as urgent.
    Have a look at the command line in the "before message processing"  -- <b>/interfaces/xid/receive/xi_decompress.sh  /interfaces%F</b>
    Have a look at the shell script for the same --
    #!/bin/sh
    Setup environment variables
    COMMPRESS_DIR=/interfaces/software/commpress
    export COMMPRESS_DIR
    LOG_DIR=/interfaces/software/commpress/log/
    export LOG_DIR
    IN_FILE=$1
    export IN_FILE
    Find the directory where the unencrypted file is deposited
    IN_FILE_DIR=`dirname $1`
    export IN_FILE_DIR
    Make sure the working directory is where the unencrypt.key is...
    cd $COMMPRESS_DIR
    encrypt the file
    if [ `uname` = "HP-UX" ]
    then
       find $IN_FILE | $COMMPRESS_DIR/compx $IN_FILE_DIR logpath=$LOG_DIR
    else
       find $IN_FILE | $COMMPRESS_DIR/compx-sun $IN_FILE_DIR logpath=$LOG_DIR
    fi
    Get the result of the encryption
    RET_CODE=$?
    Check decryption result
    If error (retuen code <> 0), create an error log file in the
    same directory as the input file.
    if [ $RET_CODE -ne 0 ]
    then
        PREFIX="Decryption"
        DATE_TIME=$(date +%Y%m%d_%H%M%S%N)
        SUFFIX="err"
        FILENAME=$/$_$.$
        echo "Decryption Error log"        >$FILENAME
        echo "DATE_TIME:  $"   >>$FILENAME
        echo "DIRECTORY:  $" >>$FILENAME
        echo "FILE:       $"     >>$FILENAME
        echo "ERROR CODE: $"    >>$FILENAME
    fi
    exit $RET_CODE
    What else I need to add in this piece of code? Urgent help !!
    Thanks a lot in advance.
    Neetesh

    Hi Satish,
    I was able to figure that out, that we need to hard code the path as the 2nd parameter.
    But I guess there is a way out in Unix where we can handle this situation, where we are not willing to hard code.
    Anyways, thanks a lot for your input .. -:)
    Cheers,
    Neetesh

  • Unix shell script run from pl/sql procedure

    Hi Guru
    I want to run unix shell script from pl/sql procedure. Actual I want to run it from developer 10g form.
    Please guide me in this regards
    Regards
    Jewel

    Look at the host or client_host builtins in the help

  • Directory for shell scripts

    I'm looking for a logical place to save Unix shell scripts. ~/Documents doesn't sound right, nor would ~/bin because the scripts aren't binaries. I know it comes down to personal preference, but what makes the most sense, ~/Library/Scripts? and /Library/Scripts for all users?

    I've been using Unix since '85, and here is what I do:
    ~/local/bin # for my personal scripts and executables
    /usr/local/bin # for my shared scripts and executables
    And I also create a symlink ~/bin that points to ~/local/bin
    cd ~
    ln -s local/bin bin
    Many open source applications are stored by default in /usr/local/bin, but from time to time, I'm on a Unix system I do not own, and I want to install a personal open source program, so I use
    ./configure --prefix=$HOME/local
    which will configure the open source software so it is setup to store things in my home directory, including any support files, man files etc... associated with the program. For example a personal copy of Vim.

  • [SORRY] exec command problem for shell scripting

    I know this is not an appropriate place to ask questions about shell programming, but I have tried many other places... and no helpful help yet. So, here I am.
    I am writing a simple shell script that would actually execute a java application. However, I want to give the users the option of running it in background. So,
    COMMAND="java blahblah"
    DAEMON="&"
    exec "$COMMAND $DAEMON"
    But, when I run it, it spits out an error message saying something like "Invalid agrument: &".
    Is there a way to exec'ing "java blahblah &" using variables as arguments to "exec" command???
    OR is it even NOT possible?
    This problem seems so trivial, but took a man out of me. :( Please help.
    thanks
    yosep

    execute a java application. However, I want to give
    the users the option of running it in background. It doesn't generally make sense to exec an ansynchronous process, and one can introduce varying errors in this method. Just simply drop the exec. The java process will async off and the shell script will exit leaving no shell process running. Simple as that.
    BTW, you generally exec a java process if you wish to replace the shell with the java process, but then the async request is given at the caller, she who actually calls the script (genarally from an interactive shell).

  • What are the controlling parameters for a MRP run?

    Hello! SAP gurus,
    Can any one explain me about Control Parameters related to MRP Run.
    Thank you,

    Please look at the following posts
    mrp
    MRP Control parameters(MD02)-Regarding.
    Regards,
    Harish

  • SHELL SCRIPT RUNS AS PUBLIC USER WHEN INVOKED FROM BROWSER ALTHOUGH LOGGED

    I am trying to have a pdf converter which converts the HTML pages on the fly to pdf. For this I have an application
    installed on the MT called HTMLDOC(opensource app). Now I can convert static
    HTML pages on the MT using the command "HTMLDOC". After this I am using an sh
    file which is place in cgi-bin which executes the the conversion on the fly,
    getting the contents form the URL passed to it.
    I am using this sh script(test.sh)
    #!/bin/sh
    HTMLDOC_NOCGI=1; export HTMLDOC_NOCGI
    # The "options" variable contains any options you want to pass to HTMLDOC.
    options="-t pdf --webpage "
    # Tell the browser to expect a PDF file...
    echo "Content-Type: application/pdf"
    echo ""
    # Run HTMLDOC to generate the PDF file...
    htmldoc $options http://${SERVER_NAME}:${SERVER_PORT}$PATH_INFO
    My normal HTML page is invoked as follows
    http://<server>:<port>/dad/page.html
    To convert to pdf I call the page as follows
    http://<server>:<port>/cgi-bin/test.sh/dad/page.html
    This will convert the page.html to a pdf. However the user is always PUBLIC, although I have logged
    into the portal. Now since the user is always PUBLIC my application doesnt
    render as expected. I need to have the user be logged in a valid OID user,
    which it already is. I know this has something to do with the mod_osso.confg
    file, but just doesnt seem to work. Could anyone help on this

    Even though your cgi script is authenticated, it does not have access to your session/cookies when it makes it's own independent web request.<br>
    You could ask it to log on first, which is how web clipping works, but then you'd have to manage credentials, i.e. you'd have to communicate your user name and password to the script. There's all kinds of issues with that and although possible, I wouldn't recommend it.<br>
    <br>
    Getting back to your requirement, you're looking to produce a printed version of the web page, right? Why don't you just create a special stylesheet for this purpose?<br>
    You can override the portal classes, hide sections of the page, etc. <br>
    <br>
    The other option would be to setup a virtual PDF network printer using Ghostscript or something similar. There are also lots of PDF conversion services available on the net.<br>
    <br>
    HTH.<br>
    <br>
    Ingo<br>
    <br>

  • Default variant to be picked for QGA3 when run through QE01/QE02/QE03.

    Hi Gurus,
    I need help regarding one requirement, Our client want to have default variant which will have custom form name of selection screen of QGA3, along with the inspection lot number carried from QE01/QE02/QE03.
    Our client did not get convinced for any alternative like custom transaction code or transaction variant for QGA3, they want only during std t-code run only.
    I will explain the requirement once again, During QE01/QE02/QE03 when we click on "Inspection result print" it will take to QGA3 screen. The inspection lot is carry forward from QE01/QE02/QE03 to QGA3 screen and along with this the default variant also to be picked automatically .
    Thanks in advance for your help
    Nag.

    Explore function module exit EXIT_SAPLQEEM_022 & EXIT_SAPLQEEM_026

  • How to capture error messages for BCP when running through XP_CMDSHELL

    XP_cmdshell returns 0 as success when running BCP that causes insertion failure for any records (failure because of truncation, data type mismatch etc.)
    One way is to capture output message in temp table and can parse the messages. but I am looking for some direct methods.

    Hi Naveen Raikwar,
    We can use insert/execute syntax to insert error output to a file, here is a good article, please see:
    http://www.sqlservercentral.com/articles/Error+Handling/69196/
    And here is a similar thread, please refer to:
    http://social.msdn.microsoft.com/Forums/en-US/sqltools/thread/b37ec1fd-ea2f-4546-93c1-8bb9d589710d
    Thanks,
    Eileen
    Eileen Zhao
    TechNet Community Support

  • Bash script run via cron not executing MYSQL command

    I have a bash script which is run from a cron,
    It is executing as I have it write to a log file which it does correctly.
    I am wanting the bash script to restore a mysqldump file.
    When I run the bash script manually the dump file gets loaded fine. But when I run it through the cron the mysql command appears to be ignored.
    The mysqldump file is 54MB and I have checked to make sure that MYSQL is included in the global users path in /etc/profile
    Does anyone know why this maybe??
    Here is the bash file
    #!/bin/bash
    date >> /home/user/crons/crons.log
    echo "Started loadbackup" >> /home/user/crons/crons.log
    cd /home/user
    dbuser=root
    dbpass=password
    dbname=databasename
    filename=backup
    mysql -hlocalhost -u"$dbuser" -p"$dbpass" "$dbname" < " >> /home/user/crons/crons.log
    My crontab looks like
    02 17 * * * /home/user/crons/loadbackup.sh
    Many thanks
    Richard

    Hi Richard,
    Have you tried redirecting the script output in the cron to see if an error is being reported?
    I.e.
    02 17 * * * /home/user/crons/loadbackup.sh > /tmp/loadbackup.log 2>&1

Maybe you are looking for

  • XML to PLAIN - urgent help needed

    Hello everybody! I have a ftp receiver adapter; in this adapter a xml file should be converted to a plain text file. The structure looks like this: <ns0:MFG_ORDERS xmlns:ns0="urn:test.com:edi:test"> <HEADER>   <So_recordtype>SOHD</So_recordtype>   <S

  • Print screen button causing project to advance

    I have added some JavaScript to a button in my captivate project using On success > Execute JavaScript > Script Window > window.print() This works fine to print the screen, however, clicking the button also makes the project advance to the next slide

  • Missing tabs with page information on iWeb '08

    In my iWeb '08 version (in Dutch), all of a sudden I am missing the information of the pages, on the left side of te screen. Where you can see the different pages you have created and where you can change the order of the pages, the names etc. I trie

  • Update to process version 2010 & smart collection "has adjustments"

    Buying the new Lightroom 3 version ofcourse I wanted to profit of the new process version. So I selected all images I had "not adjusted" before and selected Update to Process version 2010. This works great. However I now have one problem. I had and h

  • Make controls stick?

    I inserted a flash movie and used one of the standard skins in dreamweaver cs4. Is there a way to make these controls always be visible? they disappear when the cursor is mov ed away from the movie. DD