Calling sqlplus in shell script

hi all,
Can any one explain me why we use
sqlplus -s
command along with -s option in shell scripts only.

sqlplus -sThat's the SILENT option. Oracle documentation :
SILENT Option
-S[ILENT]
Suppresses all SQL*Plus information and prompt messages, including the command prompt, the echoing of commands, and the banner normally displayed when you start SQL*Plus.
Did you try using that option in interactive mode ?

Similar Messages

  • Calling sqlplus from shell script

    Hi ,
    I am calling sqlplus from a shell script. After running sql commands successfully, it fails to continue executing commands from the shell script.
    There is no EXIT statement at the end of the sql.
    The error i get is,
    SP2-0734: unknown command beginning "echo "FFFF..." - rest of line ignored.
    Can someone please help.

    how does your shell script looks like? did you check my other post today on this forum
    sqlplus called from a shell script

  • How to get an error code from from calling sqlplus from shell script?

    Hello -
    i am calling sqlplus from a bash shell script. If the sql statement generates an error, how can I return that error code (unsuccessful) back to the bash shell?
    Thanks!

    user11340104 wrote:
    Hello -
    i am calling sqlplus from a bash shell script. If the sql statement generates an error, how can I return that error code (unsuccessful) back to the bash shell?
    Well, let google be your friend,
    http://www.google.co.in/search?rlz=1C1GGLS_enIN327IN327&sourceid=chrome&ie=UTF-8&q=sqlplus+error+codes
    There are many threads I guess talking about the same issue.
    HTH
    Aman....

  • Sqlplus called from a shell script

    Hi.
    I'm calling to sqlplus from shell script. The thing is that when it ends its execution I am in sqlplus console, but I want to be in my script. Is there any option to auto-exit when it ends?
    sqlplus $DB_CON @$SQLDIR/$SQLFILE
    Thanks
    Rodrigo

    You just have to add exit command at the end of the script file, after the slash:
    end;
    exit;
    and that should work.

  • Calling linux / unix shell scripts from APEX

    Hi -- I'm doing some prototyping, and would like to try calling a unix shell script on the server from within APEX.
    Is this possible? Maybe thru Javascript? Other ways? Not sure if it's possible thru pl/sql.
    FYI, I'm attempting to check username/password specified at login to see if it's a valid login
    to another database (also specified at login). If there's an easier way to do this, I'd love to hear it!
    We're highly motivated to have a single apex app work on multiple databases -- largely because of a lack of
    administration resources on the other databases. All databases are accessible via database links from
    the apex server (the links are necessary to implement other business rules), and I know I can get
    the DML working. Powers that be prefer that Database Account authentication (or a facsimile thereof)
    be used. I suspect I'm opening myself up to lots of criticism by disclosing this ... :)
    Thanks for any ideas,
    Carol

    R -- If I understand you correctly, a pl/sql process in APEX could invoke a java program on the server. Is that correct?
    If so, is there any reason it couldn't just call a unix shell script? Seems they're both just executables recognized by the OS....
    I know I called unix scripts from embedded sql a billion years ago, but don't recall the method for doing that. What is
    the syntax I'd use in apex / pl/sql?
    thanks,
    Carol

  • Calling an external shell-script?

    Hello everybody,
    I only have a short question: How can I easily call an external shell-script in PL/SQL? I need this to make new directories ...
    thx for help

    Re: is ADF free??
    We have a problem when we want to create a portlet base on WebClipping Port
    How to customize login page in 11.5.10.2?

  • Calling an external shell script program from ABAP.

    Hi,
      Can i call an external shell script program from abap which is there on application server.
    The FM WS_EXECUTE i know can be used for calling this purpose.
    But i am getting a doubt that how can i call the external program from there.
    Please clear my doubts.
    Thanks in advance.
    Vikash

    search in SCN for sm49 and sm69 Tr. you will surely find solutions for it, with a simple search.

  • Call a UNIX shell script from an oracle stored procedure

    We need to call a UNIX shell script from an oracle stored procedure
    i.e. the control should come back to the procedure once the script completes. Can any body help to achieve this ?

    There are various ways in achieving this.
    For Example, you can call a PRO*C-Library residing on the database server.
    This requires a PL/SQL library to be generated and some changes to the Listener configuration.
    It is also possible to implement a java procedure on the database being invoked by a PL/SQL wrapper class.
    In this way (and if used right) there is also granularity regarding the filestructure permissions given and it may be called during a Forms or other PL/SQL session.
    The article below explains a more generic approach how to invoke shell commands from within an Oracle Instance.
    Be careful with this, because it really works ;)
    Refer to :
    http://www.oracle-base.com/articles/8i/ShellCommandsFromPLSQL.php
    Message was edited by:
    user434854

  • Debugging a program being called from a shell script

    hi All,
    i want to know how debug a C program being called from A Shell Script,
    my script looks like the following :
    ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFilei also have to pass some arguments to the script itsellft, which in trun going to pass it to the program,
    also in some cases i may be required to Pipe some data to the program, like the folowing
    cat DataFile | myProgramThanks ,

    You can also use ss_attach with the scheme that Anton
    suggested above. Instead of inserting "dbx" into your
    script, insert "ss_attach" into your script.
    It's also possible to change your script to something like this:
    cat DataFile | ${DEBUG} myProgram
    Then you can run your script like this:
    setenv DEBUG ss_attach
    ecReqProcMain $Cfg/ecReq.g $TotCnt 2>> $ErrFile
    --chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Getting an exit value from a program called thru a shell script

    how do i get the correct exit value always from a program called thru a shell script
    the getExitValue of the process works fine someitmes but not always ...
    Ex: write a pgm which sleeps for 5 secs & returns with exit(100).try to invoke this thru a script & try to run this script from Runtime.getRuntime.exec(..)
    ...the exit value is not same as 100.(it works if the sleep is not given though !!)
    can nebody help??

    ive done that ...see the sample code for ex..
    public void execute()
                   try{
                             Process program=Runtime.getRuntime().exec(cmd);
                             printOutput(program.getInputStream());
                             try
                                  program.waitFor();
                             catch(InterruptedException e)
                                  System.out.println("Command Interrupted: " + e);
              System.out.println("Error status : "+program.exitValue());
                        catch(SecurityException e)
                             System.out.println("Error executing program "+e);
                        catch(IOException e)
                             System.out.println("Error executing program "+e);
    ....

  • Problem while calling concsub from shell script

    Hi All,
    I am facing problem when I am trying to run CONCSUB utility from shell script.The same works well when I try it from command line.The only prob I am facing from shell script is assigning values to temporary variables.
    This is how my script looks
    #!/bin/bash
    export PARM5="$5"
    export PARM6="$6"
    export PARM7="$7"
    echo "INTPARM5=\"$PARM5\""
    echo "INTPARM6=\"$PARM6\""
    echo "INTPARM7=\"$PARM7\""
    echo $FND_TOP/bin/CONCSUB $1 ONT 'Order Management Super User, Vision Operations (USA)' $3 WAIT=Y CONCURRENT ONT $PROGRAM "$INTPARM5" "$INTPARM6" "$INTPARM7"When I try to run the above shell based concurrent program it doesn't pass the parameters as expected and it errors out saying "Wrong number of arguments to call the procedure"
    I tried my luck from some of the previous posts ({thread:id=2360776} ),but to vain
    If anyone has any ideas,please suggest!!
    Thanks in advance!!
    Edited by: sandy on May 4, 2013 12:54 PM

    Here are your proofs
    Proocedure
       PROCEDURE abc(--p_errbuf            OUT   VARCHAR2,
                                                --p_errcode           OUT   VARCHAR2,
                                 p_order_no          IN    NUMBER DEFAULT NULL,
                                                p_customer_id       IN    NUMBER DEFAULT NULL,
                                 p_name              IN    VARCHAR2 DEFAULT NULL
          IS
                    v_cname    VARCHAR2(200);
               v_ordered_date DATE;
               v_order_number  NUMBER;
              v_order_type    VARCHAR2(200);
    BEGIN
                fnd_file.put_line(fnd_file.output, 'Begin Execution');
       SELECT DISTINCT ac.customer_name,
                    d.ordered_date ordered_date,
                    d.order_number order_number,
                    x.NAME order_type
            INTO   v_cname
               ,v_ordered_date
               ,v_order_number
               ,v_order_type
               FROM oe_order_headers_all d,
                    oe_transaction_types_tl x,
                    wsh_delivery_details b,
                    wsh_delivery_assignments c
                    ,ar_customers ac
              WHERE 1 = 1
                AND ac.customer_id = b.customer_id
                AND d.order_type_id = x.transaction_type_id
                AND x.LANGUAGE = 'US'
                AND b.released_status = 'B'
                AND b.source_header_id = d.header_id
                AND c.delivery_detail_id = b.delivery_detail_id
                AND d.order_number=NVL(p_order_no,d.order_number)
                AND ac.customer_id = NVL(p_customer_id,ac.customer_id)
             AND x.name=NVL(p_name,x.name)
                AND NOT EXISTS (SELECT 1
                                FROM wsh_delivery_details b
                               WHERE 1 = 1
                                      AND b.released_status != 'B'
                                      AND b.source_header_id = d.header_id)
                                       --BETWEEN ('1213794') and ('1213797'))
                AND rownum<2;
            INSERT INTO xxc_temp(customer_name,ordered_date,order_number,order_type) VALUES(v_cname,v_ordered_date,v_order_number,v_order_type);
            COMMIT;
             fnd_file.put_line(fnd_file.output, 'Order Number is' || v_order_number);
             fnd_file.put_line(fnd_file.output, 'Order Type is'   || v_order_type);
       END;Script
    #!/bin/bash
    set -x
    export PARM5="$5" 
    export PARM6="$6"
    export PARM7="$7"
    sqlplus -s $1 <<EOF
    set head off feed off serverout on size 1000000
    exec abc('$PARM5','$PARM6','$PARM7');
    exit
    EOFNow when I run the 'XX Order Detail CSV Report' I get the below log and no Output
    +---------------------------------------------------------------------------+
    Application Object Library: Version : 12.0.0
    Copyright (c) 1979, 1999, Oracle Corporation. All rights reserved.
    XXKES_PDF_TRANSFER module: XX Order Detail CSV Report
    +---------------------------------------------------------------------------+
    Current system time is 06-MAY-2013 05:05:56
    +---------------------------------------------------------------------------+
    + export PARM5=66432
    + PARM5=66432
    + export PARM6=
    + PARM6=
    + export PARM7=Mixed
    + PARM7=Mixed
    + sqlplus -s APPS/APPS
    +---------------------------------------------------------------------------+
    Executing request completion options...
    Output file size:
    0
    +------------- 1) PRINT   -------------+
    Disabling requested Output Post Processing.  Nothing to process.  The output of the request is zero byte.
    +--------------------------------------+
    Finished executing request completion options.
    +---------------------------------------------------------------------------+
    Concurrent request completed successfully
    Current system time is 06-MAY-2013 05:05:56
    +---------------------------------------------------------------------------+After the concurrent program executed I queried the table xxc_temp and here you see the data
    SQL> select * from xxc_temp;
    CUSTOMER_NAME
    ORDERED_D ORDER_NUMBER ORDER_TYPE
    A. C. Networks
    18-FEB-13        66432 MixedMy procedure fetches the data fro given set of i/p parameters but it doesn't give o/p coz it's a host based conc program.Please advise if there's a way to get the o/p in a host based conc program
    Thanks!!

  • Calling sql through shell script

    How do i call a sql file through shell script in unix ?

    Rahul India wrote:
    export ORACLE_HOME=$ORACLE_BASE/product/10g
    cd $ORACLE_HOME
    set `sqlplus -s <SCHEMA_NAME>/<SCHEMA_PASSWORD> <<EOF
    @r_100.sql
    exit;   
    EOF`THIS SCRIPT IS OK?You'll also need to set ORACLE_SID
    And I don't know why everyone is putting the reference to sqlplus inside a "set" valuation, nor why they are putting the reference to the script in a redirected input stream. All you need is
    sqlplus -s user/password  @r_100.sqlAnd to insure the invironment is correctly set:
    export ORACLE_SID=whatever
    export ORAENV_ASK=NO
    . oraenv
    unset ORAENV_ASK=NO
    sqlplus -s user/password  @r_100.sql

  • Passing parameters to query called through a shell script

    I have a file called getInfo.sql that contains a query like:
    spool ./myInfo.txt
    select *
    from myTable
    where col1 = '&val1'
    and col2 = '&val2';
    spool off
    I would like to call SQLPLUS from a shell script and pass this file in as a parameter. How would I pass in the values for
    &val1 and &val2 ?
    Any help would be appreciated.
    Thanks
    Rajan

    Yes, you put a line in the script that looks like this:java classname parameter1 parameter2 parameter3 ...Then the JVM will call the static main(String[] args) method of "classname" and put those parameters into the "args" array.
    If you are asking how to generate such a script, or how to call it from your COBOL program, sorry, I don't know how to do that.

  • Sqlplus in Shell Script with startup pfile

    I have the following entry in my Korn shell script:
    ${ORACLE_HOME}/bin/sqlplus -s /nolog << EOSQL >> ${PR_LOG}
    connect / as sysdba
    whenever sqlerror exit sql.sqlcode;
    startup pfile "/u01/app/oracle/admin/${ORA_SID}/pfile/spfile${ORA_SID}.ora";
    EOSQL
    When I execute the script I get the following errors:
    LRM-00123: invalid character 0 found in the input file
    ORA-01078: failure in processing system parameters
    I've isolated the problem to the 4th line. When I change it to simply "startup", everything works. I did try changing the quotes to ` and ', but those didn't work. I even explicitly listed the ORA_SID, and I'm still getting the same error messages.
    Any ideas how I can resolve my problem with the 4th line? All help is appreciated.

    and yes I want to start the database with the spfile.
    If I just use "startup", everything is fine; and I can start the database with the spfile, because I have a symbolic link under $ORACLE_HOME/dbs to point to my actual spfile location - /u01/app/oracle/admin/salsa/pfile/So... what's the problem ? Just use "startup", if I'm not wrong you'd use the same spfile.
    To use that syntax you should create a file with a line like this
    spfile=<path of spfile>
    and start as
    startup pfile='<path of that file>'

  • Need Example on calling a unix shell script from oracle stored procedure

    Hi
    Can anybody give example on how to call unix shell script from an Oracle stored procedure. Please give a small example on how to do this .I need this urgently please.
    Have a nice time.
    Thanks & Regards
    Jogesh

    If you are on 10g you can also use DBMS_SCHEDULER. See Re: Excute Unix command Using PL SQL

Maybe you are looking for