How to run Unix Host commands from Database Triggers?

Hi
I need to create few directories in the Unix O/s under a specific directory (From a Database Trigger). And the directory names will be determined in the DB Trigger based on the data.
I hope someone would have come across a requirement like this and will be able to help me out.
Thanks.
Mohan

Hi Christopher
How is it possible to use System calls from Triggers. Is it possible to use Runtime Libraries in DB Triggers.
Thanks
Mohan
<BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>Originally posted by Christopher Racicot ([email protected]):
Try using the system calls available in
the C runtime library by calling an external
C procedure from the trigger. We will be
enhancing the support in UTL_FILE to address
issues like this in an upcoming release,
but for now an external procedure should
do the trick.<HR></BLOCKQUOTE>
null

Similar Messages

  • How to run a HOST command from Report 2.5

    Hello everybody,
    I want to pass an unix command from a Report. I am running the report (Report 2.5) on an Unix server and I want to pass a unix host command inside the Before Report Trigger of the report. But Report2.5 is not recognising the HOST built-in. Is there is any way around?
    Thank in advance.
    Samujjwal Basu

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • How to run a DOS command from an Oracle form.

    How can I run a DOS command from an Oracle form (i.e. open the calculator located at c:\windows\system32\calc.exe)?

    first of all get the environment variable for the c:\windows\system32 direcotry for any of the windows
    you can use get variable from the ora env package
    now cancat the system32 variable with the calc.exe string
    now pass the string with host command as parameters
    this process will work for all type of windows.

  • How to run unix shell script from java web applet

    hi all
    i have created one java applet. my apache web server is on unix server.
    i have created one shell script in same directory where my .class and .htm files reside...
    how to run this shell script from applet? it should search this .sh file on server and not on the client browser machine...
    thanks in advance

    I suppose you could make the shell script into a CGI, configure the server to execute CGIs, and then make the applet open the URL of that CGI.

  • How to run multiple DOS commands from a single Webutil Client_Host session?

    Hello all,
    I have a requirement where I need to create an interface with SVN from Forms for basic checkin-checkout of files.
    So, I've been trying to use webutil client_host to open a command line session and issue svn commands.
    For svn, sometimes I need to give multiple commands like change to a particular directory and then run an svn command.
    But client_host takes in only one command at a time and I'm unable to issue a series of DOS commands to perform
    a particular task.
    Is there a way to do this?
    Pls suggest.
    Regards,
    Sam

    First your original question... You can put more than one DOS command on a single line, simply separate each command with an ampersand (&). For example:
    mkdir c:\abc & cd abc & dir*
    Regarding your concerns about performance, well that would depend on exactly what you mean. Using CLIENT_HOST (or HOST on the server) simply opens a shell (DOS in this case) then passes your command to it. The performance of performing this action really isn't measurable. Basically you are just pressing a button and you should get a near immediate action. As for the performance of executing each command, that has nothing to do with Forms. Once the command is passed to the shell, the rest is a function of the shell and whatever command you passed.
    Having said that, if you were to write something sloppy like a loop (in pl/sql) which called CLIENT_HOST lots of times repeatedly, then yes there would be a performance problem because the pushing of the button will cause an exchange to and from the server and each cycle in the loop will do the same.
    So the answer to how performance is impacted will depend on what exactly you need to accomplish. If it is a single call to CLIENT_HOST, this should be fine.

  • Efficiently Running UNIX des command from Java

    Hi,
    I am trying to execute the following code in a loop to have an Brute Force attack for recovering the key.
    Runtime r = Runtime.getRuntime();
    p = r.exec("des -D -k "+keys.get(randomIndex)+ " " +cipherTextFileName);
    But as the des command has to read the file every time the programm is not a efficient one.Can I do something like reading the ciphertext from the file only once and then pass it to the des command from the java.So that it won't do I/O operations resulting good performamnce.If I can do this how to do it.Please suggest with examples.
    Thanks
    Tapas

    If you use Java you're not doing that. What does being an Academic project have to do with what tools you're allowed to use? Who is dictating that you're "only" allowed to use the des command line tool? (If it comes to that, which des command line tool are you using anyway? It's not a unix standard thing).
    The one thing you can do is to see if there is an option to read the file(s) from standard input and send them to the process from the Java runtime that way - that way the input doesn't have to be read multiple times. However this is unlikely to make any significant difference. Most of the performance cost is likely to be the context switch required to kick off the new process with very little cost incurred from re-reading a file from the disk cache.
    You've got your answer anyway. You're not going to be able to make this much more efficient. I recommend not doing that. If you really really have to, well, tough.

  • How to run O/S command from SQL * Plus.

    Hi,
    Can i run O/S commands, say copy or move, from SQL * Plus prompt? If yes, what is the command.
    Thanks.

    hi,
    or you can try the following
    slq > !
    and then your command
    rgds
    Alan

  • Issues with running UNIX shell command from Java

    Here is my java class file:
    create or replace and compile java source named host as
    import java.lang.* ;
    public class Host
       public static void cmdTest()
            String cmd = "ps -ef | grep orcl" ;
            int rc = 0 ;
            int = runCmd(cmd) ;
       public static int runCmd(String str )
           Runtime rt = Runtime.getRuntime() ;
           int     rc = -1 ;
          try
                Process p = rt.exec(str) ;
                int bufSize = 4096 ;
                BufferedInputStream bis =
                    new BufferedInputStream(p.getInputStream(), bufSize) ;
                int len ;
                byte buffer[] = new byte[bufSize] ;
                // Log what the program spit out
                while ((len = bis.read(buffer, 0, bufSize)) != -1)
                    rc = p.waitFor() ;
            catch (Exception e)
                e.printStackTrace();
                rc = -1 ;
            finally
                return rc ;
    show errorsI can call runCmd directly from SQLPlus using an Oracle stored procedure and it runs like expected. I can see the returned output using dbms_java.set_output(1000000).
    But when I call cmdTest from SQLPlus using an Oracle stored procecdure it just hangs forever and I have to kill the session.
    Is there something I am missing in the cmdTest method?

    Jimmy,
    If you haven't already seen it, I think the following article may be of help:
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Also a "finally" block should not contain a "return" statement:
    http://weblogs.java.net/blog/staufferjames/archive/2007/06/_dont_return_in.html
    Good Luck,
    Avi.

  • Running a host command from servlet

    Hi
    I am trying to run some hostcommand/shell scripts from a servlet.Can any one tell me how to go about it.
    Rgds,
    Satya

    this is very useful, I've been looking for a long time but nobody is able to answer me, even my tutor.
    andrew

  • How To Run Unix/Linux Commands

    I want to run a shell script on linux and show the output. How can I do this? Thanks a lot

    Runtime.exec with the rsh (remote shell) command? "man rsh" for more info.
    Thanks,
    Brian

  • Is it possible to run host command from SAP environment? How do you run?

    Hi
    Is it possible to run host command from SAP environment? How do you run?
    Thank You

    Hello Subhash
    You will more details in the following thread:
    Re: How to define command for SXPG_COMMAND_EXECUTE
    Regards
      Uwe

  • How to run non-customised report from command prompt to gen trace file?

    Hi
    how to run non-customised report from command prompt to gen trace file?
    EBS R12 RUP6.
    RHEL5
    rgrds

    Hi,
    See (Note: 285497.1 - Rwrun.sh Does Not Generate Trace Output Using TRACEOPTS in Command Line) and/or (Note: 737445.1 - R12 Concurrent Requests Run Forever; rwrun Errors REP-50125) for the command you need to use.
    Thanks,
    Hussein

  • How to run a CMD command directly from run ?

    How to run a CMD command directly from run ?
    Like "cmd md D:\abcd". I did this before. But now I totally forgot how to do that ?
    Please help..........

    Hi,
    To add, here is the command CMD reference:
    Cmd
    Best regards
    Michael Shao
    TechNet Community Support

  • Call OS Command from Database

    How Can I call a OS Command from database stored procedure. From Developer I use host command.
    Thanks

    You can use java stored procedures for this purpose if you are using Oracle8i.
    Here is some sample code for doing this.
    import java.io.*;
    import java.util.*;
    public class ExecDemo {
    static public String[] runCommand(String cmd)
    throws IOException {
    // set up list to capture command output lines
    ArrayList list = new ArrayList();
    // start command running
    Process proc = Runtime.getRuntime().exec(cmd);
    // get command's output stream and
    // put a buffered reader input stream on it
    InputStream istr = proc.getInputStream();
    BufferedReader br =
    new BufferedReader(new InputStreamReader(istr));
    // read output lines from command
    String str;
    while ((str = br.readLine()) != null)
    list.add(str);
    // wait for command to terminate
    try {
    proc.waitFor();
    catch (InterruptedException e) {
    System.err.println("process was interrupted");
    // check its exit value
    if (proc.exitValue() != 0)
    System.err.println("exit value was non-zero");
    // close stream
    br.close();
    // return list of strings to caller
    return (String[])list.toArray(new String[0]);
    public static void main(String args[]) throws IOException {
    try {
    // run a command
    String outlist[] = runCommand("/bin/ls -l");
    //String outlist[] = runCommand("/u02/home/usupport/ashehade/java/test");
    // uncomment this line an comment above if you want to execut
    // a c executable called test.
    // display its output
    for (int i = 0; i < outlist.length; i++)
    System.out.println(outlist);
    catch (IOException e) {
    System.err.println(e);
    Load this to the datbase
    loadjav -u scott/tiger ExecDemo.java
    Publish the proceduer
    create or replace procedure lsfromjava as
    language java name 'ExecDemo.main(java.lang.String[])';
    Test it
    SQL> set serverout on
    SQL call dbms_java.set_output(2000);
    SQL> execute lsfromjava
    total 1770
    -rw-r--r-- 1 usupport udba 8385 Aug 27 1999 init.ora
    -rwxr-xr-x 1 usupport udba 1724 Mar 14 05:46 initCONV.ora
    lrwxrwxrwx 1 usupport udba 45 Mar 10 11:01 initMWS2.ora ->
    /u03/app/oracle/admin/MWS2/pfile/initMWS2.ora
    lrwxrwxrwx 1 usupport udba 59 Jan 11 16:09 initV816.ora ->
    /u02/app/oracle/product/8.1.6/admin/V816/pfile/initV816.ora
    -rw-r--r-- 1 usupport udba 9219 Aug 27 1999 initdw.ora
    lrwxrwxrwx 1 usupport udba 59 Feb 14 11:55 initreid.ora ->
    /u02/app/oracle/product/8.1.6/admin/reid/pfile/initreid.ora
    -rw-r--r-- 1 usupport udba 835 Nov 3 17:07 initsoxx.sql
    -rw-rw---- 1 usupport udba 24 Mar 13 10:22 lkBLEVE
    -rw-rw---- 1 usupport udba 24 Mar 14 05:46 lkCONV
    -rw-rw---- 1 usupport udba 24 Mar 13 04:48 lkMWS2
    If you are using Oracle 8.0.5 , then you can use external procedures for this.
    There was one article in the Oracle Magazine for doing this with external procedures. You can search the archives for this purpose.

Maybe you are looking for

  • Reliability of Time Machine on Snow Leopard Server

    I ran across a message that even though Time Machine is included in OSX 10.6 Server, Apple does not support its use in this system. Now I can't find it again. Is that true? Not trying to clone an entire computer, just the Library (for WebServer and Q

  • How do I move clips in one pane of iMove (10.0.3) into the timeline?  iMovie somehow doesn't realize I'm trying to edit the clips.

    How do I move clips in one pane of iMove (10.0.3) into the timeline?  iMovie somehow doesn't realize I'm trying to edit the clips.

  • Smart playlist not working

    My smart playlists aren't doing jack squat for updating. The live-update checkbox is checked. I tried unchecking it, then going back and checking it again. No luck. I have lots of new songs on my computer that simply are not showing up. And the music

  • Change Tracking in Portal

    Hi, I have enabled change tracking for 4 fields in MDM. 2 fields are integer fields and 2 are Lookup fields. Now, in Portal we have launched change tracking application. In the Records Column - in Portal Changetracking table.. I can see  ->  11,10922

  • Urgent :: How to do Cascade delete in OA Framework??

    I have built a employeeSearch page. The VO is based on only one EO that is EmployeeEO. This emp_id is referred in 4 other tables. what i want to do is --- when i delete the employee from employee Search Page. the corresponding records in other tables