Solved

Run Oracle stored procedure from linux

Posted on 2014-02-06
4
1,233 Views
Last Modified: 2014-02-06
I have a stored procedure that I need to run from linux, from the command line, through a script.  How can I do so?
0
Comment
Question by:newtoperlpgm
  • 2
4 Comments
 
LVL 73

Assisted Solution

by:sdstuber
sdstuber earned 200 total points
ID: 39840406
create a script like this...

exec procedure_owner.procedure_name(param1,param2);
exit

Open in new window



to execute the script

sqlplus username/password@yourdb  @your_script

Open in new window

0
 

Author Comment

by:newtoperlpgm
ID: 39840418
Don't I need to have a shell script or something of the sort setting the directories etc?
0
 
LVL 22

Accepted Solution

by:
Steve Wales earned 300 total points
ID: 39840432
You can call that from a shell script:

Something like this ?

#!/bin/bash
export ORACLE_HOME=/u01/app/product/11.2.0/dbhome_1
export ORACLE_SID=yourdb
export ORAENV_ASK=NO
export PATH=$PATH:/usr/local/bin

. /usr/local/bin/oraenv

$ORACLE_HOME/bin/sqlplus username/password@yourdb  @your_script

Open in new window


Setting ORACLE_SID isn't really necessary since ststuber declared the @yourdb in the call.

If you set ORACLE_SID in the script you don't need to specify @yourdb in the call.
0
 

Author Comment

by:newtoperlpgm
ID: 39840493
This is what I was looking for.  Thanks.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
scheduler for Procedure in DB with 3 arguments in 10g 7 33
Work with App store 7 51
Oracle SQL - Query help 7 54
having some issue on pl sql procedure 1 17
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 post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

776 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