Solved

Excecute sql scripts with SqlPlus in shell script

Posted on 2011-09-03
3
763 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
3 Comments
 
LVL 51

Assisted Solution

by:HainKurt
HainKurt 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

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 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
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…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
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.

813 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now