This discussion is archived
9 Replies Latest reply: Aug 16, 2013 8:50 AM by user500315 RSS

os_command.exec

user500315 Newbie
Currently Being Moderated

Hello, please your help,   

When i execute: select os_command.exec('/bin/kill -9 1111') from dual

on a Solaris server i get error code # 127,

however, i try the same command on a HPUX environment and it executes correctly.

Does anyone know why is it?

i have oracle database 10.2.0.3.

 

Thanks in advance.

  • 1. Re: os_command.exec
    rp0428 Guru
    Currently Being Moderated

    user500315 wrote:

     

    Hello, please your help,  

    When i execute: select os_command.exec('/bin/kill -9 1111') from dual

    on a Solaris server i get error code # 127,

    however, i try the same command on a HPUX environment and it executes correctly.

    Does anyone know why is it?

    i have oracle database 10.2.0.3.

     

    Thanks in advance.

    You haven't posted ANY information about what you have done.

     

    For all we know the os_command hasn't even been installed on the Solaris server or may not have been installed correctly.

     

    You also can't just TELL us you get an error: you need to SHOW us by posting an EXACT copy of the sql*plus (or other) session you are using.

  • 2. Re: os_command.exec
    sb92075 Guru
    Currently Being Moderated

    user500315 wrote:

     

    Hello, please your help,  

    When i execute: select os_command.exec('/bin/kill -9 1111') from dual

    on a Solaris server i get error code # 127,

    however, i try the same command on a HPUX environment and it executes correctly.

    Does anyone know why is it?

    i have oracle database 10.2.0.3.

     

    Thanks in advance.

     

     

    when results when you do as below on Solaris system

     

    ls -l /bin/kill

  • 3. Re: os_command.exec
    user500315 Newbie
    Currently Being Moderated

    Hello rp0428,

     

    i need a way to execute operating system commands from sql / plsql, i was reading in internet and i found this oracle white paper: Executing operating system commands from PL/SQL.

     

    http://www.oracle.com/technetwork/database/enterprise-edition/calling-shell-commands-from-plsql-1-1-129519.pdf

     

    I followed those steps and it actually worked on HPUX, but i tried the same on two Solaris platforms and i get error code 127 only when i try to execute a kill command, other commands like ls or mkdir work perfectly.

  • 4. Re: os_command.exec
    user500315 Newbie
    Currently Being Moderated

    Hello sb92075,

     

    This is the output on Solaris:

    -r-xr-xr-x   1 root     bin         9964 Jan 22  2005 /bin/mkdir

     

    This is the output on HPUX:

    -r-xr-xr-x   1 bin        bin          14668 Mar 26  2004 /bin/kill

     

    But, as i said before, other commands work perfectly on Solaris and also have root:bin

  • 5. Re: os_command.exec
    jgarry Guru
    Currently Being Moderated

    Now try this command:

     

    which kill

     

    It is strange your kill is a mkdir.  Perhaps you should try this:

     

    ls -l /bin|grep kill

     

    And look for aliases, maybe something different about solaris, I don't have one to try, but killing processes does require some skill.

  • 6. Re: os_command.exec
    rp0428 Guru
    Currently Being Moderated

     

    It is strange your kill is a mkdir.  Perhaps you should try this:

    Please explain why you think it is strange. This command

    ls -l /bin/kill

    should list files whose names begin with 'kill'.

     

    So why is it strange for the output to be '/bin/mkdir'?

     

    Are you suggesting that 'mkdir' does not begin with 'kill'?

  • 7. Re: os_command.exec
    user500315 Newbie
    Currently Being Moderated

    Oh, excuse me all of you,

    it was my fault, i was testing other commands.

    This is the correct output in Solaris for ls -l /bin/kill:

    -r-xr-xr-x  17 root     bin          134 Jan 21  2005 /bin/kill

     

    Any suggestion, please?

  • 8. Re: os_command.exec
    rp0428 Guru
    Currently Being Moderated

    user500315 wrote:

     

    Oh, excuse me all of you,

    it was my fault, i was testing other commands.

    This is the correct output in Solaris for ls -l /bin/kill:

    -r-xr-xr-x  17 root     bin          134 Jan 21  2005 /bin/kill

     

    Any suggestion, please?

    And did you actually do the required first step and execute the same command manually to make sure it works?

     

    '/bin/kill -9 1111'

    You need to make sure that command actually works to begin with and you need to execute it as the same user and from the same folder that your code would be using.

  • 9. Re: os_command.exec
    user500315 Newbie
    Currently Being Moderated

    yes, i did it, it works ok directly from operating system:

     

    kill - 9 1111

    /bin/kill -9 1111

     

    both work correctly

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points