Solved

Excecute sql scripts with SqlPlus in shell script

Posted on 2011-09-03
3
768 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 56

Assisted Solution

by:HainKurt
HainKurt earned 150 total points
ID: 36479407
add

/

or add

exit;
/
0
 
LVL 70

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

615 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