RE: Goofy Late Night Idea?

  • From: "Post, Ethan" <Ethan.Post@xxxxxx>
  • To: "Christian Antognini" <Christian.Antognini@xxxxxxxxxxxx>
  • Date: Fri, 28 Jan 2005 02:02:58 -0600

Can you ftp a file from the database (do a directory listing and a get)?


-----Original Message-----
From: Christian Antognini [mailto:Christian.Antognini@xxxxxxxxxxxx]=20
Sent: Friday, January 28, 2005 1:54 AM
To: Post, Ethan
Cc: oracle-l@xxxxxxxxxxxxx
Subject: RE: Goofy Late Night Idea?

Sorry... I post it again with the correct title...

>Let me get back to the idea that what I am striving for is simplicity.
>External tables are a great example of taking a need "interacting with=20
>data in files outside the database" and making it really simple.  I=20
>would love to see something like this...
>
>create ftp 'myftp' port 9000 default '/tmp/inbound'; grant all on myftp

>to scott; create table foo (x blob); alter table foo use myftp;
>
>presto! all of a sudden you get a couple java procs that are acting as=20
>ftp servers for the database and handling all requests coming into port

>9000.  Scott can ftp files into the database without requiring a OS=20
>login.
>
>Of course I will want some DD tables/views such as V$FTP_STATS etc...of

>course if Larry's vision of the database becoming the OS comes true=20
>then perhaps things really will be this simple.  I do see the beauty of

>that idea.
>
>My bet is the demos are as simple as that but I might be wrong!

Below a demo of what it's possible now (notice that I didn't perform any
installation or configuration before executing the following
statements). On my opinion non difficult at all...

- connect via SQL*Plus and create a view MYFTP

linux:oracle:A1010 /u00/app/oracle> sqlplus system/manager

[snip version information, in my case 10.1.0.3.0]

SQL> create or replace view myftp as
  2  select * from resource_view where under_path(res,'/public')>0;

View created.

SQL> select * from myftp;

no rows selected

SQL> exit

- connect via FTP to the database (authentication performed with DB
account), change directory and upload a file

linux:oracle:A1010 /u00/app/oracle> ftp linux 2100 Connected to
linux.cha.trivadis.com.
220 linux FTP Server (Oracle XML DB/Oracle Database 10g Enterprise
Edition Release 10.1.0.3.0 - Production) ready.
Name (linux:oracle): system
331 pass required for SYSTEM
Password:
230 SYSTEM logged in
Remote system type is Unix.
ftp> cd public
250 CWD Command successful
ftp> put /etc/oratab oratab
local: /etc/oratab remote: oratab
227 Entering Passive Mode (192,168,172,101,143,189) 150 ASCII Data
Connection
100% |*************************************|  1495       5.48 MB/s
--:-- ETA
226 ASCII Transfer Complete
1495 bytes sent in 00:00 (1.57 KB/s)
ftp> bye
221 QUIT Goodbye.

- connect via SQL*Plus and show the file uploaded in the database

linux:oracle:A1010 /u00/app/oracle> sqlplus system/manager

[snip version information, in my case 10.1.0.3.0]

SQL> select any_path from myftp;

ANY_PATH
------------------------------------------------------------------------
--------
/public/oratab

SQL> set long 100000
SQL> set pagesize 1000
SQL> select xdburitype(any_path).getclob() from myftp;

XDBURITYPE(ANY_PATH).GETCLOB()
------------------------------------------------------------------------
--------
#
# This file is used by ORACLE utilities.  It is created by root.sh # and
updated by the Database Configuration Assistant when creating # a
database.
# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home #
directory of the database respectively.  The third filed indicates # to
the dbstart utility that the database should , "Y", or should not, #
"N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
# *:/u00/app/oracle/product/10.1.0:N
# *:/u00/app/oracle/product/9.2.0:N
# *:/u00/app/oracle/product/9.0.1:N
# *:/u00/app/oracle/product/8.1.7:N
# *:/u00/app/oracle/product/gc:N
# *:/u00/app/oracle/product/agent:N
A1010:/u00/app/oracle/product/10.1.0:N
B1010:/u00/app/oracle/product/10.1.0:N
ASM1010:/u00/app/oracle/product/10.1.0:N
ASM1010S:/u00/app/oracle/product/10.1.0:N
A920:/u00/app/oracle/product/9.2.0:N
SA920:/u00/app/oracle/product/9.2.0:N
SC920:/u00/app/oracle/product/9.2.0:N
L920:/u00/app/oracle/product/9.2.0:N
A901:/u00/app/oracle/product/9.0.1:N
A817:/u00/app/oracle/product/8.1.7:N
+ASM:/u00/app/oracle/product/10.1.0:N
gc:/u00/app/oracle/product/gc:D
agent:/u00/app/oracle/product/agent:D
htmldb:/u00/app/oracle/product/htmldb:N
*:/u00/app/oracle/product/10.1.0:N

SQL> exit


--
//www.freelists.org/webpage/oracle-l

Other related posts: