A reader, February 21, 2007 - 2:53 pm UTC
Hopefully in future releases Oracle enhances dbms_file_transfer package to transfer no database files as well.
Unload ref_cursor to .csv by FTP
Chris Poole, February 21, 2007 - 6:13 pm UTC
OK shameless plug coming up but it does directly answer the posters question, the easy way to dump a query to an FTP server is:
declare
handle xutl_ftp.session_handle;
dumpquery sys_refcursor;
begin
handle := xutl_ftp.start_session('remote_host', 'username', 'password');
open dumpquery
for select
to_char(empno)||','||
ename||','||
job||','||
to_char(mgr)||','||
to_char(hiredate)||','||
to_char(sal)||','||
to_char(comm)||','||
to_char(deptno)
from scott.emp;
-- pass our query to the ftp server to store
-- we have to specify the filename as cursors don't have a filename associated with them!
xutl_ftp.put(handle, dumpquery, 'scott_emp.txt');
xutl_ftp.end_session(handle);
end;
This unloads the query straight into a text file on any FTP server. No intermediate file required.
http://www.chrispoole.co.uk/apps/xutlftp.htm HTH
Chris
A reader, February 21, 2007 - 9:16 pm UTC
Chris,
If you make package body code(xutl_ftp) available to the users that will be great
Transfering File from Unix server to local windows machine
Debasish, March 22, 2007 - 7:51 am UTC
Hi Tom
thanks for advance, Please let me know how could i transfer a txt file from unix server to local windows machine.
actully at runtime from report I am sending the output to a text file. which is save into unix server but I am unable to print that file from that location for that I am trying to copy that file from remote unix server to local windows machine so I can print tha .TXT file.
March 22, 2007 - 9:42 am UTC
you would write a program....
or use a mount (shared filesystem)
or an existing program like ftp
or a web server to serve the file to a program that already exists (a browser)
I tried Chris's xutlftp
Kurt Look, March 22, 2007 - 11:14 pm UTC
I tried the FTP package Chris mentioned above
(
http://www.chrispoole.co.uk/apps/xutlftp.htm ). It works really well. It is easy to install and the examples work as advertised, so I was productive with the package in no time. I had some questions and Chris has been very responsive. He's got a very nice offering for the community. I'd recommend it. By the way, I don't know Chris at all, so I'm praising his package on the merits.
Kurt
Shell Script for backup details updation
Surya, November 03, 2017 - 9:32 am UTC
Hi,
I am having a requirement. Can you please help me on how to achieve that - as I am pretty new to shell scripting.
My requirement is - I need to gather the backup details and need to save those backup details in a table which is residing on the other server. I had achieved reaching the other server. But after reaching there, its not connecting to the schema where I need to insert this backup information into a table. I am trying this through a shell script. But its not responding properly. Can you help me?
November 06, 2017 - 1:12 am UTC
Perhaps look at at external table where the pre-processor option actually runs your shell script.
So then the standard output from your shell becomes the rows in your external table. Then you can query that, append it to a clob, and store it.