Host Command Problems on 9i Unix

I am using web froms 9i running on a Unix server with 9iasr2. I am trying to manipulate files on the server not the client. I have tried:
host('rm -f /mypath/filename.txt')
host('rm -f /mypath/filename.txt',NO_SCREEN)
host('touch /mypath/filename.txt')
host('touch /mypath/filename.txt', NO_SCREEN)
host('mv /mypath/file1.txt /mypath/file2.txt')
The file I am trying to delete is one that was transfered using the webutil file transfer.
I have tried to check the status with:
IF NOT Form_Success THEN
     Message('Error -- Message not sent.');
ELSE
     Message('Message Sent.');
END IF;
I always get back 'Error...'
The directories have permission open to everyone. Therefore I would of expected no problems with doing a touch to create a file.
Any ideas?

Thanks Ino. That was it, the full path for the unix command itself was missing. I knew it was something simple. =)

Similar Messages

  • Host Command Problem

    hi,
    I'm running on OpenVMS 7.2-1 (no unix in this shop) trying to get the HOST command to return status. In desperation I created a dummy form with 1 button that when pressed issues:
    HOST('lalala');
    if not form_success then
    message ('bad status returned');
    else message ('good status returned');
    end if;
    Form_Status always returns success, even for totally bogus commands (like 'lalala'). I've put the test_cmd into a varchar2 in the pl/sql, I've put it in a dummy.com file then had the host file call dummy.com... I can't get anything except a successful status to return. What's up. That's what all the ora docs say to do. Any hints?
    thanks
    Sandy

    (2nd try. 404 on 1st reply)
    I would agree that the form is behaving as though it never sees the OS error.
    I tried both w/ & w/o no-screen and the results back to the form are the same (form_success = true), however w/o no-screen at least displays on the os cmd line the error.
    I tried tool_env.getvar returning '$status' returns blank.
    My form calls host('@dummy.com') where dummy.com does "exit $status". Show symbol $status does show an error but the form is not getting it.
    sg

  • PL/SQL Procedure Calling Java Host Command Problem

    This is my first post to this forum so I hope I have chosen the correct one for my problem. I have copied a java procedure to call Unix OS commands from within a PL/SQL procedure. This java works well for some OS commands (Eg ls -la) however it fails when I call others (eg env). Can anyone please give me some help or pointers?
    The java is owned by sys and it looks like this
    CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ExecCmd" AS
    //ExecCmd.java
    import java.io.*;
    import java.util.*;
    //import java.util.ArrayList;
    public class ExecCmd {
    static public String[] runCommand(String cmd)
    throws IOException {
    // set up list to capture command output lines
    ArrayList list = new ArrayList();
    // start command running
    System.out.println("OS Command is: "+cmd);
    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: "+proc.exitValue());
    // 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(args[0]);
    for (int i = 0; i < outlist.length; i++)
    System.out.println(outlist);
    catch (IOException e) {
    System.err.println(e);
    The PL/SQL looks like so:
    CREATE or REPLACE PROCEDURE RunExecCmd(Command IN STRING) AS
    LANGUAGE JAVA NAME 'ExecCmd.main(java.lang.String[])';
    I have granted the following permissions to a user who wishes to run the code:
    drop public synonym RunExecCmd
    create public synonym RunExecCmd for RunExecCmd
    grant execute on RunExecCmd to FRED
    grant javasyspriv to FRED;
    Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/bin/env','execute');
    commit
    Execute dbms_java.grant_permission('FRED','java.io.FilePermission','/opt/oracle/live/9.0.1/dbs/*','read, write, execute');
    commit
    The following test harness has been used:
    Set Serverout On size 1000000;
    call dbms_java.set_output(1000000);
    execute RunExecCmd('/bin/ls -la');
    execute RunExecCmd('/bin/env');
    The output is as follows:
    SQL> Set Serverout On size 1000000;
    SQL> call dbms_java.set_output(1000000);
    Call completed.
    SQL> execute RunExecCmd('/bin/ls -la');
    OS Command is: /bin/ls -la
    total 16522
    drwxrwxr-x 2 ora9sys dba 1024 Oct 18 09:46 .
    drwxrwxr-x 53 ora9sys dba 1024 Aug 13 09:09 ..
    -rw-r--r-- 1 ora9sys dba 40 Sep 3 11:35 afiedt.buf
    -rw-r--r-- 1 ora9sys dba 51 Sep 3 09:52 bern1.sql
    PL/SQL procedure successfully completed.
    SQL> execute RunExecCmd('/bin/env');
    OS Command is: /bin/env
    exit value was non-zero: 127
    PL/SQL procedure successfully completed.
    Both commands do work when called from the OS command line.
    Any help or assistance would be really appreciated.
    Regards,
    Bernard.

    Kamal,
    Thanks for that. I have tried to use getErrorStream and it does give me more info. It appears that some of the commands cannot be found. I suspected that this was the case but I am not sure about how this can be as they all appear to reside in the same directory with the same permissions.
    What is more confusing is output like so:
    SQL> Set Serverout On size 1000000;
    SQL> call dbms_java.set_output(1000000);
    Call completed.
    SQL> execute RunExecCmd('/usr/bin/id');
    OS Command is: /usr/bin/id
    exit value was non-zero: 1
    id: invalid user name: ""
    PL/SQL procedure successfully completed.
    SQL> execute RunExecCmd('/usr/bin/which id');
    OS Command is: /usr/bin/which id
    /usr/bin/id
    PL/SQL procedure successfully completed.
    Regards,
    Bernard

  • WEBUTIL problems importing a file with the HOST command.

    We are investigating a problem where the users are trying to import a file in from the webserver to be used by the application. The users have successfully moved the file from their local PC to the application server. But, when we perform a HOST command to have the form moved to the UNIX directory, the form hangs. The very last statement of the .BAT file used in the HOST command does the move of the file. And, we can see the entire file in the UNIX directory, we just don't get return back to the form.
    I added displays before and after the HOST command in the form. I see the display before the command but don't receive anything after. The weird thing is this is only happening in our development server. The same issue is not happening in production. Also, if I run the form in client server mode, it works fine also. So, it has to be something on the development application server.
    If anyone has any advice, I would appreciate their help.
    Thanks.

    On the server (assuming Windows since you mention a batch file), locate the Oracle Process Manager Service (for mid tier) on the MS Services Console. Open the properties for this service and click on the "Log on" tab. Check the box labeled "Allow service to interact with desktop".
    That said, if you are executing a batch file on the Windows server to transfer another file to a Unix machine, the above likely won't work either. This is because Windows will not allow a service permission to access network resources (for security purposes). In this case, rather than the above, you will need to change the same setting so a real domain user and not the "Local System" account.

  • Problem with sqldir invoked by host method in Forms10g on Unix

    Hi,
    I have a problem with invoking sqlldr from Forms10 using host command in
    Unix environment(Solaris). I have two ORACLE_HOME's , one for IDS10g and second where is Oracle Client with sqlldr, which I have to invoke.
    I have a script:
    #!/bin/sh
    NLS_NUMERIC_CHARACTERS=., ;export NLS_NUMERIC_CHARACTERS
    ORACLE_HOME=/export/home/oracle/oracle/product/10.2.0/client_3
    export ORACLE_HOME
    echo $ORACLE_HOME > env1.txt
    LD_LIBRARY_PATH=/export/home/oracle/oracle/product/10.2.0/lib32
    export LD_LIBRARY_PATH
    sqlldr TEST/TEST@orcl control='UOFE050.ctl' log='UOFE050.log' errors=1000000 skip=1
    ORACLE_HOME=/u01/app/oaspers/frs; export ORACLE_HOME
    echo $ORACLE_HOME > env2.txt
    I have all neccesary paths in my default.env file (/usr/bin:/export/home/oracle/oracle/product/10.2.0/client_3/bin:
    /usr/bin:/export/home/oracle/oracle/product/10.2.0/client_3) for FormsServer. I have tried invoke sqlldr with full path
    and I have tried to change LD_LIBRARY for current ORACLE_HOME (in shell script). Of course from command line the script is working.
    I know that only the line with sqlldr is not executed, so I have found a couple of threads on this forums but i have not found solution
    for my issue - with two ORACLE_HOME's - the invocation of script in Forms is - host('scr.sh').
    I am using webutil for uploading file to AS, and I do not want to use sqlldr on client.
    ps. the experiment for Windows was OK - with Host('cmd /k scr.bat',no_screen);
    thanks for help,
    gregory

    So my question to a Forms guru is that Do I have to really upload with webutil files to database and then put it down with utl_file and invoke sqlldr from database by f.e. java stored procedure ? A customer rejected solution with invoking sqlldr from client (reasonable - instalation Oracle client on every PC).

  • Using unix host command within plsql on aix

    On an aix platform Im trying to host out of a plsql procedure to
    use mail. I can only get the host command to work inside a blank
    .sql file. ie. first line must have the host command on it. If
    you try to imbed the host command within a procedure, the file
    will just sit there and nothing happens.
    null

    Jay,
    This forum is for Headstart related questions and experiences
    only. Please go to metalink.oracle.com to get more information on
    your problem.
    Regards,
    Lauri
    Jay Levasseur (guest) wrote:
    : On an aix platform Im trying to host out of a plsql procedure
    to
    : use mail. I can only get the host command to work inside a
    blank
    : .sql file. ie. first line must have the host command on it. If
    : you try to imbed the host command within a procedure, the file
    : will just sit there and nothing happens.
    null

  • Problem using Host command to call a batch file

    Hi all,
    I am trying to call a batch file with the Host command:
    host c:\test\u.bat
    where u.bat calls unix2dos.exe with a parameter of d_unix.txt.
    Bat file looks like this:
    C:\test\unix2dos.exe d_unix.txt
    PAUSE
    The bat file gets called fine, but the following error occurs (in the cmd prompt):
    T:\globals\ORACLE8\bin>C:\test\unix2dos.exe d_unix.txt
    d_unix.txt:
    Can't open file
    T:\globals\ORACLE8\bin>PAUSE
    Press any key to continue . . .
    Running the batch file directly in windows works fine. The batch file also runs fine from the Host command if I remove the d_unix.txt parameter.
    The file d_unix.txt file is in the same directory as the batch file and as unix2dos.exe.
    Running from Sql Plus in a windows environment.
    Any thoughts?
    Edited by: dgouin on Aug 19, 2009 11:41 AM
    Edited by: dgouin on Aug 19, 2009 11:42 AM
    Edited by: dgouin on Aug 19, 2009 11:42 AM

    I always understood that it worked with whatever directory you were in when you launched the SQL*Plus binary:
    D:\>SQLPLUS dbuser@testdb
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 19 15:26:35 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    dbuser@testdb > HOST ECHO %CD%
    D:\
    dbuser@testdb > exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    D:\>H:
    H:\>SQLPLUS dbuser@testdb
    SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 19 15:27:03 2009
    Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    dbuser@testdb > HOST ECHO %CD%
    H:\
    dbuser@testdb > exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

  • How to execute host command in trigger

    dear professional:
    i'm trying to create a trigger that when a certain value inserts into a table , it fires some UNIX command to do the job following
    here is what i tried ,create a trigger that gives host command , but when i tried insert , it fails to work
    i also tried dbms_pipe ,but seems same when using dynamic sql to do the job
    any idea of how to accomplish this task ?
    many thanks ~
    br/ricky
    SQL> CREATE OR REPLACE TRIGGER price_exec
    2 BEFORE INSERT ON omc.price_test
    FOR EACH ROW
    BEGIN
    IF :NEW.price = 4 THEN
    execute immediate 'host ll';
    END IF;
    END price_exec;
    / 3 4 5 6 7 8 9
    Trigger created.
    SQL> insert into price values ('test',4);
    insert into price values ('test',4)
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> insert into price_test values ('test',4);
    insert into price_test values ('test',4)
    ERROR at line 1:
    ORA-00900: invalid SQL statement
    ORA-06512: at "OMC.PRICE_EXEC", line 3
    ORA-04088: error during execution of trigger 'OMC.PRICE_EXEC'

    hi,
    my db is 9.2
    i'm aware of schedule you mentioned , but if it's up to the task , you don't know when a row with certain value is inserted
    simple way :
    when a row inserted into a table with value "catch me" you want to know who inserted this test value
    so you tried to create a trigger to catch program, machine, module ,and terminal info from v$session
    so you can figure out where it is coming from
    and i want to go a step further , by executing some os command to digging out more
    and i come up with this , when value 4 is inserted i exec a procedure host to execute command,
    the problem is it's not working as i exepcted , so spare me the lecture of reading docs and just tell me what to do
    i'd really appreciate it , thanks
    CREATE OR REPLACE TRIGGER price_exec
    BEFORE INSERT ON omc.price_test
    FOR EACH ROW
    BEGIN
    IF :NEW.price = 4 THEN
    execute immediate 'host('echo')';
    END IF;
    END;
    Warning: Trigger created with compilation errors.
    SQL> show errors
    Errors for TRIGGER PRICE_EXEC:
    LINE/COL ERROR
    3/30 PLS-00103: Encountered the symbol "ECHO" when expecting one of
    the following:
    . ( * @ % & = - + ; < / > at in is mod not rem return
    returning <an exponent (**)> <> or != or ~= >= <= <> and or
    like between into using || bulk
    The symbol ". was inserted before "ECHO" to continue.

  • Host command in PL/SQL Package

    Hi,
    How is it possible to launch a host command from a PL/SQL package without Pro*C nor Java ?
    Hope it's possible, 'cos Java is not available here and Pro*C has some^problems that the DBA cqn't solve...
    Could you please answer at [email protected]
    Thanks in advance !

    Hi Thomas,
    You can call external progs within PlSql.
    You have to
    - Configure Tnsnames.ora aned listener.ora on the server
    with the 'extproc' entry
    - Have an external proc in a DDL on NT (or .so on unix)
    - Create a libray pointing on this .so file with 'Create library'
    - Declare a PlSql proc calling your external proc in the library
    And then you will use your PlSql proc within your package.
    It's fastidious but it works.
    Mbo

  • Printing with host command

    Let me explain my situation.
    I have a txt file which I want to print out. I usually do this with host command which looks something like this:
    command:='print /D:\\print_server\printer file.txt';
    The problem is how to print this file in landscape.
    If this iAS would be installed on Unix platform I guess my host command would look something like this:
    command:='lp -d printer -olandscape file.txt';
    the problem is, my iAS is installed on WIN2000 server.
    any ideas........

    OK I managed to solve this problem with some dosprint.exe program (40$) which can accept various other parameters as well and one of them is also landscape.
    oh, that windows again .....

  • Java running host command

    Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
    PL/SQL Release 11.1.0.6.0 - Production
    CORE     11.1.0.6.0     Production
    TNS for HPUX: Version 11.1.0.6.0 - Production
    NLSRTL Version 11.1.0.6.0 - Production
    Hi,
    I am not familiar with Java setting in Oracle
    I have a a stored procedure that call a java program to execute host command like
    ssh user1@localhost '/home/user1/someprogram'
    if we execute this directly using PuTTY
    we can do the following with no problem
    su - oracle
    ssh user1@localhost '/home/user1/someprogram'
    but when we execute the stored procedure,
    we have to do
    */usr/bin/ssh* user1@localhost '/home/user1/someprogram'
    does anybody where to set the path or environment to make the java know the path correctly.
    thanks
    Edited by: HGDBA on Mar 11, 2011 10:49 AM

    OK. You can try the following:
    Login as the Unix user (e.g. oracle) on the pre-upgrade environment and run the following command.
    echo $PATH
    Repeat the above in the post-upgrade environment and compare the two outputs. Generally, PATH will be set using an environment script called from .profile of the user or it could be directly defined in .profile.
    You can check this by examining the .profile after logging in as the OS user (e.g. oracle):
    vi ~/.profile #i.e check the .profile in the user's home directory.
    It's my best guess, as sometimes the PATH could be added later on (for. e.g by another script). Anyways, give it a try and tell what you find.

  • Issues with host command

    Hi All
    We are running Forms 10gR2 under linux. We are having issues with the host command. We use host command to call ProC* modules in the appsvr. It used to work in Forms 6i. Host commnd no longer works in forms10g. Do we need to any setup to run commands using host.
    We need to resolve this issue immediately.
    any help is appreciated.
    Rgds
    Arvind Balaraman

    Arvind has said the command needs to run on the app server so HOST is correct, not CLIENT_HOST.
    I noticed when I installed 10g (on solaris) that the default.env file has a setting for PATH which does not include /usr/bin so HOST would not be able to find standard unix commands, so I added it in:
    PATH=/usr/bin:/home/oracle/product/AS101202/bin
    Alternatively you could include the full path on any unix commands run by HOST.
    Surpisingly I have not seen this documented anywhere. Could this be the problem ?
    I have a related problem I have not solved yet. I have one particular HOST command which works OK until after I run reports from forms, then it just stops working without producing any error.

  • Forms HOST command no longer works after database upgrade from 10g to 11g

    Hi,
    After upgrading the database 10g to 11g the forms HOST command no longer works on Unix server. The form used to work fine prior the upgrade. I read all the threads I could find and did not see any solutions. Adding PATH and LD_LIBRARY_PATH does not work because it does not even run a basic shell script. (I saw this solution, adding PATH and LD_LIBRARY_PATH, in many questions / threads).
    1. I wouldn't expect the database upgrade to be an issue, but it is the only change we had.
    2. Note, 11g is Oracle Fusion Middleware which is quite a bit different than 10g.
    I even tried the most basic commands like "echo" which is a build-in Unix command and there is no directory for it (ie. no /usr/bin - so variable PATH is irrelvent). i.e HOST('echo hi'); and HOST('echo "hi" '); and even HOST ('echo hi > /my_file.txt'); all returns FORMS_FAILURE (actually the if is IF FORM_SUCCESS THEN ... else ... and the else part always runs now - whereas it didn't before.).
    Or basic commands like /usr/bin/ls as in HOST(/usr/bin/ls). At that point I was just testing the Unix command would return FORM_SUCCESS even though I could not see the results (because they weren't writing to a log file). Notice that I'm using the direct path /usr/bin so no Unix environment variables were needed.
    The form does use webutil but that part works. For example, we have webutil_file_transfer( ....) The file shows up on the application server and in the expected directory.
    Here's the main goal. Upload a file from clients local PC to the datebase server. The form uploads the file to the Application server, then we have a Unix script to scp (secure copy) the file from the application server to the database server. IF webutil, or any other Oracle functions could put the file on the database server that would be better. But, I don't know of any procedures that do that - or would have done it cleanly (i.e. storing to database and write back to server and then using a blob etc. )
    Anyway, I was hoping someone would help with either of these.
    1) Get the HOST command to work. - If we can get that to work then I wouldn't need any more help. We can just call the already existing Unix script to copy the file from the application server to the database.
    2) OR be able to upload directly to the database server - wanted to do that originally
    Any help would be appreciated

    Solution for those interested and for anyone else searching this forum for a solution
    I found this on My Oracle Support:
    <h3>Host Command from Forms Not Working in 11g in Sun Solaris Sparc OS [ID 1157346.1]</h3>
    Applies To: Oracle Forms - Version 11.1.1.1.0 and later
    Sun SPARC Sun OS
    Symptoms:
    When trying to execute a Shell script or any OS command using the host() Built-in from Forms 11g, the host()command is not getting executed. The same functionality works on other operating systems and in previous versions like 10gR2.
    Steps to be followed:
    1) Take a backup and edit the $DOMAIN_HOME/config/fmwconfig/servers/WLS_FORMS/applications/formsapp_11.1.1/config/default.env or any custom environment file.
    2) Locate the following environment variable:
    LD_PRELOAD=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
    3) Comment out this variable. After the changes, it will look like the following:
    #LD_PRELOAD=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
    3) a) Instead of LD_PRELOAD, kindly use LD_PRELOAD_64 as given below :
    LD_PRELOAD_64=/ora10gas/app/11.1.0/Middleware/as_1/jdk/jre/lib/sparcv9/libjsig.so
    (This makes HOST AND RUN_REPORT_OBJECT work fine).
    4) Save the file and execute your forms. The Host() built-in will work as expected
    The LD_PRELOAD setting in default.env is only required for the working of signal chaining facility in JVM version 1.5 and later. If you are not using theSignal chaining facility, this variable is not required. For more information, refer to the following documentation
    http://download.oracle.com/docs/cd/E14571_01/doc.1111/e14772/forms.htm#CJAJGAFF

  • 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

  • HOST command not working in forms 10g

    Hi,
    I have migrated forms 6i to forms 10g, and having a requirement to open sqlplus prompt using a form menu. I have used the below command: -
    "host('sqlplus '||user_name||'/'||pass||'@'||sid, no_screen);"
    But I am not able to get the sqlplus window, and the main form is still in process for long time, till i bounce the server.
    The forms are deployed on Oracle Applications Server 10g and i want to run it on server side.
    Please help me with the problem.
    Thanks,
    Ankit

    The deployment architecture is different between forms 10g and forms 6i.
    In Forms 6i HOST built-in command will run on the client machine since you are running as client/server, but in WebForms (Forms10g) the HOST built-in command will run on the middle tier which is your application server machine.
    In order to run hosts commands in WebForms you need to use webutil and use CLIENT_HOST in the webutil.
    check the [Forms 10g R2 Demo|http://download.oracle.com/otndocs/demos/Forms_Demos_10gr2.zip] for sample codes of webutil.
    You are using NO_SCREEN in your example, this will hide the window.
    Tony
    Edited by: Tony Garabedian on Nov 26, 2009 2:43 PM

Maybe you are looking for