Can we not run 2 sqlplus programs in a shell script ?

Hi
I have 2 spool programs which need to be called from a shell script .
When i try to do it , only the first spool program runs but not the second one . Is their any reason ?
#!/usr/bin/bash
ORACLE_HOME=/oracle10g/product/10.2.0/client_1
export ORACLE_HOME
sqlplus -s abcdata/daddy@DevOra < lit_fac.sh > output.log 2>&1
sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh . output_cat.log 2>&1
exit
How to run 2 scripts containing select queries each from sqlplus in another shell script ?
Thanks in advance ..

user8703472 wrote:
Hi
I have 2 spool programs which need to be called from a shell script .
When i try to do it , only the first spool program runs but not the second one . Is their any reason ?
#!/usr/bin/bash
ORACLE_HOME=/oracle10g/product/10.2.0/client_1
export ORACLE_HOME
sqlplus -s abcdata/daddy@DevOra < lit_fac.sh > output.log 2>&1
sqlplus -s abcdata/daddy@DevOra < lit_fac_cat.sh . output_cat.log 2>&1
exit
How to run 2 scripts containing select queries each from sqlplus in another shell script ?
Thanks in advance ..As I said before .. the term "spool program" has no meaning in Oracle and only serves to cloud the issue. I know you are used to using this term with other products, but "When in Rome ...."
As for your example above, why are you using what appears to be a unix shell script as redirected input into sqlplus? And in the second line, what's with the dot (".") between "lit_fac_cat.sh" and "output_cat.log"?
If these .sh files are really sql files (which is the only thing sqlplus know how to process) then the proper things to do are
1) name them lit_fac.sql and lit_fac_cat.sql
2) feed them to sqlplus in the standard, documented manner:
sqlplus -s abcdata/daddy@DevOra @lit_fac.sql

