Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 09-11-2011, 04:53 PM   #1
Registered: Oct 2006
Posts: 295

Rep: Reputation: 31
Run oracle form bash


I'm trying to run oracle sql statement form bash.

It's possible to run a oracle sentence with:

sqlplus user/pass@sid <<End
sentence 1
sentence 2
sentence 3

The problem is that it's a bit slow due to continues connections.

Is possible to open a oracle connection and redirect request with exec?

what I try is to open it with
exec 3<>/tmp/connection
sqplus user/pass@sid >&3

now I what to run my script and every time I want to do a request to Oracle, not to have to open the connection (it's already open), just redirect the input/output:
select * from dual; 0>&3

And receive the unanswered with
read result 1<&3

And finally do:
commit 0>&3
exec 3<&-

This is the idea, but don't know if is possible and the syntax I have to use with the redirectors of &3 (don't know how exec and &3 is used).

Old 09-11-2011, 08:40 PM   #2
Senior Member
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
It's probably not a good idea to leave connections hanging around, see if you can find a connection pooling app for oracle that's similar to pgpool for postgres - then you can just close your connections in the script but you benefit from previous connections if they're available.


bash scripting, oracle

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash dialog form multiple types metalenkist Programming 0 04-30-2009 10:03 AM
Bash Script: form $(< file) ? Jacky Quah Programming 4 10-28-2008 12:33 PM
anyone know how to get UT99 to run form the midway anthology? dasy2k1 Linux - Games 0 09-22-2007 06:27 PM
Script to get form bash? jrfly Linux - General 1 06-29-2005 10:04 AM
how to switch form bash to another shell slim27616 SUSE / openSUSE 1 02-06-2005 12:34 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:23 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration