Solved

Run Oracle stored procedure from linux

Posted on 2014-02-06
4
1,178 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
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…
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 how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

757 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

17 Experts available now in Live!

Get 1:1 Help Now