Solved

Excecute sql scripts with SqlPlus in shell script

Posted on 2011-09-03
3
766 Views
Last Modified: 2012-05-12
I want to execute a sql script with SqlPlus in a shell script.  Something like this:

sqlplus usr/pwd@SID @../../procedures/insert_test.sql

This works and creates the procedure but ends with sqlplus still running:

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning option
Procedure created.

SQL>

How should this be done so that sqlplus closes after the procedure is created?
0
Comment
Question by:jkavx
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 51

Assisted Solution

by:Huseyin KAHRAMAN
Huseyin KAHRAMAN earned 150 total points
ID: 36479407
add

/

or add

exit;
/
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 350 total points
ID: 36479990
The other (non-traditional, more restricted) way is to just pipe the script in:
  sqlplus usr/pwd@SID < ../../procedures/insert_test.sql
0
 

Author Comment

by:jkavx
ID: 36480525
Thx.  I'm finding that piping the script in works.

 But I tried both / and exit; / and neither makes a difference.  The insert_test.sql itself ends with /.  I dont' know if that's a factor.
0

Featured Post

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
Shell script to create broker configuration file using current broker Configuration, solely for purpose of backup on Linux. Script may need to be modified depending on OS-installation. Please deploy and verify the script in a test environment.
This video explains at a high level with the mandatory Oracle Memory processes are as well as touching on some of the more common optional ones.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question