Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Execute Unix command

Re: Execute Unix command

From: Tom Zamani <tomz_at_redflex.com.au>
Date: Tue, 21 Mar 2000 16:17:39 +1100
Message-ID: <8b713v$2q1$1@perki.connect.com.au>


Benoit,
In order to call a Unix Command, You need to use External procedure Call. You need to write a C function which calls sysem, the command is the parameter which you pass to it.
compile the c function and then create a shared object I think (ld -G My_fun.c -o My_fun.so)
then in oracl you need to create a library

create library shell_lib as full path to the shared object shell_lib is only a name.

then tou need to write a wrapper function in plsql something like this

create or replace Function SYSRUN
  ( syscomm IN varchar2)
  RETURN binary_integer AS external
    LANGUAGE C
    NAME "sysrun"
    LIBRARY shell_lib;

in the above function sysrun is the actual c function which call unix.

you also must configuer the DB for external procedurte call. there will be another listener which is only used for external calls by oracle.

It will take a bit of time to do this but, it is very power full, and allows you to control lots of operations from database. send mail, ftp, etc
Well Good luck.
Tom

BENOIT DELPLACE <b.delplace_at_free.fr> wrote in message news:s_vB4.792$4S3.3481763_at_nnrp2.proxad.net...
> Hello,
>
> How can I execute a Unix system command from a Oracle 8 stored procedure?
>
> Thanks
>
> BD
>
> Ps : Sorry for my poor english, but i'm french !!!
> Ps 1 : A stored procedure with the unix command in argument will be better
>
>
>
>
Received on Mon Mar 20 2000 - 23:17:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US