Shiva,

 

Attached is an email from Ankur Shah from another posting - have not tried it myself but this may help.

 

Lewis Bishop

---

Barclays Enable - ISS - E-NTRUST/Bexleyheath NT

Oracle Database Consultant

Watling Street, Bexleyheath, Kent, DA6 7RR (Mail Van R)

Phone : 020 8298 3418

Mobile: 07950 380857

Email : [EMAIL PROTECTED]

"Enabling Competitive Advantage for Barclays in IT and Business Processing"

 

-----Original Message-----
From: Baswannappa, Shiva [mailto:[EMAIL PROTECTED]]
Sent: 05 December 2002 15:10
To: Multiple recipients of list ORACLE-L
Subject: Are There any way of calling NT OS Commands like print, del etc.

 

This header confirms that this email message has been swept for the
presence of computer viruses.

Corporate IT
THE WOOLWICH
----------------------------------------------------------------------

Hi Gurus

I am looking for easy of calling OS commands like print, del, etc. from PL/SQL on a NT4 system running Oracle 8.1.7. I tried the Java approach from oracle web site, it works for few commands and not all.

Any insight, direction and help to achieve is very much appreciated.

Thanks in advance

Regards

Shiva Baswannappa
Senior Developer
Digital Consulting and Software Services
Phone: 281.243.2658
Fax: 281.243.2504
Web: http://www.dcss.com

If the reader of this e-mail is not an intended recipient, you have received this e-mail in error and any review, dissemination, distribution or copying is strictly prohibited. If you have received this e-mail in error, please notify the sender immediately by return e-mail and permanently delete the copy you received. Thank you.

 

Sent: 30 September 2002 13:46
To: LazyDBA.com Discussion

This header confirms that this email message has been swept for the presence of 
computer viruses. 

Corporate IT
THE WOOLWICH
----------------------------------------------------------------------

Many tasks have been automated using shell scripting languages. Frequently, 
these shell scripts need to be called from an Oracle stored procedure, but no 
direct interface to call shell scripts is provided. Oracle does, however, 
provide a method for calling C and Java programs via external procedures. Since 
many shell programmers have never programmed in C or Java, converting shell 
scripts or writing new tasks in either of these languages is difficult and time 
consuming. 


This solution provides a C routine that will make OS calls, and these calls can 
be commands, shell scripts, or other application programs. Using this method, 
no C programming experience is required, but does allow existing and new tasks 
to be written as shell scripts.


This article does not provide information to setup the database or 
environment for external procedures. 

Refer to  How to Configure a UNIX Oracle Server to Use External Procedures  for 
information on setting up the Oracle Server machine.

 The external procedure is written in C and compiled with the Oracle 
makefile, and hence, an Oracle supported compiler for the specific UNIX 
platform is required. See Certified 
Compilers

>From the Oracle server machine:


1. Create a file for the external procedure code:


shell.c
=======

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

void sh(char *);

void sh( char  *cmd )

{
       int num;
       num = system(cmd);
}


2. Compile and link the C code into a shared library:

make -f $ORACLE_HOME/rdbms/demo/demo_rdbms.mk extproc_nocallback \

SHARED_LIBNAME=shell.so OBJS=shell.o

Log into SQL*Plus to perform the remaining steps.

3. Define the shared library in Oracle:

CREATE LIBRARY shell_lib IS '<full path to shared lib>/shell.so'; /

4. Create the PL/SQL wrapper procedure:

CREATE OR REPLACE PROCEDURE shell (cmd IN CHAR)

AS EXTERNAL

   NAME "sh"

   LIBRARY shell_lib

   LANGUAGE C

PARAMETERS (

    cmd STRING);

/

5. Call a shell script:

SQL> exec shell('sh myscript.sh');

PL/SQL procedure successfully completed.

===========================================================

HTHU

Ankur Shah
Oracle DBA
DHR-GA

----- Original Message ----- 
To: "LazyDBA.com Discussion" <[EMAIL PROTECTED]>
Sent: Monday, September 30, 2002 3:08 AM


But i want to call the shell script or the file from a stored procedure.


-----Original Message-----
Sent: Monday, September 30, 2002 12:33 PM
To: Dibyendu Kole-VP


there are cron jobs in unix, just like schedulers e.g. dbms_jobs in oracle. hope this 
would solve your problem.



--------
Oracle documentation is here: http://tahiti.oracle.com/pls/tahiti/tahiti.homepage
To unsubscribe: send a blank email to [EMAIL PROTECTED]
To subscribe:   send a blank email to [EMAIL PROTECTED]
Visit the list archive: http://www.LAZYDBA.com/odbareadmail.pl
Tell yer mates about http://www.farAwayJobs.com
By using this list you agree to these terms:http://www.lazydba.com/legal.html

Reply via email to