?
Solved

Prolems when calling an .exe file from SQL server job...

Posted on 2003-03-20
15
Medium Priority
?
983 Views
Last Modified: 2008-02-01
I have created a job that has one step that calls small program with "CmdExec" command (Operating System Command). This job is currently installed on 20 different computers. The job doesn't run correctly on one of these computers.

It seems that the SQL server has some problems when using CmdExec command.
When I run the job on that computer I'll receive an following error message:
"Application error !  The application failed to initialize properly (0xc0000142), Click on Ok to terminate the application".

When I run my program from command prompt I works OK. The programs doesn't have
interface and normally it takes som 5-10 minutes to terminate the execution.

Computer configuration: Windows 2000 Pro SP2 + SQL2000

What could be a problem ? Everything was running smoothly until last week when this problem first came up.
0
Comment
Question by:vpalmu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
15 Comments
 
LVL 13

Expert Comment

by:ispaleny
ID: 8177568
Several questions, all about the problematic server.
-----------------------------------------------------------
1. Can you run it from command line (CMD.EXE) ?
2. Can you run it from SQL server ?
 exec master.dbo.xp_cmdshell 'commandline'
3. Startup account of SQL Server ?
4. Startup account of SQL Server Agent ?
0
 

Expert Comment

by:amaronjob
ID: 8179385
Try by changing the path:

"C:\Documents and Settings\Administrator\Desktop\New Folder\file.exe"
or
"C:\DOCUME~1\ADMINI~1\DESKTOP\NEWFOL~1\FILE.EXE"

0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8179612
vpalmu,

It can be a problem of file permissions, COM permissions,  filesystem SQL Server Agent or any other.

But you must reply first !!!!

You can try installing of W2K SP3 and SQL2K SP3.
This can prevent most issues.

(Windows 2000 Pro -> MSDE)?

0
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 

Author Comment

by:vpalmu
ID: 8180342
amanronjob,

I'm not using long directosy names. The directory is currently "c:\sstp". I have already tried to use the root directory "c:\" and the problem continues.
0
 

Author Comment

by:vpalmu
ID: 8180376
ispaleny,

I have thought about that, the file and directory permissions are already chekced.
SQL-Server agent + MSSQLServer are running under "sysadm" accont. I have already created another job that call my app, but that didn't help.
0
 

Author Comment

by:vpalmu
ID: 8180423
ispaleny,
Some answers:

1. Can you run it from command line (CMD.EXE) ?

- It runs ok. from command line, that's why I'm thinking  that SQL-Server might have some problems.

2. Can you run it from SQL server ?
exec master.dbo.xp_cmdshell 'commandline'

- I will try this.

3. Startup account of SQL Server ?
- Local system account (sorry about the previous "sysadm"  answer, my mistake).

4. Startup account of SQL Server Agent

- Local system account.
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8180996
Setup SQL Server Agent to login as administrator, restart SQL Server Agent and try again.
0
 

Author Comment

by:vpalmu
ID: 8183424
ispaleny,

My app runs normally with command:
"exec master.dbo.xp_cmdshell 'commandline'"

does this mean something ?? Is this different from
starting my prog form job ??

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 8183542
>>Is this different from starting my prog form job ??<<
Sure, one is on a workstation the other is on the server.

Anthony
0
 

Author Comment

by:vpalmu
ID: 8183641
acperkins,

My app is installed on the same computer than the
SQL-Server. What I ment was, is there a differece when I run my app with the "exec" command from Query Analyzer or  when I call my app from SQL-Server job using the "CmdExec" command ??
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8186528
The executor of your job is SQL Server Agent startup account.
The executor of xp_cmdshell is SQL Server.

But you posted both are SYSTEM.
0
 
LVL 13

Accepted Solution

by:
ispaleny earned 1500 total points
ID: 8186563
You also posted, the job is timed. So it is nun at server side with SQLSERVERAGENT logon account.

Now

1. Please check once again the both services are running as SYSTEM
Go Start->Settings->Control panel->Administrative Tools
->Computer Management->Services and Applications->Services

Check the last column of the list (logon account)
for services MSSQLSERVER and SQLSERVERAGENT.
Both LocalSystem ? If they are not, change SQLSERVERAGENT logon account to MSSQLSERVER logon account.
 
2. If both LocalSystem, drop and recreate job. Do not use Copy&Paste !!! Then try once again.

3. If 2 didn't help, install latest service packs (both SP3) and start from 1.

4. Change your CmdExec job to SQLTask "exec master.dbo.xp_cmdshell 'commandline'" job. You already verified this functionality.

Good luck !
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8224293
Killed in action ?
0
 

Author Comment

by:vpalmu
ID: 8228038
Sorry for the late reply...the option 4 works. Now, I couldn't find out why CmdExec won´t work on that machine, but that's ok.
0
 
LVL 13

Expert Comment

by:ispaleny
ID: 8230946
vpalmu,
Some solution is better than none. Post later if you find ( or want to find ) why it didn't work.
Best regards, Ivo Spaleny.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question