DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Execute O/s command from Oracle

  1. #1
    Join Date
    Jun 2001

    Execute O/s command from Oracle

    Hi All,
    I want to know is there any dbms package available in Oracle to execute o/s commands from database procedures.


  2. #2
    Join Date
    Jan 2002
    Up s**t creek
    I think you'll need to create a java or c external procedure


    Oracle Certified Professional
    "Build your reputation by helping other people build theirs."

    "Sarcasm may be the lowest form of wit but its still funny"

    Click HERE to vist my website!

  3. #3
    Join Date
    May 2003
    York, UK
    Did a search on google and found this at http://www.experts-exchange.com/Data..._20433300.html

    "Host commands are not directly supported in PL\SQL stored procedures. But there are three work-arounds that you can use to do host commands from PL\SQL:

    1. external procedures
    2. DBMS_PIPE / daemon
    3. Java.

    All of these are documented in various places in Oracle's documentation. I think the Java approach is the one that Oracle recommends these days and is the one likely to be supported the best going forward.

    I have used the DBMS_PIPE / daemon combination to do host commands with various Oracle databases from version 7.3 - 8.1.7. That has worked very well for me. To use that approach you need a C-compiler to compile the source code that Oracle distributes for the "daemon" utility. Then you run that on the server. It opens a connection to your dataabse and waits for commands to be passed to it via DBMS_PIPE. When it receives a command, it executes it in the O/S and returns success/fail to PL\SQL. For more information on this, check your Oracle documentation for PL\SQL Supplied packages: DBMS_PIPE. "

    From personal expereince it is easy enough to do it through a sql script in sql plus but if it does have to be a stored procedure so you can run it as a database job then one of the workarounds listed will have to be considered.

    Hope this is of some help to you. I was sure I'd read it could be done - guess I just thought I had!.....

    Mark Backhouse
    Oracle Database Administrator
    Great North Eastern Railways

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width