About EasyMorph Tutorials & Examples Web-help

Running a .bat file - EasyMorph fails with Exit code 1 - runs fine manually

I’m having some issues running a .bat file from EasyMorph’s run command. When I run the bat file manually from the commandline it runs fine. This batch file is calling SQLLDR to load data into our data base. When I try to run the batch file from EasyMorph, I get an exit code of 1. A bit perplexed here. Thoughts?

Hi Trevor,

configure the “Run program” action that runs the .bat file as below.

image

The output will catch the execution error which may help you investigate the problem.

@dgudkov, here a little more context, we can get the file to run locally on a laptop, but when we try to run it on the server things don’t seem to run properly (even in EasyMorph Desktop). I’m wondering if it’s a permissions/access issue for the user running the process.

Which user does EasyMorph run as? Is that the same user it uses when it opens the windows shell (cmd)? We’re on Windows Server 10.

I receive the following error when trying to call sqllder.exe directly
Error: External program failed with exit code -1073741515; path=C:\Oracle\product\12.2.0\client_64\bin\sqlldr.exe; args=‘user/pw’ CONTROL=accedian_export-Copy.ctl skip=1; workdir=E:\dummy
Source: action “Run program”, module “Generate Sequence”, table “Table 1”

If I try to call sqlldr directly in the arguments, I get an exit code of 1 and effectively says it can’t find the sqlldr command. As mentioned above, I feel like this may be related to how EasyMorph is running the command prompt or something on the server is preventing EasyMorph from running cmd with the right permissions/visibility. Any thoughts?

Thanks!

EasyMorph Desktop runs under the account of the user who launched it. EasyMorph Server by default runs under a special account for Windows services - NT AUTHORITY/LocalService.

Oracle may require certain system variables (e.g. ORACLE_HOME) set in order to run correctly. You may need to include setting these variables in your batch script.

You can check if these variables are set when your run the batch script. For instance, run the “Run program” action with the command below and capture the output as I described above:

echo $ORACLE_HOME

If needed, check other variables that must be set in order for Oracle utilities to run.

@dgudkov, thanks for pointing me in the right direction. Looks like there were a few things going on but I think I’ve been able to resolve them. Biggest help was simply restarting EasyMorph Desktop. Second, I set the Oracle Home explicitly.

Ran into some issues with the job not running via the server scheduler, but that seemed related to a bunch of disabled actions which I just re-enabled.

To learn more about EasyMorph visit easymorph.com.