Batch file execution

hi all
i need to execute two jsp files from html file, which has two push buttons. on click of button it should do that.how do i do this.

<obligatory>
Navigate yourself around pitfalls related to the Runtime.exec() method
</obligatory>

Similar Messages

  • Test Stand seq w/ dll batch file execution not working

    I am using Test Stand 4.1, running a seq that calls a dll.  The dll contains a batch file execution function that has not been working properly.  I am not 100% sure what the function is as I do not have access to the direct code from which the dll was created.  I believe I have a file, however please remember this is a guess that I am looking at the correct function/file. 
    This is a Pass/Fail test step that calls a batch file.  The batch file runs properly without the use of Test Stand and called by the dll.  In the code that I believe is running, I see there is a step that I am guessing does not run (see below for test steps).  It seems as though these steps are being "stepped over" and not running, however the test does seem to be entering this function.  The test reports a pass/fail status as the data is reported into a txt file.  If the txt file contains the correct data, the test step reports PASS, even though the batchfile does not run.
    :Note:  [batchfile.bat] is the name of the batch file being called; the [ ] are not present 
    // Run Batch File
     ChkErr(LaunchExecutableEx([batchfile.bat] ,windowState,&handle));   
     // Wait for batch file to complete task
     do{
      ProcessSystemEvents();
     }while(!ExecutableHasTerminated (handle));
     RetireExecutableHandle (handle);
    Any one have any suggestions as to why the batch file is not being called and running properly?
    Thank you
    Jason_C

    Thanks for the feed back.  I have realized and it seems as though sometimes the CWD varies.  The current working directory when the batch file does not run seems to be set to the desktop, not to the specified directory.  The batch file is used to program a chip, calling the exe to run using commands.  The file are speciifed by an absolute path, however the exe is not.  The batch file is as below and seems to match up with a problem with the CWD.  How can change though?  I will have to check in the Start in field, but where can I find that property? 
     Thank You
    --Jason
    del ..\misc\mplab.txt
    echo C:\Program Files\JTRS\01_P55461U\bin\uutsw\CR1_T2V3L_PMM_STUB_LOAD.hex
    ..\misc\pm3cmd /5 /BLCC:\Program Files\JTRS\01_P55461U\misc\t2v3l_pmm_stub_load\t2v3l_pmm_stub_load.pm3 /k /m /y /e >> ..\misc\mplab.txt >> ..\misc\mplab.txt
    ..\misc\pm3cmd /5 /BVCC:\Program Files\JTRS\01_P55461U\misc\t2v3l_pmm_stub_load\t2v3l_pmm_stub_load.pm3 >> ..\misc\mplab.txt

  • Batch file execution error in windows

    I am running 2 batch files . The 2nd one runs only after the execution of the 1st one. So while the 2nd one runs , i get the following error in command prompt:
    "The process cannot access the file because it is being used by another process."

    well, by the error message it may be nothing to do with java, maybe the second batch file is trying to do something that is generating the error. Or maybe your second batch file really needs to run after the batch 1 finishes to avoid the message. How are you running the batchs???
    if you do getRuntime ().exec ("batch1.bat");
    getRuntime ().exec ("batch2.bat");
    the the execution is being launched in paralel, exec () creates a new Process on the Operative Systems and runs the command but doesnt wait until it finishes! Are you checking that?

  • Doubt in batch file execution

    Hi ,
    I am execting a batch file from my code. Following after execution of batch file i need to do some manipulation with out put file that got from batch file. so wht i am doing is..
    String ParseBat = "cmd /c start \"parser - running\" /MIN execute.bat \""+filePath + "\" \""+logdestn.getAbsolutePath()+"\"";
             procParse = rt.exec(ParseBat);
    System.out.println(logdestn.length());  //Hereit is giving length of log file as 0. Wht i felt is it just coming to next execution line b4 the          procParse = rt.exec(ParseBat); code line finishes. i used procParse.waitFor(); but still not working. can u help me regarding this.
    thnx in advance.
    ram .t

    OK, I used two classes to do this. Both are taken from the URL I posted above. The first is a util to read the streams coming from the external process.
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    * A thread to read the error stream (STDERR), in case anything went wrong.
    public class ProcessStreamReader extends Thread {
        /** Our access to the incoming characters on the stream */
        private BufferedReader reader;
        /** The characters read from the stream are appended to this
         * StringBuffer.  */
        private StringBuffer buffer = new StringBuffer();
         * Constructor.  Builds a <code>BufferedReader</code>.
         * @param inputStream
        public ProcessStreamReader(InputStream inputStream) {
            InputStreamReader isr = new InputStreamReader( inputStream );
            reader = new BufferedReader( isr );
        /* (non-Javadoc)
         * Runs until the input stream is closed.
         * @see java.lang.Runnable#run()
        public void run() {
            try {
                // Take (and keep taking) a line from the reader.  This should go on
                // until the process dies.
                String temp;
                while (null != (temp = reader.readLine())) {
                    buffer.append( temp );
            } catch(IOException ioex) {
                ioex.printStackTrace();
         * @return Returns the contents of the buffer.
        public String getString() {
            return buffer.toString();
    }The next is the actual program that launches the external process and reads the results back.
    import java.io.File;
    import java.io.IOException;
    public class ExecTest {
         * @param args
        public static void main(String[] args) {
            try {
                // Configure
                String filePath = "test.data";
                File logDestination = new File("myLog.log");
                String path = "cmd /c start \"parser - running\" /MIN execute.bat \""+filePath + "\" \""+logDestination.getAbsolutePath()+"\"";
                System.out.println("> Starting process");
                Process process = Runtime.getRuntime().exec( path );
                System.out.println("> Start reading STDOUT and STDERR from the process");
                ProcessStreamReader inputStream = new ProcessStreamReader( process.getInputStream() );
                ProcessStreamReader errorStream = new ProcessStreamReader( process.getErrorStream() );
                inputStream.start();
                errorStream.start();
                System.out.println("> Waiting for the external process to complete.");
                process.waitFor();
                System.out.println("> Waiting for both reader threads to die");
                inputStream.join();   
                errorStream.join(); 
                System.out.println("> Checking to see that there nothing was reported on STDERR");
                String errString = errorStream.getString();
                if(errString != null && errString.trim().length() > 0) {
                   System.err.println("Problems occured while trying to access the external process: " + path);
                   System.err.println( errString );
                System.out.println("> Checking the STDOUT coming from the process.");
                String inString = inputStream.getString();
                System.out.println(inString);
                // Check for the existance of the log file
                if(logDestination.exists()) {
                    System.out.println("> Log file exists at: " + logDestination.getAbsolutePath());
                    // Check the length of the log file.
                    System.out.println( "> Log file length: " + logDestination.length());
                } else {
                    System.out.println("> Log file wasn't created.");
            } catch(IOException ioex) {
                ioex.printStackTrace();
            } catch(InterruptedException iex) {
                iex.printStackTrace();
    }I found that using the above class opened a DOS window and ran my version of execute.bat (which contained just "dir %1 > %2"). Up to that point, it wrote the following:
    Starting process
    Start reading STDOUT and STDERR from the process
    Waiting for the external process to complete.
    Waiting for both reader threads to die
    Checking to see that there nothing was reported on STDERR
    Checking the STDOUT coming from the process.It then paused until I closed the DOS window. At that point, it then wrote:
    Log file exists at: C:\Workspace\javatests\myLog.log
    Log file length: 258If I reduce the external path to:
    String path = "execute.bat \""+filePath + "\" \""+logDestination.getAbsolutePath()+"\"";Then the program returns the length of the log file instantly.
    If I remove all the code concerned with checking the STDOUT and STDERR streams of the external process, the same thing happens - it reads the log file length correctly.
    Perhaps you could use the above code to check that your batch file is actually producing a log file? Perhaps modifying the path that you're passign to the Runtime.getRuntime().exec would help?
    Cheers,
    John

  • Batch file execution using user defined activity

    Can anyone please explain me what is the structure of the user defined activity in order to execute batch file. I've read like 10 post about this problem in this forum but nothing seems to work. So to finally clear it out...
    I have simple batch file d:\test_dir\test.bat that has only one line in it "echo this is test>>test.txt"
    what should i put in the user defined activity setting?
    COMMAND = ?
    PARAMETER_LIST = ?
    RESULT_CODE = ?
    SCRIPT = ?
    SUCCESS_THRESHOLD = ?
    i have the setting in the runtime.properties file to:
    property.RuntimePlatform.0.NativeExecution.FTP.security_constraint = DISABLED
    property.RuntimePlatform.0.NativeExecution.Shell.security_constraint = NATIVE_JAVA
    property.RuntimePlatform.0.NativeExecution.SQLPlus.security_constraint = NATIVE_JAVA
    property.RuntimePlatform.0.NativeExecution.OMBPlus.security_constraint = DISABLED

    Did you read this blog?
    https://blogs.oracle.com/warehousebuilder/entry/how_to_use_user_defined_activity_in_owb_process_flow
    What error do you get? Did you stop/start the runtime service after changing the parameter file?
    Cheers
    David

  • Batch File Executions

    Is there any way to execute a .bat file from within the program? Or execute a program located somewhere on the computer with a set parameters?

    Runtime.getRuntime().exec("command.com /c mybat.bat");This will run a batch file in windoze 9x. For NT change the command to "cmd.exe /c mybat.bat".
    Mark

  • Batch file to "Disable" un-used plug-ins etc.

    Hi Folks!!
    I've got into the habit (from the good old, small PC, WinXP days) of disabling with the pre-fix ~ (tilde) method, all the presets and plug-ins that I never use as soon as I install Photoshop.
    Doing it manually in those days was not too much of a hardship as maybe, at worst twice a year.
    Now that I've upgraded(?) to Win7, I must have done a "clean" system re-install at least once a month, the manual method is getting a bit tedious.
    I'd like to have batch script(s) to automate/semi-automate the process so that I could open a command prompt at the root (C:\) and tell it to go to the swatches folder and prefix A, C, and D leaving B, E, and F untouched, then move on to the brushes folder, patterns folder, plug-ins folder etc. etc..
    I've got a list of my usual "suspects", I've tried to write one myself (with no knowledge of what I'm doing) and so far I've managed to (luckily, but not repeated!!) get the first one on the list renamed followed by 50 or so "The *** path is not recognised/ The *** path is not a correct command/ The syntax is incorrect/ That's not your dog on your path" etc. etc.
    Is this at all possible? I'd settle for several batch files, one for each folder, that I could just type their names in whilst looking at my pretty desktop instead of traipsing through the system folders, if that's what it takes.
    HELP!!
    Yours
    Raggedy Round The Edges
    Elmer (very) B. Fuddled
    Message was edited by: Elmer B. Fuddled  Speeling Mistooks

    Thanks for your response Noel,
      A corrected link to M$ answers (maybe) 
    Originally i did do a lot of the "disabling" to save space when I was running WinXP on an old Packard Bell with a 60gb main HDD (don't laugh, that was an "upgrade" from the 20gb HDD!!) Now I've gone up in the world to Win7 with (to me) a huge 320gb HDD it's more an aesthetics / efficiency thing.
    First example, the  drop down window you get when you hit "Save As..."
    I've never yet used any of the formats in PS high-lighted in green, the yellows are "very seldom used" and the rest, yes I do use. So if I can "hide" the ones I don't use, and I know I can't hide them all, the ones I do use are not hiding in a multitude of others.
    When it comes to the Colour Swatches, not books, in the Preset Manager, after I've loaded my own "ICO" files it can get quite horrendous!!
    The Full House
    Now after I've removed all the Pantone etc. that I never touch, leaving only a couple I was "advised" to on t'interweb plus my own collection of palettes, some of which may only contain four colours..
    Oooh!! I can see me canvas again!!
    So much neater!
    Bear in mind I'm not actually deleting anything so if I ever do need them, they are only a tilde away!!
    I disable any plug-ins I don't, didn't or couldn't use when on WinXP due to hardware  restraints (well the PC was salvaged from a skip!!) and I've managed to live without them.
    The same sort of thing goes for the brushes, I've assembled my own .abr's from the supplied Adobe sets that I may only just use and disabled all the rest.
    For brushes you can also read File Formats, Actions, Custom Shapes and Gradients
    The script "Wot I Ave Wrote" looks like this (abridged)
    @echo off cls
    set windrive=%1
    echo The Adobe installed Plug-ins and Presets listed in the "Read Me" file will
    echo will be prepended with a tilde (~) which will disable/hide them.
    echo.
    echo Do you wish to continue?
    set /p choice=Please press "Y" for yes or "N" for no: 
    if %choice%==y goto moveon
    if %choice%==n goto dontmove
    :moveonren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Cineon.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Cineon.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Dicom.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Dicom.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\FastCore.8BX" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~FastCore.8BX"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\JPEG2000.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~JPEG2000.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\MMXCore.8BX" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~MMXCore.8BX"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\PBM.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~PBM.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Pixar.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Pixar.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Radiance.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Radiance.8BI"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Standard MultiPlugin.8BF" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\~Standard MultiPlugin.8BF"
    ren "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\WBMP.8BI" "C:\PROGRAM FILES (X86)\ADOBE\ADOBE BRIDGE CS5\Plug-Ins\Import-Export\~FireWire Export.8BE"
    echo .
    echo .
    echo Whoopy Doo!!! Won't be seeing those again unless you want to! :-)
    echo . 
    pause
    exit /B n
    :dontmove
    echo .  
    echo The Batch File execution has been cancelled.
    pause
    And that's about it, all the red bits I've borrowed from elsewhere so I'm none the wiser of what they really do!!
    Any sites I've "visited" tell me that /1 /2 %WhoKnows% does "X", but not why it does!! So I gave up 
    Oh, BTW, using bridge as my guinea-pig as I never use it.
    Could never get it to run on me XP machine so I looked elsewhere and I've never looked back again.
    Regards
    Elmer (more bemused than)B. Fuddled
    Message was edited by: Elmer B. Fuddled  Resizing images

  • Execution of a batch file within SSIS fails in Sql Server Agent Job

    Hi All,
    I have an SSIS Package, which simply runs a batch file , the code for the batch file is
    MOVE \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts\* \\cambosnapp01\Claims\Analytics\NICB\AlertsArchive
    If i run the SSIS package manually it runs fine and moves all the files, however if i run the package through a Sql Agent Job it fails with the following error
    The directory "\\Cambosnapp01\Claims\Analytics\NICB" does not exist
    This is where the batch file is located, i am not able to understand if the SSIS package is running fine then why not the sql agent job?
    I also tried to create a sql agent job using Operating System(CmdExec) and i copied my batch file code in the command i am running it as SQL Server Agent Service Account , and here it fails as
    Executed as user: CAMELOT\svcDW. Access is denied.  Process Exit Code 1.  The step failed
    Does this mean this user doesnt have the rights to excute a batch file? how did this user even come up i am not running it from this user i am running it from SQL Server Agent Service Account . I dont know who is that user and if he even has the rights to
    execute a batch file.
    Can someone please help me with any solution for this? either first way or second way anything works fine for me.
    Thanks

    Hi SQLDEV,
    According to your description, you are experiencing the issue "The directory "\\Cambosnapp01\Claims\Analytics\NICB" does not exist" when run the SSIS package
    in SSMS by using SQL Server Agent, right?
    In your scenario, since you can run the package in SSDT manually. So as per my understanding, the issue can be caused by that the Services Account of your SQL Server Agent do not have the permission on that folder. To avoid this issue, you can set the folder
    permission for your SQL Server Agent account or change the services account to an account who have the corresponding permission. Please refer to the link below to see the details.
    https://msdn.microsoft.com/en-us/library/bb727008.aspx
    https://msdn.microsoft.com/en-us/library/ms345578.aspx
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Execution of a batch file fails if the batch file has a date

    Hi All,
    I have a batch file which copies files from one folder to another based on the date condition( if the files are modified or created today copy them). Below is my code
    set curr_date=%DATE:~4,2%/%DATE:~7,2%/%DATE:~10,4% & XCOPY \\cambosnapp01\FileTransfers\InboundToHomesite\NICB\Entities \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts/d:%curr_date%
    This batch file runs fine if i run it manually, but i want to run this in an ssis package, i am using an execute process task and in the executable i gave the location of this batch file, and if i run the package it fails.However if i just exclude the last
    date thing from the batch file and run the below one it runs fine.
    set curr_date=%DATE:~4,2%/%DATE:~7,2%/%DATE:~10,4% & XCOPY \\cambosnapp01\FileTransfers\InboundToHomesite\NICB\Entities \\cambosnapp01\Claims\Analytics\NICB\CurrentAlerts/d
    But this batch file would copy all the files which i dont need. I only want to copy the new files and thats the reason i use the date in the end but for some reason it fails.
    Can someone please help me with any suggestions on this?
    Please let me know if you have any questions or if i am still unclear.
    Thanks

    What is the error you are getting?
    Why don't you want to use the FileSystem task that is parameter driven?
    Running the bat file manually vs as a package has a difference.
    Do you run it while the package is in development (via SSDT)?
    You only gave the bat file, but how did you set your task in SSIS not.
    Arthur
    MyBlog
    Twitter

  • Guide to External Jobs on 10g with dbms_scheduler e.g. scripts,batch files

    GUIDE TO RUNNING EXTERNAL JOBS ON 10g WITH DBMS_SCHEDULER
    NOTE: Users using 11g should use the new method of specifying a credential which eliminates many of the issues mentioned in this note.
    This guide covers several common questions and problems encountered when using
    dbms_scheduler to run external jobs, either on Windows or on UNIX.
    What operating system (OS) user does the job run as ?
    External jobs which have a credential (available in 11g) run as the user
    specified in the credential. But for jobs without credentials including
    all jobs in 10gR1 and 10gR2 there are several cases.
    - On UNIX systems, in releases including and after 10.2.0.2 there is a file $ORACLE_HOME/rdbms/admin/externaljob.ora . All external jobs not in the SYS schema and with no credential run as the user and group specified in this file. This should be nobody:nobody by default.
    - On UNIX systems, in releases prior to 10.2.0.2 there was no "externaljob.ora" file. In this case all external jobs not in the SYS schema and with no credential run as the owner and group of the $ORACLE_HOME/bin/extjob file which should be setuid and setgid. By default extjob is owned by nobody:nobody except for oracle-xe where it is owned by oracle:oraclegroup and is not setuid/setgid.
    - On Windows, external jobs not in the SYS schema and with no credential run as the user that the OracleJobScheduler Windows service runs as. This service must be started before these jobs can run.
    - In all releases on both Windows and UNIX systems, external jobs in the SYS schema without a credential run as the oracle user.
    What errors are reported in SCHEDULERJOB_RUN_DETAILS views ?
    If a job fails, the first place to look for diagnostic information is the SCHEDULERJOB_RUN_DETAILS set of views. In 10gR2 and up the first 200 characters of the standard error stream is included in the additional_info column.
    In all releases, the error number returned by the job is converted into a
    system error message (e.g. errno.h on UNIX or net helpmsg on Windows) and that
    system error message is recorded in the additional info column. If there is no
    corresponding message the number is displayed.
    In 11g and up the error number returned by the job is additionally recorded in
    the error# column. In earlier releases 27369 would always be recorded in the
    error# column.
    Generic Issues Applicable to UNIX and Windows
    - The job action (script or executable) must return 0 or the job run will be marked as failed.
    - Always use the full pathname to executables and scripts.
    - Do not count on environment variables being set in your job. Make sure that the script or executable that your jobs runs sets all required environment variables including ORACLE_HOME, ORACLE_SID, PATH etc.
    - It is not recommended to pass in a complete command line including arguments as the action. Instead it is recommended to pass in only the path to and name of the executable and to pass in arguments as job argument values.
    - Scripts with special characters in the execution path or script name may give problems.
    - Ensure that the OS user your job runs as has the required privileges/permissions to run your job. See above for how to tell who the job runs as.
    - External job actions cannot contain redirection operators e.g. > < >> | && ||
    - In general try getting a simple external job working first e.g. /bin/echo or ipconfig.exe on Windows. Also try running the job action directly from the commandline as the OS user that the job will run as.
    Windows-specific Issues
    - The OracleJobScheduler Windows service must be started before external jobs will run (except for jobs in the SYS schema and jobs with credentials).
    - The user that the OracleJobScheduler Windows service runs as must have the "Log on as batch job" Windows privilege.
    - A batch file (ending in .bat) cannot be called directly by the Scheduler. Instead cmd.exe must be used and the name of the batch file passed in as an argument. For example
    begin
    dbms_scheduler.create_job('myjob',
       job_action=>'C:\WINDOWS\SYSTEM32\CMD.EXE',
       number_of_arguments=>3,
       job_type=>'executable', enabled=>false);
    dbms_scheduler.set_job_argument_value('myjob',1,'/q');
    dbms_scheduler.set_job_argument_value('myjob',2,'/c');
    dbms_scheduler.set_job_argument_value('myjob',3,'c:\temp\test.bat');
    dbms_scheduler.enable('myjob');
    end;
    /- In 10gR1 external jobs that wrote to standard output or standard error streams would sometimes return errors. Redirect to files or suppress all output and error messages when using 10gR1 to run external jobs.
    UNIX-specific Issues
    - When running scripts, make sure that the executable bit is set.
    - When running scripts directly, make sure that the first line of the script in a valid shebang line - starting with "#!" and containing the interpreter for the script.
    - In release 10.2.0.1, jobs creating a large amount of standard error text may hang when running (this was fixed in the first 10.2.0.2 patchset). If you are seeing this issue, redirect standard error to a file in your job. This issue has been seen when running the expdp utility which may produce large amounts of standard error text.
    - the user that the job runs as (see above section) must have execute access on $ORACLE_HOME/bin and all parent directories. If this is not the case the job may be reported as failed or hang in a running state. For example if your $ORACLE_HOME is /opt/oracle/db then you would have to make sure that
    chmod a+rx /opt
    chmod a+rx /opt/oracle
    chmod a+rx /opt/oracle/db
    chmod a+rx /opt/oracle/db/bin
    - On oracle-xe, the primary group of your oracle user (if it exists) must be dba before you install oracle-xe for external jobs to work. If you have an oracle user from a regular Oracle installation it may have the primary group set to oinstall.
    - On oracle-xe, the extjobo executable is missing so external jobs in the SYS schema will not work properly. This can be fixed by copying the extjob executable to extjobo in the same directory ($ORACLE_HOME/bin).
    - Check that correct permissions are set for external job files - extjob and externaljob.ora (see below)
    Correct permissions for extjob and externaljob.ora on UNIX
    There is some confusion as to what correct permissions are for external job related files.
    In 10gR1 and 10.2.0.1 :
    - rdbms/admin/externaljob.ora should not exist
    - bin/extjob should be setuid and setgid 6550 (r-sr-s---). It should be owned by the user that jobs should run as and by the group that jobs should run as.
    - bin/extjobo should have normal 755 (rwxr-xr-x) permissions and be owned by oracle:oraclegroup
    In 10.2.0.2 and higher
    - rdbms/admin/externaljob.ora file must must be owned by root:oraclegroup and be writable only by the owner i.e. 644 (rw-r--r--) It must contain at least two lines: one specifying the run-user and one specifying the run-group.
    - bin/extjob file must be also owned by root:oraclegroup but must be setuid i.e. 4750 (-rwsr-x---)
    - bin/extjobo should have normal 755 (rwxr-xr-x) permissions and be owned by oracle:oraclegroup
    In 11g and higher
    Same as 10.2.0.2 but additionally bin/jssu should exist with root setuid
    permissions i.e. owned by root:oraclegroup with 4750 (-rwsr-x---)
    Internal Error numbers for UNIX on 10.2.0.2 or 10.1.0.6 or higher
    If you are not using a credential and are using version 10.2.0.2 or higher or 10.1.0.6 or higher you may come across an internal error number. Here are the meanings for the internal error numbers.
    274661 - can't get owner of or permissions of externaljob.ora file
    274662 - not running as root or externaljob.ora file is writable by group or other or externaljob.ora file not owned by root (can't switch user)
    274663 - setting the group or effective group failed
    274664 - setting the user or effective user failed
    274665 - a user or group id was not changed successfully
    274666 - cannot access or open externaljob.ora file
    274667 - invalid run_user specified in externaljob.ora file
    274668 - invalid run_group specified in externaljob.ora file
    274669 - error parsing externaljob.ora file
    274670 - extjobo is running as root user or group

    Hi Ravi,
    Can you help me...
    Hi All,
    I planned to create a job to do rman backup daily at 04:00 AM.
    1. I created a program as follows
    BEGIN
    DBMS_SCHEDULER.CREATE_PROGRAM(
    program_name => 'rman_backup_prg',
    program_action => '/u02/rmanback/rman.sh',
    program_type => 'EXECUTABLE',
    comments => 'RMAN BACKUP');
    END;
    my rman script is
    #!/usr/bin/ksh
    export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
    export PATH=$PATH:/u01/app/oracle/product/10.2.0/db_1/bin
    /u01/app/oracle/product/10.2.0/db_1/bin/exp rman/cat@catdb file=/u02/rmanback/rm
    an_220108.dmp log=/u02/rmanback/rman_220108.log owner=rman statistics=none comp
    ress=n buffer=400000
    compress *.dmp
    exit
    2. I created a schedule as follows
    BEGIN
    DBMS_SCHEDULER.CREATE_SCHEDULE(
    schedule_name => 'rman_backup_schedule',
    start_date => SYSTIMESTAMP,
    end_date => '31-DEC-16 05.00.00 AM',
    repeat_interval => 'FREQ=DAILY; BYHOUR=4',
    comments => 'Every day at 4 am');
    END;
    3. I created ajob as follows.
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'rman_backup_job',
    program_name => 'rman_backup_prg',
    schedule_name => 'rman_backup_schedule',
    enabled=> true,
    auto_drop=> false
    END;
    While I am running the job I am getting the following error anybody help me.
    ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
    ORA-06512: at "SYS.DBMS_ISCHED", line 150
    ORA-06512: at "SYS.DBMS_SCHEDULER", line 441
    ORA-06512: at line 2
    If I removed "compress *.dmp" line in rman script it is working fine.
    /* additional Info from dba_scheduler_job_run_details as follows */
    ORA-27369: job of type EXECUTABLE failed with exit code: Not owner
    STANDARD_ERROR="
    Export: Release 10.2.0.3.0 - Production on Tue Jan 22 14:30:08 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Release 10.2.0.3.0 - Production
    Export"
    Regards,
    Kiran

  • PL/SQL w/ Java to run OS batch file crashes Oracle

    I followed instructions from "Ask Tom" on using PL/SQL with Java to execute an OS batch file. For testing purposes, my batch file does nothing more than display the date and time from the OS.
    However, when I run the PL/SQL that executes this simple batch file repeatedly - anywhere from two to four times, the Oracle instance crashes abruptly. Nothing is written to the alert log. No trace files are created.
    Here is a sample session:
    SQL*Plus: Release 9.0.1.3.0 - Production on Wed Mar 24 10:04:26 2004
    (c) Copyright 2001 Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> set serveroutput on size 1000000
    SQL> exec dbms_java.set_output(1000000) ;
    PL/SQL procedure successfully completed.
    SQL> begin
    2 rc('c:\dba_tools\jobs\test.cmd') ;
    3 end ;
    4 /
    C:\Ora9ir2\DATABASE>date /t
    Wed 03/24/2004
    C:\Ora9ir2\DATABASE>time /t
    10:05 AM
    PL/SQL procedure successfully completed.
    SQL> begin
    2 rc('c:\dba_tools\jobs\test.cmd') ;
    3 end ;
    4 /
    C:\Ora9ir2\DATABASE>date /t
    Wed 03/24/2004
    C:\Ora9ir2\DATABASE>time /t
    10:06 AM
    PL/SQL procedure successfully completed.
    SQL>
    Shortly after the second "run", Oracle crashed. All I received was the following error message:
    Unhandled exception in oracle.exe (ORAJOX9.DLL): 0xC0000005: Access Violation
    Here is the Java procedure at the heart of my PL/SQL:
    create or replace and compile
    java source named "Util"
    as
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static int RunThis(String args)
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    try
    Process p = rt.exec(args);
    int bufSize = 4096;
    BufferedInputStream bis =
    new BufferedInputStream(p.getInputStream(), bufSize);
    int len;
    byte buffer[] = new byte[bufSize];
    // Echo back what the program spit out
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    rc = p.waitFor();
    catch (Exception e)
    e.printStackTrace();
    rc = -1;
    finally
    return rc;
    I am running Oracle 9i rel. 2 installed on my PC under Windows XP Professional (Service Pack 2). My knowledge of Java is next to nothing.
    Can anyone give me an idea(s) as to what might be causing Oracle to crash?
    Thanks.

    Using 9.2.0.4 I made the following adjustments and it seems to run as often as I care to do it:
    Java changes:
    create or replace and compile
    java source named "Util"
    as
    import java.io.*;
    import java.lang.*;
    public class Util extends Object
    public static void RunThis(java.lang.String args)
    Runtime rt = Runtime.getRuntime();
    int rc = -1;
    try
    Process p = rt.exec(args);
    int bufSize = 4096;
    BufferedInputStream bis =
    new BufferedInputStream(p.getInputStream(), bufSize)
    int len;
    byte buffer[] = new byte[bufSize];
    // Echo back what the program spit out
    while ((len = bis.read(buffer, 0, bufSize)) != -1)
    System.out.write(buffer, 0, len);
    rc = p.waitFor();
    catch (Exception e)
    e.printStackTrace();
    finally
    PL/SQL Wrapper :
    create or replace procedure rc (cmd VARCHAR2) as
    language java name 'Util.RunThis(java.lang.String)';
    Execution:
    begin
    rc('c:\dba_tools\jobs\test.cmd');
    end ;
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:48 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:48 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:49 AM
    PL/SQL procedure successfully completed.
    SQL> /
    D:\oracle\ora92\DATABASE>date /t
    Fri 03/26/2004
    D:\oracle\ora92\DATABASE>time /t
    10:50 AM
    PL/SQL procedure successfully completed.
    SQL>
    The only thing I really changed was the reurn value from the java procedure. If it has a return value then it should be declared as a function, not a procedure. Since you probably (apparently) weren't using the return value I dropped it and made it a procedure.

  • How do I make a batch file if the .class file uses a foreign package?

    I am trying to make an MS-DOS batch file using the bytecode file from the Java source file, called AddFields.java. This program uses the package BreezySwing; which is not standard with the JDK. I had to download it seperately. I will come back to this batch file later.
    But first, in order to prove the concept, I created a Java file called Soap.java in JCreator. It is a very simple GUI program that uses the javax.swing package; which does come with the JDK. The JDK is currently stored in the following directory: C:\Program Files\Java\jdk1.6.0_07. I have the PATH environment variable set to the 'bin' folder of the JDK. I believe that it is important that this variable stay this way because C:\Program Files\Java\jdk1.6.0_07\bin is where the file 'java.exe' and 'javac.exe' are stored. Here is my batch file so far for Soap:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java Soap
    pause
    Before I ran this file, I compiled Soap.java in my IDE and then ran it successfully. Then I moved the .class file to the directory C:\acorn. I put NOTHING ELSE in this folder. then I told the computer where to find the file 'java.exe' which I know is needed for execution of the .class file. I put the above text in Notepad and then saved it as Soap.bat onto my desktop. When I double click on it, the command prompt comes up in a little green box for a few seconds, and then the GUI opens and says "It Works!". Now that I know the concept of batch files, I tried creating another one that used the BreezySwing package.
    After I installed my JDK, I installed BreezySwing and TerminalIO which are two foreign packages that make building code much easier. I downloaded the .zip file from Lambert and Osborne called BreezySwingAndTerminalIO.zip. I extracted the files to the 'bin' folder of my JDK. Once I did this, and set the PATH environment variable to the 'bin' folder of my JDK, all BreezySwing and TerminalIO programs that I made worked. Now I wanted to make a batch file from the program AddFields.java. It is a GUI program that imports two packages, the traditional GUI javax.swing package and the foreign package BreezySwing. The user enters two numbers in two DoubleField objects and then selects one of four buttons; one for each arithmetic operation (add, subtract, multiply, or divide). Then the program displays the solution in a third DoubleField object. This program both compiles and runs successfully in JCreator. So, next I moved the .class file from the MyProjects folder that JCreator uses to C:\acorn. I put nothing else in this folder. The file Soap.class was still in there, but I did not think it would matter. Then I created the batch file:
    @echo off
    cd \acorn
    set path=C:\Program Files\Java\jdk1.6.0_07\bin
    set classpath=.
    java AddFields
    pause
    As you can see, it is exactly the same as the one for Soap. I made this file in Notepad and called it AddFields.bat. Upon double clicking on the file, I got this error message from command prompt:
    Exception in thread "main" java.lang.NoClassDefFoundError: BreezySwing/GBFrame
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    4)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    Caused by: java.lang.ClassNotFoundException: BreezySwing.GBFrame
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    ... 12 more
    Press any key to continue . . .
    I know that most of this makes no sense; but that it only means that it cannot find the class BreezySwing or GBFrame (which AddFields extends). Notice, however that it does not give an error for javax.swing. If I change the "set path..." command to anything other than the 'bin' folder of my JDK, I get this error:
    'java' is not recognized as an internal or external command,
    operable program or batch file.
    Press any key to continue . . .
    I know this means that the computer cannot find the file 'java.exe' which I believe holds all of the java.x.y.z style packages (native packages); but not BreezySwing or any other foreign packages. Remember, I do not get this error for any of the native Java packages. I decided to compare the java.x.y.z packages with BreezySwing:
    I see that all of the native packages are not actually visible in the JDK's bin folder. I think that they are all stored in one of the .exe files in there because there are no .class files in the JDK's bin folder.
    However, BreezySwing is different, there is no such file called "BreezySwing.exe"; there are just about 20 .class files all with names like "GBFrame.class", and "GBActionListener.class". As a last effort, I moved all of these .class files directly into the bin folder (they were originally in a seperate folder called BreezySwingAndTerminalIO). This did nothing; even with all of the files in the same folder as java.exe.
    So my question is: What do I need to do to get the BreezySwing package recognized on my computer? Is there possibly a download for a file called "BreezySwing.exe" somewhere that would be similar to "java.exe" and contain all of the BreezySwing packages?

    There is a lot of detail in your posts. I won't properly quote everything you put (too laborious). Instead I'll just put your words inside quotes (").
    "..there are some things about the interface that I do not like."
    Like +what?+ This is not a help desk, and I would appreciate you participating in this discussion by providing details of what it is about the 'interface' of webstart that you 'do not like'. They are probably misunderstandings on your part.
    "Some of the .jar files I made were so dangerously corrupt, that I had to restart my computer before I could delete them."
    Corrupt?! I have never once had the Java tools produce a corrupt Jar. OTOH, the 'cannot delete' problem might relate to the JRE gaining a file lock on the archive at run-time. If the file lock persisted after ending the app., it suggests that the JRE was not properly shut down. This is a bug in the code and should be fixed. Deploying as .class files will only 'hide' the problem (from casual inspection - though the Task Manager should show the orphaned 'java' process).
    "I then turned to batch files for their simple structure and portability (I managed to successfully transport a java.util containing batch file from my computer to another). This was what I did:
    - I created a folder called Task
    - Then I copied three things into this folder: 1. The file "java.exe" from my JDK. 2. The program's .class file (Count.class). and 3. The original batch file.
    - Then I moved the folder from a removable disk to the second computer's C drive (C:\Task).
    - Last, I changed the code in the batch file...:"
    That is the +funniest+ thing I've heard on the forums in the last 72 hours. You say that is easy?! Some points.
    - editing batch files is not scalable to 100+ machines, let alone 10000+.
    - The fact that Java worked on the target machine was because it was +already installed.+ Dragging the 'java.exe' onto a Windows PC which has no Java will not magically make it 'Java enabled'.
    And speaking of Java on the client machine. Webstart has in-built mechanisms to ensure that the end user has the minimum required Java version to run the app. - we can also use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#deplToolkit] on the original web page, to check for minimum Java before it puts the link to download/install the app. - if the user does not have the required Java, the script should guide them through installing it.
    Those nice features in deployJava.js are available to applets and apps. launched using webstart, but they are not available for (plain) Jar's or loose class files. So if 'ensuring the user has Java' is one of the requirements for your launch, you are barking up the wrong tree by deploying loose class files.
    Note also that if you abandon webstart, but have your app. set up to work from a Jar, the installation process would be similar to above (though it would not need a .bat file, or editing it). This basic strategy is one way that I provide [Appleteer (as a downloadable ZIP archive)|http://pscode.org/appleteer/#download]. Though I side-step your part 1 by putting the stuff into a Jar with the path Appleteer/ - when the user expands the ZIP, the parts of the app. are already in the Appleteer directory.
    Appleteer is also provided as a webstart launched application (and as an applet). Either of those are 'easier' to use than the downloadable ZIP, but I thought I would provide it in case the end user wants to save it to disk and transport the app. to a machine with no internet connection, but with Java (why they would be testing applets on a PC with no internet connection, I am not sure - but the option is there).
    "I know that .jar and .exe files are out because I always get errors and I do not like their interfaces. "
    What on earth are you talking about? Once the app. is on-screen, the end user would not be able to distinguish between
    1) A Jar launched using a manifest.
    2) A Jar launched using webstart.
    3) Loose class files.
    Your fixation on .bat files sounds much like the adage that 'If the only tool you have is a hammer, every job starts to look like a nail'.
    Get over them, will you? +Using .bat files is not a practical way to provide a Java app. to the end user+ (and launching an app. from a .bat looks quite crappy and 'second hand' to +this+ user).
    Edit 1:
    The instructions for running Appleteer as a Jar are further up the page, in the [Running Appleteer: Application|http://pscode.org/appleteer/#application] section.
    Edited by: AndrewThompson64 on May 19, 2009 12:06 PM

  • File Receiver Adapter Batch File Not Invoking:

    Dear All,
    I am trying to invoke a Batch file in the Receiver File Adapter after Message processing.
    The Batch file is not at all getting invoked at all. i dunno whats the reason. Please help.
    Below is the Format in which i gave the batch file:
    F://Test//prakash//Endseperator.bat %F
    then i tried:
    F:\Test\prakash\Endseperator.bat %F
    then i tried
    F:
    Test
    prakash
    Endseperator.bat %F      each folder seperated by '
    ' whixh cannot be seen here.
    below is the batch file content of Endseperator.bat :
    F:
    cd "Test\prakash"
    java Endseperator "%F" "%F"
    Its working perfect when i manual execute the batch file. But i am not able to invoke via Receiver file Adapter.
    Please Advice.
    Regards,
    Senthilprakash.
    Edited by: senthilprakash selvaraj on Dec 18, 2008 11:47 AM
    Edited by: senthilprakash selvaraj on Dec 18, 2008 11:48 AM
    Edited by: senthilprakash selvaraj on Dec 18, 2008 11:49 AM

    Hi Senthilprakash,
    I guess you must know that the batch file must exist on the XI server, not on your local machine.
    if yes, try with one / like:
    F:/Test/prakash/Endseperator.bat %F
    Make sure the user <sid>adm (in case of Unix) or SAPService<SID> (in case of windows) has the execution right of your program.
    Jayson

  • Running a Batch File on another Server with an Oracle Job

    hi, i have the following code
    BEGIN
    DBMS_SCHEDULER.CREATE_JOB (
    job_name => 'test_job_bat',
    job_type => 'EXECUTABLE',
    job_action => '\\10.1.1.63\test\test.bat',
    enabled => true,
    comments => 'test bat'
    END;
    So i want to run a batch file, which lies on another pc in the network
    The code runs, without a failure.
    The bat file just contains "MD D:\bla" .
    When i run the code, no bla directory is created, so it seems that the batch file never ran.
    i approved read/write on the test folder. (Windows 7 machine)
    any ideas?
    Edited by: user1067632 on 31.05.2010 05:03
    in dba_scheduler_job_run_details the job is listed as FAILED:
    ORA-27370: Job-Unterprozess konnte einen Job vom Typ EXECUTABLE nicht starten
    ORA-27300: BS-abhängiger Vorgang accessing execution agent mit Status: 2 nicht erfolgreich
    ORA-27301: BS-Fehlermeldung: Das System kann die angegebene Datei nicht finden.
    ORA-27302: Fehler aufgetreten bei: sjsec 6a
    ORA-27303: Zusätzliche Informationen: Das System kann die angegebene Datei nicht finden.
    Edited by: user1067632 on 31.05.2010 05:16

    ok sorry, i made my testjob run, the OracleJobScheduler was not started.
    But now i ran into an another Problem.
    Now i want to java bla.jar in my batch, and got that new error
    ORA-27369: Job vom Typ EXECUTABLE nicht erfolgreich mit Exit-Code: Unzulässige Funktion.
    STANDARD_ERROR="Unable to access jarfile start.jar"
    anything to consider when accessing .jar files in my batch?
    edit:
    there was a classpath problem.
    Edited by: ginkgo on 01.06.2010 04:29

  • How to run a batch file using tigger....

    Hi, i am trying run a batch file using a trigger on a table.
    say i have a table XYZ(col_1 varchar2 primary key, col_2 varchar2)
    the values of col_2 keeps changing and col_1 are constant
    whenever the value of col_2 in any row changes from "on" to "off" i want to run a batch file C:\Users\ABC\Desktop\test.bat
    i did some searching but couldn't find any solution. Thanks in advance
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    sorry wrong foum to post.
    will post in the correct one
    how to run batch file using trigger?

    Hallo,
    welcome to the forum.
    This is the forum for the tool {forum:id=260}. Your question should be placed in {forum:id=75} or {forum:id=61}.
    When you post your question there please provide additional information like db version, what kind of trigger you want to use, how you want to prevent the execution when the transaction is rolled back... {message:id=9360002}
    Regards
    Marcus

Maybe you are looking for