Help - Search - Members - Calendar
Full Version: shellscript from stored procedure
Oracle DBA Forums > Oracle > Oracle Forum
bharathy
I want to call a shellscript which is in application sever through a stored procedure in database sever.
i dont do this by dbms scheduler.

May i knw some sytax with examples and the settings to change to accept the external procedure call.


Thanks
burleson
Hi,

>> I want to call a shellscript which is in application sever through a stored procedure in database sever.

No problem. Just remember that the shell script must connect to the database server vis a database link (named mydb) in this example:

CODE
#!/bin/ksh
# First, we must set the environment . . . .

ORACLE_SID=mon1

export ORACLE_SID

ORACLE_HOME=`cat /etc/oratab|grep ^$ORACLE_SID:|cut -f2 -d':'`

export ORACLE_HOME

PATH=$ORACLE_HOME/bin:$PATH

export PATH

$ORACLE_HOME/bin/sqlplus "system/manager@mydb"]system/manager@mydb<<!

spool myfile.txt
select * from v\$database;
exit
!


You can also rsh to the Oracle server if you are in a secure environment:

http://www.dba-oracle.com/t_script_loop_be...s_instances.htm

**********************************************
>> May i knw some sytax with examples and the settings to change to accept the external procedure call.

It's not a good idea to have scripts that you have not written yourself.

You can download many egeneric examples from th boook "Oracle Shell Scripting":

http://www.rampant-books.com/book_0701_shell_scripting.htm

Good Luck!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.