Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Running scripts on Windows from Oracle stored procedures
Phil
Thanks for that.
I suspected that java was the way to go.
One complication I do have is that some of the script to be run are on servers other than the database server.
I presume I could use some form of rsh/ssh to run them...but do you know of a better option?
-----Original Message-----
From: Phil Jones [mailto:phillipjones_at_gmail.com]
Sent: 26 January 2006 10:34
To: jdunn_at_sefas.com; oracle-l_at_freelists.org
Subject: Re: Running scripts on Windows from Oracle stored procedures
Hi,
You can do this using a Java stored procedure. Don't have the time to write a full class for you, but you'll want to begin with something like this:
CREATE OR REPLACE JAVA SOURCE NAMED "execProg" AS
import java.io.*;
public class execProg {
public static void execute(String prog) {
try {
String[] cmd = new String[2]; cmd[0] = "c:\\windows\\system32\\cmd.exe"; cmd[1] = prog; final Process proc = Runtime.getRuntime().exec(cmd);}
.. then you'll need to add a grant to allow the user to execute cmd.exe:
BEGIN
dbms_java.grant_permission('USERNAME','java.io.FilePermission','c:\\windows\
\system32\\cmd.exe','execute');
END;
/
Hope this is a good starting point for you. (Note: Completely untested!!)
Cheers,
Phil
On 26/01/06, John Dunn <jdunn_at_sefas.com> wrote:
> I have a requirement to run some scripts on Windows from Oracle 9 stored
> procedures. The stored procedures are written in PL/SQL although Java is
an
> option.
> The scripts will be .bat files or perl or python programs.
>
> >
> > >
-- http://www.freelists.org/webpage/oracle-lReceived on Thu Jan 26 2006 - 04:55:59 CST
![]() |
![]() |