After my researches about the methods to connect sqlplus and run an SQL command in a shell script, i wanted to share the results with you.

Here are two methods for this purpose:


DB_NAME=$($ORACLE_HOME/bin/sqlplus -s $username/$password << EOF!
select name from v$database;
echo $DB_NAME > name.log

LOCAL_SQL='select name from v$database;'
DB_NAME=`echo $LOCAL_SQL | $ORACLE_HOME/bin/sqlplus -s $username/$password`
echo $DB_NAME > name.log

Both two methods successfully bring SQL command's output to a file. Difference seems to be just syntax. But i'll be pleased if anyone has any experience on this and share with me.

5 Responses so far.

  1. Sravani says:

    Thank you for sharing such a nice and interesting blog with us. I have seen that all will say the same thing repeatedly. But in your blog, I had a chance to get some useful and unique information.

    Oracle Fusion HCM Online Training

  2. sushma says:

    Hey Really Thanks for sharing the best information regarding category, hope you will write more great blogs.
    Oracle Fusion Financials Online Training

  3. Naga says:

    Very interesting blog, keep posting such an informative post.

    Oracle Fusion Financials Online Training

  4. Thank you for sharing such a nice and interesting blog and really very helpful article

    Oracle Fusion SCM Online Training

  5. Awesome post. your article is really informative and helpful for me and other bloggers too

    oracle fusion financials online training

Powered by Blogger.

Page Views

- Copyright © Emre Baransel - Oracle Blog -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -