Sponsored Content
Top Forums Shell Programming and Scripting code to FTP the spool file from Sqlplus to the unix server. Post 302143192 by vprevin on Wednesday 31st of October 2007 02:48:26 AM
Old 10-31-2007
code to FTP the spool file from Sqlplus to the unix server.

I have a sqlplus report and inside that report I have the following piece of code to mail the report output to the email id.

My requirement is, instead of emailing the output I want to FTP that script to a different unix server (say ip as 10.10.1.1). How to modify this code to FTP the spool file to the unix server.

IF :g_email_to IS NOT NULL THEN
SELECT name INTO :g_dbname FROM v$database;
:g_host_cmd := 'echo "sending email ..."; sync; sync; sync; '||'uuencode '||:g_spool_file||' '||:g_attach_file
||' | mailx -r "oraclefinancials_'||:g_dbname||'"';
:g_host_cmd2 := 'cat '||:g_spool_file||' >> '||:g_outfile;

IF :g_prog_title IS NOT NULL THEN
IF instr(:g_prog_title,' ') > 0 THEN
v_quote := '''';
ELSE
v_quote := NULL;
END IF;
:g_host_cmd := :g_host_cmd||' -s '||v_quote||:g_prog_title||v_quote;
END IF;

IF instr(:g_email_to,' ') > 0 THEN
v_quote := '''';
ELSE
v_quote := NULL;
END IF;
:g_host_cmd := :g_host_cmd||' '||v_quote||:g_email_to||v_quote||'; echo done';
ELSE
:g_spool_file := NULL;
:g_host_cmd := 'exit';
:g_host_cmd2 := 'exit';
END IF;
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP script for sending a file from one unix directory to another unix server director

Hi, My local server is :/usr/abcd/ Remote server is :/Usr/host/test/ I want to send files from local unix directory(All files starting with O_999) to remote host unix directory. Can any body give me the Unix Shell script to do this. One more doubt: Shall we need to change the file... (1 Reply)
Discussion started by: raja_1234
1 Replies

2. Shell Programming and Scripting

Script needed to FTP a file from sql report to unix server

Hi All, I have a Sqlplus report which will create a file. I need a FTP Script that will be executed inside the Sqlplus Report to FTP the report output file to unix server. Thanks, Previn (0 Replies)
Discussion started by: vprevin
0 Replies

3. Shell Programming and Scripting

how to spool a unix file

hi, can anyone help me by saying how can i spool a unix file.. do we need to specify the pathname as such to spool the file .. right now, i tried giving like spool filename in the sql prompt.. but its not giving me the required output even if i can see that the command is being executed.. ... (2 Replies)
Discussion started by: kripssmart
2 Replies

4. UNIX for Dummies Questions & Answers

SQLPlus spool file

HI Have some problem with spooling out some relatively large number of records (~2-3 mil) Small table - OK though. Getting error: SP2 0308: cannot close spool file. Any thoughts? sqlplus -s user/pwd << EOF set term off set head off set trims on set pages 0 set... (1 Reply)
Discussion started by: Leo_NN
1 Replies

5. Shell Programming and Scripting

how to FTP a file from the local folder to unix server

Hi All, please help me to write a shell that ftp a file which is in the local (C:\) drive to a Unix server. Where as i know the IP for the Unix server. i could do this process by using ftp command. pls help me to write as Shell script. Thanks in advance for all of your answers.:b::b: (3 Replies)
Discussion started by: little_wonder
3 Replies

6. Shell Programming and Scripting

Help supressing spool output from screen when calling sqlplus from script

I'm calling an embedded sql from my shell script file. This sql does simple task of spooling out the contents of the table (see below my sample code) into a spool file that I specify. So far so good, but the problem is that the output is also displayed on screen which I do NOT want. How can I... (3 Replies)
Discussion started by: MxC
3 Replies

7. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

8. Shell Programming and Scripting

Need help for ftp a file from unix to windows server

I have a problem with ftp. i want to ftp a file "file.txt" from unix box to windows server. The destination folder is something like this: "\\windowsservername\apps\is\" FTPUSER=ftp1 FTPPASS=**** ftp -v -d -n > ftplog <<!EOF open windowsservername user $FTPUSER $FTPASS cd... (3 Replies)
Discussion started by: Diddy
3 Replies

9. Shell Programming and Scripting

Need to FTP a file from Dev to Tst inside UNIX server

Hi I have a requirement that need to ftp a file from 10.192.36.203(dev) to 10.192.36.36 (tst) ,need to write a shell script for that .Plz help Thanks in advance. (1 Reply)
Discussion started by: sandqwerty
1 Replies

10. Shell Programming and Scripting

Update/Download file from FTP server to UNIX Server

HI Guys, I want to download files from FTP Server to my Unix server. I have tried , buy No Luck . Below Command i have tried. 1-Wget - Error "wget' not found" 2.ftp -n $HOST ...Not Working. 3.scp -i ftp://user:passowrd@hostname:21/ran/on/test.txt Any Suggestion (2 Replies)
Discussion started by: pareshkp
2 Replies
END(7)								   SQL Commands 							    END(7)

NAME
END - commit the current transaction SYNOPSIS
END [ WORK | TRANSACTION ] DESCRIPTION
END commits the current transaction. All changes made by the transaction become visible to others and are guaranteed to be durable if a crash occurs. This command is a PostgreSQL extension that is equivalent to COMMIT [commit(7)]. PARAMETERS
WORK TRANSACTION Optional key words. They have no effect. NOTES
Use ROLLBACK [rollback(7)] to abort a transaction. Issuing END when not inside a transaction does no harm, but it will provoke a warning message. EXAMPLES
To commit the current transaction and make all changes permanent: END; COMPATIBILITY
END is a PostgreSQL extension that provides functionality equivalent to COMMIT [commit(7)], which is specified in the SQL standard. SEE ALSO
BEGIN [begin(7)], COMMIT [commit(7)], ROLLBACK [rollback(7)] SQL - Language Statements 2010-05-14 END(7)
All times are GMT -4. The time now is 09:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy