The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
calling procedure from script scorpio Shell Programming and Scripting 3 05-26-2008 08:37 AM
Calling stored procedure from shell script dorisw Shell Programming and Scripting 3 06-12-2007 02:03 PM
DB2 stored procedure (with input parameters) from script mpang_ Shell Programming and Scripting 1 12-13-2006 04:12 AM
run shell script from oracle store procedure arnabb4u Shell Programming and Scripting 8 08-16-2006 09:16 AM
calling stored procedure from shell script. priyamurthy2005 Shell Programming and Scripting 2 04-21-2005 04:10 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-18-2002
Registered User
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
Unhappy Starting a script from a Database procedure

Hey guys,

I have this problem : I can run on an sqlprompt

!ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous

which will ftp the file from Unix to an NT machine, but if I do

exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING.

I have no .netrc file in my home directory and don't know how to build it, but I even don't know if this file is necessary for me ?

Can u please help ??????
Forum Sponsor
  #2 (permalink)  
Old 01-18-2002
Registered User
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
I've used this package and daemon process to execute system commands from the database, it worked for what I wanted. it may be worth lookin at. I needed to execute a shell script after some sql was triggered

hth

http://www.greatchinatelecom.com/card/oracle/14082.html
  #3 (permalink)  
Old 01-18-2002
Registered User
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
Thx edog !

But the problem is that it took already one month to let dba's and unix people set up the method with the shell procedure and next week we'll go in production already so I can't use your option (But I will definitely use it in a next project) !



by the way, here 's the code from the script I start


###############################################################################
# --------------
# Parm's control
# --------------
INPUTFILE=test.xml
DESTINATION=172.16.204.81
USERID=Anonymous
PASSWD=Anonymous
DIRECTORY=""
CHANGE_DIR='No'
# ---------------
# Execute the FTP
# ---------------
if [[ "$CHANGE_DIR" = "No" ]] ; then
ftp -n ${DESTINATION} >templog1$$ >>templog2$$ << EOF
user ${USERID} ${PASSWD} account
put ${INPUTFILE}
EOF
RCOD=$?
# ---
else
# ---
ftp -n ${DESTINATION} >templog1$$ >>templog2$$ << EOF
user ${USERID} ${PASSWD} account
cd ${DIRECTORY}
put ${INPUTFILE}
EOF
RCOD=$?
fi
# --> Save return code
RCOD=$?
# --> Remove logs file (to comment for debug)
rm templog1$$ templog2$$
# --> check FTP run
if [ $RCOD -ne 0 ] ; then
echo "ERROR: Load of file $INPUTFILE crash with error $RCOD"
exit 2
fi
# ---------------------
# Now it's time to exit
# ---------------------
exit $RCOD
__________________
PVDB
Oracle Developer
  #4 (permalink)  
Old 01-18-2002
Registered User
 

Join Date: Sep 2001
Location: Green Bay, WI
Posts: 66
exec shell('sh ftp_file2.ksh test.xml 172.16.204.81 Anonymous Anonymous') it does NOTHING.



what does your sql procedure, 'shell' look like? I assume its a custom procedure, maybe if you enter the full path of the ksh script, but I'd need to see the procedure venture any other guesses.

when you execute it from sqlplus your .profile probably has the path to ftp_file2.ksh or you were in that directory when you started sqklplus, but from a sql procedure there is no profile to find the script? just a thought
  #5 (permalink)  
Old 01-21-2002
Registered User
 

Join Date: Nov 2001
Location: Belgium
Posts: 6
(sorry for the delay - just passed the weekend) :-)

The shell procedure :

procedure shell (cmd IN CHAR)
as external
name "sh"
library shell_lib
language C
parameters (cmd string);

This is just the standard one provided by Oracle.

That from the .profile is right i gess because
!ftp_file.ksh is executed on the unix prompt
while
exec shell('...'); goes through the Listener.

I did send the system people the procedure to setup the listener - maybe they just have forgotten. Anyway, i did send them a mail about that.
__________________
PVDB
Oracle Developer
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:23 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0