Client Side Operating System Commands

Hello,
I need to invoke client side operating system commands or batch executables (e.g. test.bat) with the help of Java stored procedures and PL/SQL written in database server. My database is Oracle 10g and installed on UNIX platform, and I am trying to call Windows client commands. What do you prefer to do this?
I investigated lots of documents, but they generally refer how to call OS commands of the server on which the database is running.
Thanks.

It mostly depends on your particular client application how it handles return parameters from SQL or PLSQL.
One simple way would be to simply "print" out the desired client command and let it evaluate it from the client side.
As an example I use SQL*Plus:
/* declare bind variable */
SQL> VAR x varchar2(30)
/* define substitution variable (cmd)  */
SQL> COLUMN cmd new_value cmd
/*    Assign the SQL output to the declared bind variable */
SQL> BEGIN
   SELECT 'echo Hello World'
     INTO :x
     FROM DUAL;
END;
PL/SQL procedure successfully completed.
/*  Assign the bind variable to SQL*Plus substitution variable */
SQL> SELECT :x cmd
  FROM DUAL
CMD                            
echo Hello World               
1 row selected.
/*  Finally let the HOST command evaluate the substution variable */
SQL> HOST &&cmd
Hello WorldHope you got the idea ...

Similar Messages

  • How does client invoke an operating system command in the Server machine.?

    Guys,
    Is there any way that a client could trigger an operating system command on the Oracle Server machine?
    I've a VB scipt file in the server machine.My requirement is to execute that VB file on the server machine.(The script would essentially create a DSN on the server machine).
    The normal way to execute a VB script would be to specify the name of the file in the command prompt.(If my VB script ONDEMAND.VBS resides in C:\ONDEMAND folder,I need to execute the statement
    "C:\ONDEMAND\ONDEMAND.VBS" in the command prompt to get it executed.)
    I would utilise the SQL command below
    HOST C:\ONDEMAND\ONDEMAND.VBS
    to invoke it programatically(from a PL\SQL scipt).
    Can someone help me in utiliting HOST command in Oracle(Or by any other means) for a client database operation to execute an Operating system command in the Oracle server machine?
    Thanks,
    Bhagat

    Hi Bhagat,
    This has been asked several times recently:
    Executing Shell Script from PL/SQL Block
    Fire an executable using oracle
    Cheers,
    Colin

  • Can't scan a collection using endpoint, "Failed to initiate client side operation."

    i'm trying to do a quick endpoint scan of a collection and get the error, "failed to initiate client side operation."   I click the details button and I get this:
    Not found
    Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlQueryException
    The SMS Provider reported an error.
    Stack Trace:
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager.ExecuteMethod(String methodClass, String methodName, Dictionary`2 methodParameters, Boolean traceParameters)
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager.ExecuteMethod(String methodClass, String methodName, Dictionary`2 methodParameters)
       at Microsoft.ConfigurationManagement.AdminConsole.ClientOperation.Utilities.ExecuteClientOperation(ConnectionManagerBase connectionManager, ClientActionType operationType, String collectionId, String collectionName, List`1 validMachineIds, IResultObject
    selectedMachines)
    System.Management.ManagementException
    Not found
    Stack Trace:
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager.ExecuteMethod(String methodClass, String methodName, Dictionary`2 methodParameters, Boolean traceParameters)
       at Microsoft.ConfigurationManagement.ManagementProvider.WqlQueryEngine.WqlConnectionManager.ExecuteMethod(String methodClass, String methodName, Dictionary`2 methodParameters)
       at Microsoft.ConfigurationManagement.AdminConsole.ClientOperation.Utilities.ExecuteClientOperation(ConnectionManagerBase connectionManager, ClientActionType operationType, String collectionId, String collectionName, List`1 validMachineIds, IResultObject
    selectedMachines)
    I have absolutely no idea how to fix it.  I've tried resetting the site, uninstalling and reinstalling the SCCM console from the SP1 media, verifying that WMI is set up correctly, reinstalling the SCCM client on my server, restarting the server... I've
    got nothing.   Does anyone have any suggestions?

    What version is the client running? Do you also have Cu1 installed, if so, did you also upgrade the clients?
    Kent Agerlund | My blogs: blog.coretech.dk/kea and
    SCUG.dk/ | Twitter:
    @Agerlund | Linkedin: Kent Agerlund |
    Mastering ConfigMgr 2012 The Fundamentals

  • Operating  System commands in FTP adapter

    Hi
    I have a requirement to use "Operating System Command" option in the Sender/Receiver side File Adapter.
    And in help.sap.com they have brief notes on this.
    http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
    When I tried to execute some valid DOS commands like MKDIR,RENAME etc it didn't work at all.
    But process has been sucessfully completed without any error!!!
    System : XI 3.0 SP 11
    Can anyone has any inputs on this ? Pls share me some ideas with example. Is there is any limitations on this feature?
    Note: When I tried to give invalid commands hfjkhfkasdjfh,asdjdhas etc, still it is not giving any error!!. Still my File Adapter as well as entire process is successfully completed.

    Hi,
    A couple of cautionary notes.
    The OS command is executed after the file has been processed, e.g. read successfully by a sender adapter or created successfully by a receiver adapter.
    The file name processed can be accessed using %f in the OS command.
    The OS command must include the full directory path, or XI will assume the current directory which may not be where your command resides.
    Regards,
    Bill

  • Operating System Command After File Processing in Sender File Adapter

    Hello guys,
    actually we have different interfaces, and the client to take all the files from only one directory, for example D:/DPI.
    Unitl now we had one adapter for every file with the content conversion, so we didn't have problems with that. Now we have the problem that we sould maintain an order processing files.
    We thougth that an idea could be to execute one file pointing to D:/DPI and at the Operating System Command put like: copy D:/DPI/file.txt D:/DPI/outbound/file.txt, so when file is executed, we move the next file to another directory where is pointing the adapter. Doing this we have an error on the adapter giving us the message: Could not process due to error: java.lang.NullPointerException
    We are using a Windows.
    There is anyway to do in our way, or there is a better solution to resolve this problem?
    Any other idea to do this?
    Many thanks in advance.
    Regards,
    Xavi.

    Helo Guys,
    maybe I haven't explained well.
    We have one directory with different files. We have one adapter for every file( we need for the content conversion ) using NFS and all the adapters are pointing to the same directory.
    The problem is that if we have files A.txt, B.txt and C.txt we need to process in an order.
    And the problem we see is that for every file we have one adapter, so for example if we process file A.txt with one adapter, when this part is finished, we want to process file B.txt with another adapter, and the same for the rest of the files.
    So the idea we had is to create another directories, and when A.txt has finished move file B.txt to another directory.
    However this way is not running, if we log on the PI machine and execute cmd, we can do a copy of one file from one directory to another, but when we put this sentence in the adapter in OS command if we see the adapter log we see an error executing the OS command, but we don't know what is the error, there is no more information.
    There is any way to do this or maybe we have to manage in a different way?
    Many thanks in advance.
    Regards,
    Xavi.

  • How to call Operating System commands / external programs from within APEX

    Hi,
    Can someone please suggest how to call Operating Systems commands / external programs from within APEX?
    E.g. say I need to run a SQL script on a particular database. SQL script, database name, userid & password everything is available in a table in Oracle. I want to build a utility in APEX where by when I click a button APEX should run the following
    c:\oracle\bin\sqlplusw.exe userud/password@database @script_name.sql
    Any pointers will be greatly appreciated.
    Thanks & Regards,

    Hi Guys,
    I have reviewed the option of using scheduler and javascript and they do satisfy my requirements PARTIALLY. Any calls to operating system commands through these features will be made on the server where APEX is installed.
    However, here what I am looking at is to call operating systems programs on client machine. For example in my APEX application I have constructed the following strings of commands that needs to be run to execute a change request.
    sqlplusw.exe user/password@database @script1.sql
    sqlplusw.exe user/password@database @script2.sql
    sqlplusw.exe user/password@database @script3.sql
    sqlplusw.exe user/password@database @script4.sql
    What I want is to have a button/link on the APEX screen along with these lines so that when I click that link/button this entire line of command gets executed in the same way it would get executed if I copy and paste this command in the command window of windows.
    Believe me, if I am able to achieve what I intend to do, it is going to save a lot of our DBAs time and effort.
    Any help will be greatly appreciated.
    Thanks & Regards,

  • Operating system command to zip the file

    Hi Experts,
    I got proxy to file scenario, i can place the text file successfully in reciever side, i want to zip the file in reciever side using operating system command option in reciever Communication Channel.
    Can anyone please give me the operating system command to create the zip file in reciever side.
    Kind Regards,
    Praveen.

    Hi Praveen,
    >>Can anyone please give me the operating system command to create the zip file in reciever side.
    Why OS commands and not the PayloadZipModule?
    If you need OS commands check this blog of Michal /people/michal.krawczyk2/blog/2007/02/08/xipi-command-line-sample-functions
    Update
    You can try this command too
    cmd /C "jar cMf \\<folderpath>test1.zip \\<folderpath>*.*"
    Regards
    Suraj

  • CCMS Auto-React: Operating System Commands

    Hi Gurus,
    I want to run an operating system command in the event that an alert is raised in my CEN CCMS system.
    I have set up the operating system command in SCEN (using SM69) and tested it -- no problems. I have used the example given on help.sap.com. It works great from SM69 or SM49.
    I have created a custom MTE Auto-Reaction Method that is a copy of the SAP standard and it points to the logical name of the op system command I created in SM69.
    But, when I assign the Auto-Reaction method to an MTE and kick off the auto-reaction, nothing happens. I have tried assigning it auto-reaction method as a method for a local MTE and also as a central auto-reaction, but I get nothing.
    Please help me see what I am missing.
    Many thanks in advance,
    Nic Doodson

    Hi Michael,
    Thanks for the response, I hope you can help.
    Logical command is called: Z_NI_ALERT_OVO
    It calls the operating system command: /usr/sap/tmp/test.sh
    It allows additional parameters.
    test.sh is :
    #!/usr/bin/sh
    echo $2 alert from $1 Message $5 $4 > /usr/sap/tmp/alert_$3.txt
    I can run this from SM49/SM69 and it works fine.
    Method is: Z_SEND_ALERT_TO_OVO
    Calls function module: SALO_EXECUTE_SYSTEM_COMMAND_V2
    Can be executed on: Any Server
    Execution Method: Periodically in Dialog Process
    Parameters:
    COMMAND : Z_NI_ALERT_OVO
    PARAMATERS : <blank>
    REACT_ON_ALERTS : red
    MTENAME : SID/SEGMENT/CONTEXT/OBJECT/ATTRIBUTE
    PARAMLIST_1: COLOR DATE_TIME MSG
    PARAMLIST_2: ID
    Help!
    I can only think there is something about it being a local/centrally distrubuted auto-reaction method...I'm assigning it as a cenrally distributed auto-reaction method.
    Any input would be great.
    Cheers,
    Nic

  • How to Run Operating System Command Before/After Message Processing SAP PI

    Hi,
    We are trying to execute multiple commands via "Operating System Command Before/After Message Processing".
    When we use single command say for example cp or mv (copy or move) the commands get executed fine.
    eg: cp %F /var/opt/data/outbound/Test/Dummy.txt 
    /this works fine/
    when we club commands together or try to redirect the outputs of commands, none of the commands get executed.
    eg:
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    or
    wc -l %F > /var/opt/data/outbound/Test/Dummy.txt
    Is it possible to execute multiple commands or redirect the output  of commands without using a shell script? The PI server we are working on iis hosted on UNIX environment.

    Hi Harleen,
    try like this
    cp %F /var/opt/data/outbound/Test/Dummy.txt ; rm %F
    instead of semicolon try this
    (1) &
    command1 & command2
    Execute Command1 and then execute Command2
    (2) &&
    command1 && command2
    Runs the command2 only when command1 doesn't Complete successfully
    (3) ||
    command1 || command2
    Runs the second command if the first command had an error
    (4) ()
    (command1 || command2) || (command3 & command4)
    Defines the order in which commands are to be executed
    Regards
    Suraj

  • Operating system command in file receiver adapter

    Hi,
    How to use the Run Operating system command after message processing option in the parameters tab of the file receiver adapter.
    I am working on a scenario wherein a batch file needs to be invoked after the file is written on the file system.
    So how do i invoke this batch file from the file reciever adapter ( Run Operating system command after message processing ).

    Hi,
    did you see this page?
    http://help.sap.com/saphelp_nwpi71/helpdata/en/44/556cb799c93677e10000000a114a6b/content.htm
    it shows all you need to know
    Regards,
    Michal KRawczyk

  • Unzip file using operating system command in file/ftp receiver adapter

    Hi,
    I'm wonderdering how to unzip a zip-file in the receiver file/ftp adapter. I know it is possible to do it using the 'Operating system command' feature, but somehow the command I use seems to be ignored! (I'm using SP14, unix).
    The command I entered is quite simple: unzip %F (also tried the %f, but i guess it doesn't really matter wich on I use).
    Is it possible that I'm unzipping to another directory than the one i expect? the unzip should be performed to/in the current directory, and assumingly current directory is the one stated in the 'Target Directory', right?
    Hope someone can clearify this issue for me.
    Best regards,
    Daniel

    Hi Daniel,
    It seems to me also, that the files are being unzipped to a different location than what you are expecting. The OS command might getting executed in some default location(i am trying to fnd that out)on the server and not in the target directory of the channel(It seems logical to me)....
    If you have time...pls try this out & see whether this would help...
    Have a shell script written with the following commands in them
    cd <path to target directory>
    unzip $1(filename from the channel)
    and in the OS command in the Channel give....
    <absolute path to the .sh file> %F
    Thanks,
    Renjith.

  • File Adapter 7.11 - set operating system command line dynamically

    Hi,
    is there any way to set the "Operating System Command Line" in the file adapter as ASMA / dynamic attribute?
    I need to set  a command line exec depending on some XSL mapping values.
    thx
    holger

    hi,
    >>>is there any way to set the "Operating System Command Line" in the file adapter as ASMA / dynamic attribute?
    >>>I need to set a command line exec depending on some XSL mapping values.
    think about this approach:
    you put the XSL values into the filename after the real name of the file
    in the batch script you use those values in order to execute a dynamic exe command
    after processing you just change the name of the file in the script by removing the xsl values
    simple ? I think so
    Regards,
    Michal Krawczyk

  • File Receiver Adapter:Run Operating System COmmand after message Processig:

    Dear All,
    I have gone through this link
    [http://help.sap.com/saphelp_nw2004s/helpdata/EN/e3/94007075cae04f930cc4c034e411e1/content.htm]
    But i have a problem.
    In the scenario which we have, File name is DYNAMICALLY GENERATED by a UDF
    I want to call the file at run time after message processing via Command Line and execute some os commands.
    But since the file name is Dynamic....How will i call the file at run time in Command Line:
    SYNTAX: %f(FileName)
    How will i specify the file name in the above syntax as the file name is Dynamic and not constatnt.
    Please Advice.
    Senthilprakash.

    Dear All,
    Yes just now i got the answer from this thread[OS command line script - Need help;
    Actually i have another doubt now
    In REVEIVER FILE ADAPTER:
    when we give Run Operating system Command After Message processing
    does the OS command get executed after the output file is placed in the Receiver folder/server or before its placed in the receiver folder?
    Regards,
    Senthilprakash.

  • Run operating system command for sender File adpter (NFS)

    Hi All,
    iam doing a file to RFC scenario, using 'Run operating system command' in sender file adapter to change the file name while archiving (after processing completed).
    I mention OS command like this:
    sample_server\scripts\Test\Rename.bat"
    Rename.bat file calls a 'perl script' code.
    when i run interface, could see below statement in adapter log ->
    "Execute OS command "
    sample_server\scripts\Test\Rename.bat"
    but the script was not run and file name was not changed.
    Please advice what could be the problem?
    Does this mean script executed successfully?
    Do i need install perl software on XI server, even perl script (.bat file) is executing on sample_server?
    Thanks in advance..
    Regards,
    Rajesh

    Hi,
    Just check the following URL and give it a try again :-
    Executing Unix shell script using Operating System Command in XI
    Hope this info Helps..
    Regards,
    Aditya

  • RUN OPERATING SYSTEM COMMAND BEFORE MESSAGE PROCESSING

    hi.
    just i want to know what is the purpose of run operating system command before message processing,after message processing under file sender adapter.
    waiting for your great answer.
    bye.
    regards.
    seeta ram.

    Hello Seeta,
    let me see if I give it using a simple scenario that I implamented : i nedd to transfer a very large file from one server to the other by XI.
    to save space and network traffic I use an OS command before picking up the file to run a zip command to zip the file.
    after I transfer the file to the target server I run another OS command after the transfer to unzip the file.
    now to your second question:
    the before Os command on the target server is used mostly for checks (make sure there isn't a file by that name or backing up existing data)
    and the after sender OS command is usualy for backing up or erasing existing files (cause it is done only after the first part was finished succesfully).
    Uri Lifshitz.
    p.s.
    there was a blog obout this titled "XI as a huge file mover"
    and you can see a description and my scripts at https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/2007/05/03/additionaltipsforusingXIasahugefiletransfer%28withbatchscripts%29&

Maybe you are looking for