Similar Messages

  • A cloud membership is preventing me from using photoshop cs6.  Can I not run it without cc?

    A cloud membership is preventing me from using photoshop cs6.  Can I not run it without creative cloud?
    Thank you.
    D. Bowers

    Hello Mr. Bowers,
    Welcome to Adobe Community.
    Could you please let me know what issue are you facing while using the Photoshop CS6 app?
    Also, please share the email address under which you have the cloud membership, in a private message, so that I may check the status of the subscription at my end.
    Regards,
    Devika S.

  • What is shell scripting? get me notes of that... how shell script is relate

    what is shell scripting? get me notes of that... how shell scripting is related to sql or plsql?

    shell scripting is the process of creating programs which are able to execute using a shell.
    a shell is the program you use when you are logged in to a linux (or unix) system via ssh (or if you are outdated by 10 years: telnet).
    there are much shells, traditionally, unix system use the bourne shell (visible as sh most of the time), the kornshell (ksh) and c-shell (csh) extended the bourne shell functionality. nowadays there are very much shells, most linux systems use the bourne again shell (bash). the bash shell is available for most linux/unix systems, I always advise to use it on any system, so the shell functions the same on all platforms.
    if you want to know more about shell scripting, use "google". the website of google is http://www.google.com, and usage is free. use the keywords "bash shell scripting".

  • I Can not run sqlplus

    Hi dear....
    Help me please.....
    i have been successful installed oracle database 11g release 2 in Ubuntu 9.10
    but when i try to run sqlplus i can't. the computer say that me mus copy ...<lang> file, into oracle_home
    but still error....
    how to fix it???

    user9200726 wrote:
    Set these variables need manual write? Why the setup program cannot configure it automatically?Because you may have multiple possibilities for ORACLE_HOME and/or ORACLE_SID. They have to be set specifically for a given process environment. The setup program has no way of knowing.

  • After compile can not run the program

    package MyPack;
    class Balance
    String name;
    double bal;
    Balance(String n,double b)
    name=n;
    bal=b;
    void show()
    if(bal<0)
    System.out.println("--->");
    System.out.println(name+" " +bal);
    class Account
    public static void main(String args[])
    Balance current[] = new Balance[3];
    current[0]= new Balance("xxx", 2500);
    current[1]= new Balance("yyy", 1500);
    current[2]= new Balance("zzz", 3500);
    for(int i=0;i<3;i++)
    current.show();
    here i have written a program on using package after complieing this program, and run this program i get the error of file not found. can u please gide to run this program.

    after writing this program i saved in the folder c:\MyPack\ and run the program from the same folder by using this command first by javac Accounts.java. then, java MyPack.Accounts and i get this error
    exception in thread "main" java.lang. No ClassDefFoundError:MyPack/Accounts. even though i made sure i have the java class file in the same folder.

  • Compile correct but not run java programs

    I have problem. Java program copile correctly but not run. I can't understand this one.
    **this is the error**
    Exception in thread "main" java.lang.NoClassDefFoundError: suminda
    Caused by: java.lang.ClassNotFoundException: suminda
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Could not find the main class: suminda. Program will exit.

    The error is telling you that the jvm could not find a class named suminda. Are you aware that class names are case sensitive? Suminda is not the same as suminda for example.
    This error usually happens when you haven't specified the classpath correctly. A simple thing to try isjava -cp  .  sumindaHere's some links that may help.
    [http://www.kevinboone.com/classpath.html]
    [http://java.sun.com/javase/6/docs/technotes/tools/findingclasses.html]

  • Can a MaC run these programs

    I need these progrmas for work so I was wondering if I can run these programs before i go out and purchase a MacPro...the first one is DocMaster and the next is a file format and its a .PRN file...does mac support these items? hope to hear from anyone soon...would really help me make my decision...
    MACbookPro   Mac OS X (10.4.5)  

    Google is your friend! :-P
    There seem to be multiple apps called DocMaster, and they are all Windows-specific:
    http://www.docmagic.com/download/docmaster.jsp
    http://www.stratussoftware.com/docmastermain.html
    http://www.omnisys.co.il/itsolutions/main.asp?lngCategoryid=1930
    .prn is a Windows-specific file format for printing purposes, basically what you get when doing a 'print to file' on /Windows. Unlike PostScript (.ps) or PDF it's not cross-platform.
    http://www.frogmorecs.com/arts/whatis_a_prnfile.html
    So, no.
    Ian

  • CPU is constantly full, but I'm not running any programs

    According to the Activity Monitor, my CPU is always being used at 100% capacity. Of this, 89%-99% of it is supposedly being used constantly by the user. There is no idle CPU space according to the Activity Monitor. The problem is, I'm not running a single major program (outside of the automatic programs the Mac always runs).
    This CPU usage makes my fan go for hours and hours and the computer's temperature is running very hot. The computer also is acting slightly slow.
    Any suggestions on how to fix this? Thanks in advance.

    Dear Caleb,
    I had a similar problem. My solution may or may not work for you, but it is worth a look. Crank up Activity monitor (Utilities). See if there is a process that can't be accounted for while everything else is off. They have undecipherable names so you may need help of a nerdy friend. The System itself shouldn't be using more than 10-15 percent with nothing going on.
    Hint: If you see a suspect process click on the Blue "i" that will open a window. Look at "Parent Process" That will give you the name in English
    In my case, The Adobe Reader Updater, AddressbookSync, Main Menu, and Ical Alarm scheduler were all eating my CPU while doing nothing. Adobe Updater, and addressbookSync must be hunted down and thrown out or it will return. Check your Login Items (Accounts) in System Preferences. If there are programs that start up automatically(listed under Login Items).Delete them one by one and restart and check the Activity Monitor to see if things are better.
    Hint#2: Look for items you didn't put in or don't recognize.
    I hope this helps.

  • [b]Can't not run the Oracle Universal Installer (Oracle8.1.7 for Linux) on

    I have a problem when try to install Oracle8i Release 8.1.7 Enterprise Edition on RedHat Linux 7.3. After I do the pre-installation tasks, i enter the command (runs as the oracle user):
    $ /tmp/Disk1/runInstaller
    I wait for the one minute and then nothing is happen. I don't understand the reason why the Oracle Universal Installer can't not display! Please tell me all reasons may be!

    Sorry the Oracle version should be 1.7 not 1.1.7. I downloaded it from the web site. The JRE I downloaded is jre 1.18 because the installer asked for this version.
    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Bin Yao ([email protected]):
    I have a problem to install Oracle8 1.1.7 for linux on Mandrake. When I run ./runIstaller I got a error message that the Java RunTime Enviroment was not found at ?/bin/jre. The "?"stands for a strange character and may change at diffrent time runing the installer. I downloaded a JRE from blackdown and make a link to /usr/local/jre and I also tried to make link to the JRE shiped with Oracle8 1.1.7. But I still get same error. Does Oracle8 1.1.7 still need JRE downloaded and insatll(or link) to /usr/local/jre? I don't know what else I can try. Please give me a help. Thanks.<HR></BLOCKQUOTE>
    null

  • Can Firefox NOT run ads? It slows everything down on my old laptop. This feature used to be an option.

    When opening a we page, several active ads start execution, and the response to mouse clicks and arrow movements is severely attenuated. Firefox of old had an option to not run scripts, I think more than once, and this would give my old slower CP a break and allow useful controls again. Possible to re-implement?? I hope??

    AdblockPlus <br />
    https://addons.mozilla.org/firefox/1865/ <br />
    Also, read this: <br />
    http://adblockplus.org/en/getting_started

  • How to test oracle is up and running in remote machine using shell script

    Hello,
    I need help to write an linux script.
    I have a java application server running on machine 192.168.5.20 and our oracle 10g standard 1.0.2 is running on machine 192.168.5.21.
    I have found script to start oracle when computer is turned on.
    But I cannot start my application server automatically since it depends on whether oracle is up and running or not on the remote machine.
    Therefore, in case of power failure or maintenance, our client has to call us to start application server.
    I would be grateful if someone can help me "How can I write script to check oracle is up and running in machine 192.168.5.21 from machine 192.168.5.20.
    For your information, I have no oracle installed in application server. So tnsping won't work.
    What I want is when power is back, application server script automatically and tesing for oracle server is up and running. If it is up, script will start application server.
    Thanking you.

    Hi,
    It's not failover or experimental. My application server uses JBOSS and JBOSS needs database name to start up. My enviroment is LAN. My database is in different machine as I mentioned before. So In case of power failure, I need to start my application server (JBoss) manually, because I need to confirm that oracle is already running before start app server.
    I want an automated script (when power is just on) to start my application server which will wait to check if the datbase server is up I will start application server.
    The scripts given above It works if appserver and db server in the same machine (my development machine).
    But when I test the script in my production applicaiton server, It shows sqlplus command not found (my app server does not have any oracle client installed).
    About hostname yes My applicaiton server hostname is hostapp1 and dabase server hostname is hostdat1.
    Do you think Is it possible to test the script without oracle client not installed. or It has to be done writing code like java program and test using jdbc connection.
    Best regards.

  • How Can i get PLSQL Procedure out values in Shell Script?

    Hi,
    I need to use PLSQL Procedure out values in shell script by using that parameter i need to check and call the other procedure. Please can you guide me how can i?
    #!/bin/ksh
    # Function to call validation program
    SQL_PKG_CALL()
    echo "Inside SQL_PKG_CALL for $file"
    sqlplus -s /nolog << EOF
         whenever sqlerror exit failure
         connect ${APPS_LOGIN}
         variable exit_value NUMBER
         set serveroutput on size 100000
         DECLARE
              l_errbuf VARCHAR2(10000) := NULL; l_retcode NUMBER := NULL;lv_test VARCHAR2(4000) := NULL;
         BEGIN
              fnd_global.apps_initialize ( USER_ID => ${USER_ID}, RESP_ID => ${RESP_ID}, RESP_APPL_ID => ${RESP_APPL_ID}
                             , SECURITY_GROUP_ID => ${SECURITY_GROUP_ID}
              #Calling PLSQL procedure for create and attache document
              XXAFPEEP_SO_DOC_ATTACH_INT.DOCUMENT_ATTACH (p_errbuf => l_errbuf, p_retcode => :RETMSG, p_fileName => $file
                                       , p_debug => 'Y', p_rettest => lv_test);
              # to print the procedure return values
              DBMS_OUT.PUT_LINE('Return Message: '|| lv_test);
              #${RETCODE}=l_retcode;
              print :RETMSG;
         END;
    EXIT 0
    EOF
    # Program starts here
    echo "+---------------------------------------------------------------------------+"
    echo "Program Start"
    APPS_LOGIN=${1} # Apps Login
    USER_ID=${2} # User ID
    RESP_ID=${5} # Responsiblity ID
    RESP_APPL_ID=${6} # Responsiblity Application ID
    SECURITY_GROUP_ID=${7} # Security Group ID
    DIRECTORY_PATH=${8} # Directory --Attached file locations
    DIRECTORY_NAME=${9} # Directory Name for plsql
    echo "User ID : $USER_ID"
    echo "Responsibility ID : $RESP_ID"
    echo "Responsibilith Application ID : $RESP_APPL_ID"
    echo "Security Goup ID : $SECURITY_GROUP_ID"
    echo "Directory Path : $DIRECTORY_PATH"
    echo "Direcotry Name : $DIRECTORY_NAME"
    echo
    #files direcotry
    cd $DIRECTORY_PATH
    echo Present Working Directory: `pwd`
    echo
    #for all file names
    ALL_FILES=`ls *.pdf`
    for file in $ALL_FILES
    do
         if [ -f $file ]
         then
              #log "Processing $file" # future
              echo Processing: $file
              # Calling the PL/SQL Program
              SQL_PKG_CALL;
              #echo "Retcode : $RETCODE"
              echo "RetMessage : $RETMSG"
         else
              log "Skipped $file: invalid file"
              echo "Skipping current file $file: not a valid file."
         fi
    done
    Thanks
    Sudheer

    Saubhik's provided the solution, but just for fun:
    Test procedure:
    create or replace procedure get_ename
       ( p_empno in emp.empno%type
       , p_ename_out out emp.ename%type )
    is
    begin
       select ename into p_ename_out
       from   emp
       where  empno = p_empno;
    end get_ename;Test data:
    SQL> select empno, ename from emp order by 1;
    EMPNO ENAME
    7369 SMITH
    7499 ALLEN
    7521 WARD
    7566 JONES
    7654 MARTIN
    7698 BLAKE
    7782 CLARK
    7788 SCOTT
    7839 KING
    7844 TURNER
    7876 ADAMS
    7900 JAMES
    7902 FORD
    7934 MILLER
    14 rows selectedTest call from SQL*Plus to show it working:
    SQL> declare
      2     v_ename emp.ename%type;
      3  begin
      4     get_ename(7844,v_ename);
      5     dbms_output.put_line(v_ename);
      6  end;
      7  /
    TURNER
    PL/SQL procedure successfully completed.Demo shellscript (borrowing the function idea from Saubhik):
    #!/bin/ksh
    empno=${1:-NULL}
    exec_sql() {
        sqlplus -s william/w@//vm.starbase.local:1521/eleven <<END_SQL
        spool get_out_value.sh.log
        set serverout on size 2000 feedback off
        declare
           v_name emp.ename%type;
        begin
           get_ename(${empno},v_name);        
           dbms_output.put_line('# ' || v_name);
        end;
        spool off
        exit
    END_SQL
    ename=$(exec_sql ${empno} | awk '/^# / {print $2}')
    print Employee ${empno} = ${ename}Demo:
    /Users/williamr: get_out_value.sh 7844
    Employee 7844 = TURNER
    /Users/williamr: get_out_value.sh    
    Employee NULL =Note this substitutes the word NULL if no empno is passed, and it ignores error output or anything else by only looking for lines beginning '# ' and then taking the following word. Error messages will appear in the logfile. (In this example it probably doesn't need the NULL substitution because a missing parameter would cause a syntax error which the script will handle anyway, but it could be useful in more complex examples.)
    For a production script you should probably use an OS authenticated account so you don't have to deal with password strings.

  • ABAP program to execute shell script !

    Hi Friends,
    I have created some shell scripts and need to be executed through ABAP prog in order to automate some process. can any one tell me how to execute these scripts through ABAP program? i know that we have to setup those scripts through SM69 but i dont have clear idea about this.can some one tell me step by step how to do this. ur help will be awarded in terms of points.
    Thanks

    Define the scripts as commands in SM69. Test them in SM69/SM49 to see if they work.
    Next, go to SE37, run FM SXPG_COMMAND_EXECUTE, and specify your command there. Does it work?
    If yes, you can just code a 'CALL FUNCTION' to this FM in your ABAP program, and you are ready to invoke your script from your ABAP.
    For  a list of functions that work with commands (defined in SM69), do a drop-down on SXPG_COMMAND* in SE37.
    A sample code may look like this
    concatenate zsys_id z_infile z_extfile into parm
        separated by space.
    *C_FTP_COMMAND is a script defined in SM49
        CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
          EXPORTING
            COMMANDNAME                   = C_FTP_COMMAND
            ADDITIONAL_PARAMETERS         = parm
            OPERATINGSYSTEM               = SY-OPSYS
          TABLES
            EXEC_PROTOCOL                 = PROT
          EXCEPTIONS
            NO_PERMISSION                 = 1
            COMMAND_NOT_FOUND             = 2
            PARAMETERS_TOO_LONG           = 3
            SECURITY_RISK                 = 4
            WRONG_CHECK_CALL_INTERFACE    = 5
            PROGRAM_START_ERROR           = 6
            PROGRAM_TERMINATION_ERROR     = 7
            X_ERROR                       = 8
            PARAMETER_EXPECTED            = 9
            TOO_MANY_PARAMETERS           = 10
            ILLEGAL_COMMAND               = 11
            WRONG_ASYNCHRONOUS_PARAMETERS = 12
            CANT_ENQ_TBTCO_ENTRY          = 13
            JOBCOUNT_GENERATION_ERROR     = 14
            OTHERS                        = 15.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        else.
          write: /, 'FTP Function module executed with no errors.'.
        ENDIF.

  • Automator: running forever after executing a shell script?

    Hi,
    so i have found this little automator workflow that will start MAMP's Apache & MYSQL servers automatically (saved workflow as app then put into my login item autostart) however the script just keeps running forever and never exits (which should prompt a small Growl notification as feedback.
    The Script:
    <pre class="jive-pre" style="white-space:pre-wrap;width:585px;">
    on run {input, parameters}
    *do shell script* "/Applications/MAMP/Library/bin/apachectl start" password "my_password" user name "jannis" with administrator privileges
    *do shell script* "/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lowercase_tablenames=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysqlerrorlog &"
    *do shell script* "exit 0"
    return input
    end run
    </pre>
    This is what shows when it runs:
    Any ideas on what I am doing wrong for it to just keep spinning the little cog wheel and not exiting?
    PS: Both services are being started successfully! So the shell scripts seem to be run and doing their job just fine, just that they do not exit.
    Thanks for looking.
    Jannis

    This is a common question with do shell script. The issue is that mysqld_safe doesn't exit until MySQL shuts down, so your do shell script is hanging around waiting, essentially hanging your workflow.
    The solution is to redirect the stdout and stderr of the mysqld_safe command to a temp file. This releases the hooks that do shell script has on the command allowing the workflow to continue. To do this, just append '> /dev/null 2>&1' to the end of the shell command, like:
    do shell script "/Applications/MAMP/Library/bin/mysqld_safe --port=3306 --socket=/Applications/MAMP/tmp/mysql/mysql.sock --lowercase_tablenames=0 --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid --log-error=/Applications/MAMP/logs/mysqlerrorlog >/dev/null 2>&1 &"
    As an aside:
    do shell script "exit 0"
    This line is worthless. I'm not sure what you're trying to achieve here

  • Invoking a java program from a shell script!

    Can this be done?
    Ive written a simple compiler for the language buru which just reads/parses and then executes a file for this java like language. But what Im wondering is if I can write a shell script something like this
    #!/bin/bash
    java Interpreter one.buru
    this isn't working so its not correct but if someone knows how to do so there are duke dollars going for it Cheers :)

    The most likely reason is that java is not finding your class.
    That is probably because when you execute the script the "working directory" is not in a location that works with your class path.
    You should be able to find the working directory and class path with the following commands (or some variation of them) added to the beginning of your script.
    cd
    echo $CLASSPATH

Maybe you are looking for