Home » Infrastructure » Unix » UTL_FILE on UNIX
UTL_FILE on UNIX [message #18809] Thu, 14 February 2002 23:14 Go to next message
mary
Messages: 19
Registered: November 1999
Junior Member
Im currently creating PL/SQL scripts to create a text file of records in certain tables in NT environment. I've done the setting of UTL_FILE directory in the DB server. does this works the same in UNIX? Also I need to make available the created text file in not in the DB server but in a separate application server also in UNIX. Have no experience on working in a UNIX environment. What should I do?
Re: UTL_FILE on UNIX [message #18818 is a reply to message #18809] Fri, 15 February 2002 09:31 Go to previous message
Grant
Messages: 578
Registered: January 2002
Senior Member
Yes it works the same way in unix. Make sure you set the directory protections to "chmod 777 utl_file_directory". Here is an FTP script you can call from your procedure (you will need to set up External Procedures on the server). The ORAPWD variable is cat'd in from a directory that only the Oracle user and root have access to.

#!/bin/ksh
#
# Script to use FTP using a file created dynamically.
# 3/15/01 Grant_howell
# Name: runftp
#
# Get the passwords.
ORAPWD=`cat $HOME/passwd/oracle`

# Create the file to receive commands for FTP.
echo "Begin FTP Script..."
echo "open SERVERNAME" > ftptmp.scr
echo "user oracle $ORAPWD" >> ftptmp.scr
echo "ascii" >> ftptmp.scr
echo "cd scripts" >> ftptmp.scr
echo "lcd DIRECTORY" >> ftptmp.scr
echo "put FILENAME" >> ftptmp.scr
echo "close" >> ftptmp.scr

# execute it
ftp -inv < ftptmp.scr
echo "END FTP Script..."
rm ftptmp.scr
Previous Topic: Re: ftp script
Next Topic: how to bind some IP to one NIC on Solaris
Goto Forum:
  


Current Time: Thu Mar 28 18:54:14 CDT 2024