Showing posts with label cmdexec. Show all posts
Showing posts with label cmdexec. Show all posts

Saturday, February 25, 2012

cmdexec subsystem failure

have a scheduled job that has been running fine for 2 years, but this week I keep getting the following error:

0x469A75B7998F8142A910FA7E9983CCDF

has caused an exception in the CmdExec subsystem and has been terminated.

the enterprise manager shows that the job failed, but the app still shows up in task manager.

the .cmd file has a single step in it that calls the .exe file and does an "if errorlevel = 1" option that displays an error message.

if I run the .exe file outside of enterprise manager, it runs just fine.

I searched around on microsoft.com and the only reference to this error I could find was a but that was fixed in Sql Server 6.5. I am running SQL Server 2000, the server that is running the apps has Windows 2000 Advanced Server installed.

does anyone have any suggestions?

Thanks

I too have been receiving this same error and have not been able to find a soloution. Any help out thier in microsoft land?

Gary

|||

Can one of you pass on the job details and that can help us to narrow down the issue ?

Also, please do mention the OS environment and SP of SQL Server so we can try on the same settings in our lab ?

Thanks,

Gops Dwarak

|||

The job that is running is a series of COBOL programs, you would not be able to duplicate the exact process.

the OS is Win 2000 Advanced Server SP 4 build 295

SQL Server 2000 SP 3

Enterprise Mgr is build 2195 SP 4

it is running a .cmd file that has 4 steps in it. the problem usually happens in step 2 which is a Large Cobol Program.

even on reruns of the same exact input file, it happens in different places(so it is not bad data or a size issue)

cmdexec subsystem failure

have a scheduled job that has been running fine for 2 years, but this week I keep getting the following error:

0x469A75B7998F8142A910FA7E9983CCDF

has caused an exception in the CmdExec subsystem and has been terminated.

the enterprise manager shows that the job failed, but the app still shows up in task manager.

the .cmd file has a single step in it that calls the .exe file and does an "if errorlevel = 1" option that displays an error message.

if I run the .exe file outside of enterprise manager, it runs just fine.

I searched around on microsoft.com and the only reference to this error I could find was a but that was fixed in Sql Server 6.5. I am running SQL Server 2000, the server that is running the apps has Windows 2000 Advanced Server installed.

does anyone have any suggestions?

Thanks

I too have been receiving this same error and have not been able to find a soloution. Any help out thier in microsoft land?

Gary

|||

Can one of you pass on the job details and that can help us to narrow down the issue ?

Also, please do mention the OS environment and SP of SQL Server so we can try on the same settings in our lab ?

Thanks,

Gops Dwarak

|||

The job that is running is a series of COBOL programs, you would not be able to duplicate the exact process.

the OS is Win 2000 Advanced Server SP 4 build 295

SQL Server 2000 SP 3

Enterprise Mgr is build 2195 SP 4

it is running a .cmd file that has 4 steps in it. the problem usually happens in step 2 which is a Large Cobol Program.

even on reruns of the same exact input file, it happens in different places(so it is not bad data or a size issue)

cmdexec subsystem failure

I have a scheduled job that has been running fine for 2 years, but this week I keep getting the following error:

0x469A75B7998F8142A910FA7E9983CCDF

has caused an exception in the CmdExec subsystem and has been terminated.

the enterprise manager shows that the job failed, but the app still shows up in task manager.

any suggestions?

thanks

What does the job do?

What technology is it calling?

If its been running 2 years then I doubt you're calling SSIS hence this is the wrong forum for you.

-Jamie

Cmdexec on SQL 2000

On a SQL 2000 I am running a Job with the following single step:
xcopy \\nas01\backup\*.* \\nas02\backup /s /e /i /c /d /y
xcopy \\nas01\kunder\*.* \\nas02\Kunder /s /e /i /c /d /y
xcopy \\nas01\projekter\*.* \\nas02\projekter /s /e /i /c /d /y
xcopy \\nas01\konvertering\*.* \\nas02\konvertering /s /e /i /c /d /y
The job executes and report success, however only the first line has
been carried out. Is it not possible to run several lines in a single
step?Hello,
Put all this commands in a single batch (.BAT) file and use the BAT file
name inside Agent Job and try?
Thanks
Hari
"refdk" <fuhlendorf@.gmail.com> wrote in message
news:1175843398.821347.252100@.n76g2000hsh.googlegroups.com...
> On a SQL 2000 I am running a Job with the following single step:
> xcopy \\nas01\backup\*.* \\nas02\backup /s /e /i /c /d /y
> xcopy \\nas01\kunder\*.* \\nas02\Kunder /s /e /i /c /d /y
> xcopy \\nas01\projekter\*.* \\nas02\projekter /s /e /i /c /d /y
> xcopy \\nas01\konvertering\*.* \\nas02\konvertering /s /e /i /c /d /y
> The job executes and report success, however only the first line has
> been carried out. Is it not possible to run several lines in a single
> step?
>

Cmdexec on SQL 2000

On a SQL 2000 I am running a Job with the following single step:
xcopy \\nas01\backup\*.* \\nas02\backup /s /e /i /c /d /y
xcopy \\nas01\kunder\*.* \\nas02\Kunder /s /e /i /c /d /y
xcopy \\nas01\projekter\*.* \\nas02\projekter /s /e /i /c /d /y
xcopy \\nas01\konvertering\*.* \\nas02\konvertering /s /e /i /c /d /y
The job executes and report success, however only the first line has
been carried out. Is it not possible to run several lines in a single
step?Hello,
Put all this commands in a single batch (.BAT) file and use the BAT file
name inside Agent Job and try?
Thanks
Hari
"refdk" <fuhlendorf@.gmail.com> wrote in message
news:1175843398.821347.252100@.n76g2000hsh.googlegroups.com...
> On a SQL 2000 I am running a Job with the following single step:
> xcopy \\nas01\backup\*.* \\nas02\backup /s /e /i /c /d /y
> xcopy \\nas01\kunder\*.* \\nas02\Kunder /s /e /i /c /d /y
> xcopy \\nas01\projekter\*.* \\nas02\projekter /s /e /i /c /d /y
> xcopy \\nas01\konvertering\*.* \\nas02\konvertering /s /e /i /c /d /y
> The job executes and report success, however only the first line has
> been carried out. Is it not possible to run several lines in a single
> step?
>

CMDExec not working in sql agent job.

We have both our sql server and agent running under an
account of sqlservice. I run a winrar job in the agent as
a CMDExec step and it fails everytime. If I terminal
service into the box under the sqlservice account I can
create new files on both the source and destination file
systems. I can also run the job as a batch script from the
command line.
I'm baffeled, if I can run the job as the same account
the agent is running under and specify the job as that
same user. What is stopping this job from running?
"c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
\public1\bmurtha\telnform
[DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
I get this error:
Executed as user: IXCORPSQL01\SqlService. The process
could not be created for step 2 of job
0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
cannot find the file specified). The step failed.
But runs fine on the command line when logged in as
sqlservice.
Please help,
BryanHi Bryan
Is the service you are using a Domain account or a local account? The error
you get says it's executed as user 'IXCOPRSQL01\...' which to me sounds like
a local account rather than a domain account. If you are running it as a
local user, you might have problems getting to your '\\Ixcoprnas01\....'
share.
Regards
Steen
Bryan Murtha wrote:
> We have both our sql server and agent running under an
> account of sqlservice. I run a winrar job in the agent as
> a CMDExec step and it fails everytime. If I terminal
> service into the box under the sqlservice account I can
> create new files on both the source and destination file
> systems. I can also run the job as a batch script from the
> command line.
> I'm baffeled, if I can run the job as the same account
> the agent is running under and specify the job as that
> same user. What is stopping this job from running?
> "c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
> \public1\bmurtha\telnform
> [DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
> I get this error:
> Executed as user: IXCORPSQL01\SqlService. The process
> could not be created for step 2 of job
> 0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
> cannot find the file specified). The step failed.
> But runs fine on the command line when logged in as
> sqlservice.
> Please help,
> Bryan|||Hi Steve,
Oddly enough I didn't figure out what was happening
until I took that line and executed in Query Analyizer
with xp_cmdshell. It wound up it was path to RAR that was
blowing up. It had nothing to to with the NAS or the
backup path. I just stuck RAR in system32 and changed this:
"c:\Program Files\WinRAR\rar" to rar and it was all good.
Regards,
Bryan
>--Original Message--
>Hi Bryan
>Is the service you are using a Domain account or a local
account? The error
>you get says it's executed as user 'IXCOPRSQL01\...'
which to me sounds like
>a local account rather than a domain account. If you are
running it as a
>local user, you might have problems getting to
your '\\Ixcoprnas01\....'
>share.
>Regards
>Steen
>
>Bryan Murtha wrote:
>> We have both our sql server and agent running under an
>> account of sqlservice. I run a winrar job in the agent
as
>> a CMDExec step and it fails everytime. If I terminal
>> service into the box under the sqlservice account I can
>> create new files on both the source and destination file
>> systems. I can also run the job as a batch script from
the
>> command line.
>> I'm baffeled, if I can run the job as the same account
>> the agent is running under and specify the job as that
>> same user. What is stopping this job from running?
>> "c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
>> \public1\bmurtha\telnform
>> [DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
>> I get this error:
>> Executed as user: IXCORPSQL01\SqlService. The process
>> could not be created for step 2 of job
>> 0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
>> cannot find the file specified). The step failed.
>> But runs fine on the command line when logged in as
>> sqlservice.
>> Please help,
>> Bryan
>
>.
>

CMDExec not working in sql agent job.

We have both our sql server and agent running under an
account of sqlservice. I run a winrar job in the agent as
a CMDExec step and it fails everytime. If I terminal
service into the box under the sqlservice account I can
create new files on both the source and destination file
systems. I can also run the job as a batch script from the
command line.
I'm baffeled, if I can run the job as the same account
the agent is running under and specify the job as that
same user. What is stopping this job from running?
"c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
\public1\bmurtha\telnform
[DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
I get this error:
Executed as user: IXCORPSQL01\SqlService. The process
could not be created for step 2 of job
0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
cannot find the file specified). The step failed.
But runs fine on the command line when logged in as
sqlservice.
Please help,
BryanHi Bryan
Is the service you are using a Domain account or a local account? The error
you get says it's executed as user 'IXCOPRSQL01\...' which to me sounds like
a local account rather than a domain account. If you are running it as a
local user, you might have problems getting to your '\\Ixcoprnas01\....'
share.
Regards
Steen
Bryan Murtha wrote:
> We have both our sql server and agent running under an
> account of sqlservice. I run a winrar job in the agent as
> a CMDExec step and it fails everytime. If I terminal
> service into the box under the sqlservice account I can
> create new files on both the source and destination file
> systems. I can also run the job as a batch script from the
> command line.
> I'm baffeled, if I can run the job as the same account
> the agent is running under and specify the job as that
> same user. What is stopping this job from running?
> "c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
> \public1\bmurtha\telnform
> [DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
> I get this error:
> Executed as user: IXCORPSQL01\SqlService. The process
> could not be created for step 2 of job
> 0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
> cannot find the file specified). The step failed.
> But runs fine on the command line when logged in as
> sqlservice.
> Please help,
> Bryan|||Hi Steve,
Oddly enough I didn't figure out what was happening
until I took that line and executed in Query Analyizer
with xp_cmdshell. It wound up it was path to RAR that was
blowing up. It had nothing to to with the NAS or the
backup path. I just stuck RAR in system32 and changed this:
"c:\Program Files\WinRAR\rar" to rar and it was all good.
Regards,
Bryan
>--Original Message--
>Hi Bryan
>Is the service you are using a Domain account or a local
account? The error
>you get says it's executed as user 'IXCOPRSQL01\...'
which to me sounds like
>a local account rather than a domain account. If you are
running it as a
>local user, you might have problems getting to
your '\\Ixcoprnas01\....'
>share.
>Regards
>Steen
>
>Bryan Murtha wrote:
as[vbcol=seagreen]
the[vbcol=seagreen]
>
>.
>

CMDExec not working in sql agent job.

We have both our sql server and agent running under an
account of sqlservice. I run a winrar job in the agent as
a CMDExec step and it fails everytime. If I terminal
service into the box under the sqlservice account I can
create new files on both the source and destination file
systems. I can also run the job as a batch script from the
command line.
I'm baffeled, if I can run the job as the same account
the agent is running under and specify the job as that
same user. What is stopping this job from running?
"c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
\public1\bmurtha\telnform
[DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
I get this error:
Executed as user: IXCORPSQL01\SqlService. The process
could not be created for step 2 of job
0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
cannot find the file specified). The step failed.
But runs fine on the command line when logged in as
sqlservice.
Please help,
Bryan
Hi Bryan
Is the service you are using a Domain account or a local account? The error
you get says it's executed as user 'IXCOPRSQL01\...' which to me sounds like
a local account rather than a domain account. If you are running it as a
local user, you might have problems getting to your '\\Ixcoprnas01\....'
share.
Regards
Steen
Bryan Murtha wrote:
> We have both our sql server and agent running under an
> account of sqlservice. I run a winrar job in the agent as
> a CMDExec step and it fails everytime. If I terminal
> service into the box under the sqlservice account I can
> create new files on both the source and destination file
> systems. I can also run the job as a batch script from the
> command line.
> I'm baffeled, if I can run the job as the same account
> the agent is running under and specify the job as that
> same user. What is stopping this job from running?
> "c:\Program Files\WinRAR\rar" a -ep1 "\\Ixcorpnas01
> \public1\bmurtha\telnform
> [DATE].rar" "G:\MSSQL\BACKUP\telnform.BAK"
> I get this error:
> Executed as user: IXCORPSQL01\SqlService. The process
> could not be created for step 2 of job
> 0x0C7C1F1321CA844D884F666429C26A67 (reason: The system
> cannot find the file specified). The step failed.
> But runs fine on the command line when logged in as
> sqlservice.
> Please help,
> Bryan
|||Hi Steve,
Oddly enough I didn't figure out what was happening
until I took that line and executed in Query Analyizer
with xp_cmdshell. It wound up it was path to RAR that was
blowing up. It had nothing to to with the NAS or the
backup path. I just stuck RAR in system32 and changed this:
"c:\Program Files\WinRAR\rar" to rar and it was all good.
Regards,
Bryan
>--Original Message--
>Hi Bryan
>Is the service you are using a Domain account or a local
account? The error
>you get says it's executed as user 'IXCOPRSQL01\...'
which to me sounds like
>a local account rather than a domain account. If you are
running it as a
>local user, you might have problems getting to
your '\\Ixcoprnas01\....'[vbcol=seagreen]
>share.
>Regards
>Steen
>
>Bryan Murtha wrote:
as[vbcol=seagreen]
the
>
>.
>

CmdExec jobs run in non-admin Windows accounts

I am attempting to tighten the security of our MSSQL environment in a number
of ways and one of these is to run scheduled CmdExec jobs via a non-admin
Windows account. Alas, I cannot get this to work correctly.
I created a credential "abc_job" based on a non-admin Windows domain account
"dom01\abc" in a global group.
I assigned permission for "log on as a batch job" to the global group.
I created a proxy "abc_prox", assigned it to the credential and set it to
active for CmdExec.
I gave access to the proxy for a MSSQL account "xyz" (non sysadmin).
I created a test job and gave ownership of the job to the "xyz" MSSQL account.
The job only has one step and the step runs as proxy "abc_prox".
The job is one line: g:\hjk\test.bat > g:\hjk\test.out
The batch file consists of 5 lines:
chdir /D g:\hjk
whoami
net time
ping gh234test
dir
When I start the job, only the chdir and dir commands succeed. The other 3
lines return "access is denied". However when I remote term to the SQL
Server machine as "dom01\abc" and run the batch file in a command prompt
window it succeeds.
What am I missing?forgot to mention, I also assigned the "xyz" MSSQL account to the
SQLAgentUserRole in the msdb database.

CmdExec jobs run in non-admin Windows accounts

I am attempting to tighten the security of our MSSQL environment in a number
of ways and one of these is to run scheduled CmdExec jobs via a non-admin
Windows account. Alas, I cannot get this to work correctly.
I created a credential "abc_job" based on a non-admin Windows domain account
"dom01\abc" in a global group.
I assigned permission for "log on as a batch job" to the global group.
I created a proxy "abc_prox", assigned it to the credential and set it to
active for CmdExec.
I gave access to the proxy for a MSSQL account "xyz" (non sysadmin).
I created a test job and gave ownership of the job to the "xyz" MSSQL accoun
t.
The job only has one step and the step runs as proxy "abc_prox".
The job is one line: g:\hjk\test.bat > g:\hjk\test.out
The batch file consists of 5 lines:
chdir /D g:\hjk
whoami
net time
ping gh234test
dir
When I start the job, only the chdir and dir commands succeed. The other 3
lines return "access is denied". However when I remote term to the SQL
Server machine as "dom01\abc" and run the batch file in a command prompt
window it succeeds.
What am I missing?forgot to mention, I also assigned the "xyz" MSSQL account to the
SQLAgentUserRole in the msdb database.

CmdExec jobs run in non-admin Windows accounts

I am attempting to tighten the security of our MSSQL environment in a number
of ways and one of these is to run scheduled CmdExec jobs via a non-admin
Windows account. Alas, I cannot get this to work correctly.
I created a credential "abc_job" based on a non-admin Windows domain account
"dom01\abc" in a global group.
I assigned permission for "log on as a batch job" to the global group.
I created a proxy "abc_prox", assigned it to the credential and set it to
active for CmdExec.
I gave access to the proxy for a MSSQL account "xyz" (non sysadmin).
I created a test job and gave ownership of the job to the "xyz" MSSQL account.
The job only has one step and the step runs as proxy "abc_prox".
The job is one line: g:\hjk\test.bat > g:\hjk\test.out
The batch file consists of 5 lines:
chdir /D g:\hjk
whoami
net time
ping gh234test
dir
When I start the job, only the chdir and dir commands succeed. The other 3
lines return "access is denied". However when I remote term to the SQL
Server machine as "dom01\abc" and run the batch file in a command prompt
window it succeeds.
What am I missing?
forgot to mention, I also assigned the "xyz" MSSQL account to the
SQLAgentUserRole in the msdb database.

CmdExec Jobs

Hello - I am trying to set up a job through sql server agent. The job sets
the osqluser and osqlpassword, then calls a bunch of batch files. When I ru
n
it in dos, it works great, but in the sql job, it does nothing. Does the
syntax need to be different or something'
SET uname=Uname
SET pword=Pword
osql -Ssrvname -i inputfile -n > d:\outputfile.txt
Thanks!
MitchYou can only execute one command in a CmdExec job step. Having several job s
teps will probably not
cut it as I guess that the SET settings won't be saved between job step exec
utions. Do the commands
in a bat file instead and schedule this bat file.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Mitch" <Mitch@.discussions.microsoft.com> wrote in message
news:7848BB7E-494B-4F6D-B3A7-B5C2E71C4912@.microsoft.com...
> Hello - I am trying to set up a job through sql server agent. The job set
s
> the osqluser and osqlpassword, then calls a bunch of batch files. When I
run
> it in dos, it works great, but in the sql job, it does nothing. Does the
> syntax need to be different or something'
> SET uname=Uname
> SET pword=Pword
> osql -Ssrvname -i inputfile -n > d:\outputfile.txt
> Thanks!
> Mitch

CmdExec job step permission

Is there anyway I can make a "CmdExec" job step run by a non system
admin?Set up the proxy account with the right permissions. Then non sa users will
use the proxy account to run cmdexec jobs.
Right click on the SQL Agent in EM and choose Properties. Then go to the
Job System tab and at the bottom you will see the place to enable this.
Andrew J. Kelly SQL MVP
"SQL novice" <balacr@.gmail.com> wrote in message
news:1129801114.758202.200050@.g14g2000cwa.googlegroups.com...
> Is there anyway I can make a "CmdExec" job step run by a non system
> admin?
>|||Thanks much for the response. It was very helpful.

CmdExec Job Step in Sql Server2000

Thanks for the invitation to post a question, so I will post one.

I need to create a job step that uses cmdExec.

This is the command line I entering:
D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe

When I run this job the job fails. When I look at the job history, the only information I get is the date and time, user that ran the job and the fact that it failed. I haven't been able to get any CmdExec job to run at all. Can anyone tell me what I'm doing wrong?

Facts.
1. This exact same command is used by my network administrator using windows scheduler on the server. The only reason he wants me to create an sql server job is because it's mostly sql functions.
2. I know the Sql Server agent is running, because I have other jobs that are run.
3. I have verified that I have permission to run the file because I can go to the actual directory and run the exe.
4. Do I need to enclose my command in quotes i.e. D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingN onLogouts.exe
5. the path of the file I need to run is the path on the server and not the path on my local machine.

If you need any other information, please let me know
Thanks for you help
GEMyou should post the code.

cmdexec requires that the security account executing job have sysadmin permissions.|||I wish I knew what code you mean me to post

This is a job I created using enterprise manager to create the job.
1. I entered the Job Name: UpdateEmployeeLogins
2. Job type: Operation System Command (CmdExec)
3. Command: D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe

I did all this through Enterprise Manager. What code do you want me to post?

Thanks
GEM|||change the command type to t-sql and try this...

EXEC xp_cmdshell 'D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingN o nLogouts.exe'|||I did as you suggested and but the same result. I then ran that command line with query analyzer and got an "Access Denied" Error so that means I must have a problem somewhere with permissions. This doesn't make a whole lot of sense since I can the exe when clicking on it. I will have to get with out network administrator who's not available right now.

Your help was excellent, I hope you'll be around later to help me with this if I need it.

Thanks
GEM|||see my 1st post.|||This is a job I created using enterprise manager to create the job.
1. I entered the Job Name: UpdateEmployeeLogins
2. Job type: Operation System Command (CmdExec)
3. Command: D:\odbc\TimeClockUpdates\bin\Release\TimeKeepingNo nLogouts.exe

This method should work. It should not be necessary to use xp_cmdshell in your job.
As Thrassy stated, this is likely due to a permissions issue regarding the account that the SQL Agent service is running under.|||As everyone else said, make sure that the account executing the command under the SQL service privileges has the appropriate access to the executable. I bet if you look under NTFS security on the target .exe you'll find the problem.

CmdExec job failed

Hi,
I created a job on sql server 2000, using the Operating System Command
option, under the command box, I inserted the command cmd /C
e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get this
error message Executed as user:SEFDBA\sqlseragent.
'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal or
external command, operable program or batch file. Process Exit Code 1.
The step failed. Please help, what am I doing wrong? Thanks.
New SQL Server DBA
Check the path and .bat file spelling? Type the exact same thing in from a
CMD prompt and see if it works.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:50ECA2ED-CAD2-4077-9C6F-BB606D4951F4@.microsoft.com...
> Hi,
> I created a job on sql server 2000, using the Operating System Command
> option, under the command box, I inserted the command cmd /C
> e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get
> this
> error message Executed as user:SEFDBA\sqlseragent.
> 'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal
> or
> external command, operable program or batch file. Process Exit Code 1.
> The step failed. Please help, what am I doing wrong? Thanks.
> --
> New SQL Server DBA

CmdExec job failed

Hi,
I created a job on sql server 2000, using the Operating System Command
option, under the command box, I inserted the command cmd /C
e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get this
error message Executed as user:SEFDBA\sqlseragent.
'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal or
external command, operable program or batch file. Process Exit Code 1.
The step failed. Please help, what am I doing wrong? Thanks.
--
New SQL Server DBACheck the path and .bat file spelling? Type the exact same thing in from a
CMD prompt and see if it works.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:50ECA2ED-CAD2-4077-9C6F-BB606D4951F4@.microsoft.com...
> Hi,
> I created a job on sql server 2000, using the Operating System Command
> option, under the command box, I inserted the command cmd /C
> e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get
> this
> error message Executed as user:SEFDBA\sqlseragent.
> 'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal
> or
> external command, operable program or batch file. Process Exit Code 1.
> The step failed. Please help, what am I doing wrong? Thanks.
> --
> New SQL Server DBA

CmdExec job failed

Hi,
I created a job on sql server 2000, using the Operating System Command
option, under the command box, I inserted the command cmd /C
e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get this
error message Executed as user:SEFDBA\sqlseragent.
'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal or
external command, operable program or batch file. Process Exit Code 1.
The step failed. Please help, what am I doing wrong? Thanks.
--
New SQL Server DBACheck the path and .bat file spelling? Type the exact same thing in from a
CMD prompt and see if it works.
HTH
Jerry
"Newbie" <Newbie@.discussions.microsoft.com> wrote in message
news:50ECA2ED-CAD2-4077-9C6F-BB606D4951F4@.microsoft.com...
> Hi,
> I created a job on sql server 2000, using the Operating System Command
> option, under the command box, I inserted the command cmd /C
> e:\docs\extracts\scripts\make_asal.bat, but when I try to run it, I get
> this
> error message Executed as user:SEFDBA\sqlseragent.
> 'e:\docs\extracts\scripts\make_asal.bat' is not recognized as an internal
> or
> external command, operable program or batch file. Process Exit Code 1.
> The step failed. Please help, what am I doing wrong? Thanks.
> --
> New SQL Server DBA

CmdExec issue

Hello,
I have a batch file in the operating system, which runs an osql command that
create a stored procedure, a view and a function on a database. It is with
-E trust connect. It works when I just run it on windows.
However, if I run in as a SQL Job by using the CmdExec, it could not create
any stored procedure, view or function. And there is no error return
neither. The account to run the job is the same NT account with local admin
rights on the server.
Does anyone have some idea about this matter?
Many Thanks,
LianneAre you running the Job from a different server?
If so you need to use -U and -P providing a username and password. I
have experienced this problem before, but apparently linked servers do
not pass the user via windows authentication.|||Lianne Kwock (LianneKwock@.discussions.microsoft.com) writes:
> I have a batch file in the operating system, which runs an osql command
> that create a stored procedure, a view and a function on a database. It
> is with -E trust connect. It works when I just run it on windows.
> However, if I run in as a SQL Job by using the CmdExec, it could not
> create any stored procedure, view or function. And there is no error
> return neither. The account to run the job is the same NT account with
> local admin rights on the server.
Did the job fail or succeed?
In case it failed, there is a checkbox in the upper right of the View
History dialog which says "Show job steps" or somesuch. The output from
the job step should have the real error.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||The job was running on the physical server. and the job return as
successful. but nothing was created on SQL Server side.
Thanks again,
Lianne
"Johnny D" wrote:

> Are you running the Job from a different server?
> If so you need to use -U and -P providing a username and password. I
> have experienced this problem before, but apparently linked servers do
> not pass the user via windows authentication.
>|||Hi John,
I change the -E to -U sa login, but I got this error message:
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server
connection.
Any idea?
Many Thanks,
Lianne
"Johnny D" wrote:

> Are you running the Job from a different server?
> If so you need to use -U and -P providing a username and password. I
> have experienced this problem before, but apparently linked servers do
> not pass the user via windows authentication.
>|||Xref: TK2MSFTNGP01.phx.gbl microsoft.public.sqlserver.programming:605603
Lianne Kwock (LianneKwock@.discussions.microsoft.com) writes:
> I change the -E to -U sa login, but I got this error message:
> Login failed for user 'sa'. Reason: Not associated with a trusted SQL
> Server connection.
> Any idea?
That would indicate that SQL authentication is not enabled on the server.
Well, changing the autentication should not matter, so consider that a
dead end.
As for why your job does not work as expected, I'm afraid that with the
information you have provided, all we can offer is wild guesses. What
is the exact command line you are using?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi Eriand,
the command line is below:
for %%f IN (*.sql) DO echo %%f >> Createcp.txt & osql -S LKWOCK-D1 -U sa -P
zhongshan -n -d test -i "%%f" >> Createcp.txt
this is the command I put in .bat file. on the same level, I have three sql
files, which creates a view, a user defined function and a stored procedure.
Also, I had set SQL Server running on both (SQL and NT authentication)
If you meed more informations, let me know.
Many Thanks,
Lianne
"Erland Sommarskog" wrote:

> Lianne Kwock (LianneKwock@.discussions.microsoft.com) writes:
> That would indicate that SQL authentication is not enabled on the server.
> Well, changing the autentication should not matter, so consider that a
> dead end.
> As for why your job does not work as expected, I'm afraid that with the
> information you have provided, all we can offer is wild guesses. What
> is the exact command line you are using?
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>|||Lianne Kwock (LianneKwock@.discussions.microsoft.com) writes:
> the command line is below:
> for %%f IN (*.sql) DO echo %%f >> Createcp.txt & osql -S LKWOCK-D1 -U
> sa -P zhongshan -n -d test -i "%%f" >> Createcp.txt
> this is the command I put in .bat file. on the same level, I have three
> sql files, which creates a view, a user defined function and a stored
> procedure.
Real stupid question: the BAT file does include a CD to the directory
where you have the SQL, doesn't it?
I composed this file on my machine:
F:
cd \moje dokumenty\WWW\dynsearch
for %%f IN (*.sp) DO echo %%f >> Createcp.txt & osql -E -n -d Northgale -i "
%%f" >> Createcp.txt
And the I created a job of which the command text was
C:\temp\test.bat
I deleted all stored procedure in Northgale, and then started the job.
When I had completed the job, all my procedures were back.
In job history I saw this for the job step:
Executed as user: KESMETS\sql. ...search
F:\Moje dokumenty\WWW\dynsearch>for %f IN (*.sp) DO echo %f 1>>Createcp.tx
t & osql -E -n -d Northgale -i "%f" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_1.sp 1>>Createcp.txt &
osql -E -n -d Northgale -i "search_orders_1.sp" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_10.sp 1>>Createcp.txt
& osql -E -n -d Northgale -i "search_orders_10.sp" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_2.sp 1>>Createcp.txt &
osql -E -n -d Northgale -i "search_orders_2.sp" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_3.sp 1>>Createcp.txt &
osql -E -n -d Northgale -i "search_orders_3.sp" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_3a.sp 1>>Createcp.txt
& osql -E -n -d Northgale -i "search_orders_3a.sp" 1>>Createcp.txt
F:\Moje dokumenty\WWW\dynsearch>echo search_orders_4.sp 1>>Createcp.txt &
.. Process Exit Code 0. The step succeeded.
A way to get more output from the job step is to go the Advanced tab
for the job step, and there select a output file.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi Erland,
Thank you very much for your suggection. I did not enclude the Cd line in
the .bat file since it work just fine when I run it through windows. My bad
.
I guess SQL is very piggy on directory specification then.
Thank you again. I appreciate your help very much!
Lianne
"Erland Sommarskog" wrote:

> Lianne Kwock (LianneKwock@.discussions.microsoft.com) writes:
> Real stupid question: the BAT file does include a CD to the directory
> where you have the SQL, doesn't it?
> I composed this file on my machine:
> F:
> cd \moje dokumenty\WWW\dynsearch
> for %%f IN (*.sp) DO echo %%f >> Createcp.txt & osql -E -n -d Northgale
-i "%%f" >> Createcp.txt
> And the I created a job of which the command text was
> C:\temp\test.bat
> I deleted all stored procedure in Northgale, and then started the job.
> When I had completed the job, all my procedures were back.
> In job history I saw this for the job step:
>
> Executed as user: KES?METS?\sql. ...search
> F:\Moje dokumenty\WWW\dynsearch>for %f IN (*.sp) DO echo %f 1>>Create
cp.txt & osql -E -n -d Northgale -i "%f" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_1.sp 1>>Createcp.t
xt & osql -E -n -d Northgale -i "search_orders_1.sp" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_10.sp 1>>Createcp.
txt & osql -E -n -d Northgale -i "search_orders_10.sp" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_2.sp 1>>Createcp.t
xt & osql -E -n -d Northgale -i "search_orders_2.sp" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_3.sp 1>>Createcp.t
xt & osql -E -n -d Northgale -i "search_orders_3.sp" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_3a.sp 1>>Createcp.
txt & osql -E -n -d Northgale -i "search_orders_3a.sp" 1>>Createcp.txt
> F:\Moje dokumenty\WWW\dynsearch>echo search_orders_4.sp 1>>Createcp.t
xt &... Process Exit Code 0. The step succeeded.
> A way to get more output from the job step is to go the Advanced tab
> for the job step, and there select a output file.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>

cmdexec in SQL agent Jobs

If I do xp_cmdexec 'dir' it displays the directory:
C:\Program Files\Common Files\System\Mapi\1033\NT
on a different sql server the same command shows the directory:
C:\WINNT\system32
How do you set the directory which xp_cmdexec uses?My guess is that it uses the PATH environment variable. You should be able to check that from a DOS
box:
SET
--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"AR" <remove_rittingAThot_mail_DOT_C_O_M> wrote in message
news:uRZPa2erDHA.3504@.TK2MSFTNGP11.phx.gbl...
> If I do xp_cmdexec 'dir' it displays the directory:
> C:\Program Files\Common Files\System\Mapi\1033\NT
> on a different sql server the same command shows the directory:
> C:\WINNT\system32
> How do you set the directory which xp_cmdexec uses?
>
>

CmdExec in a Nightly Job

I have to verify a .CSV file exists before I run a BULK INSERT. I am using XP_FileExist in SQL 2000 to accomplish this. After the Bulk Insert is completed and validated, I need to Rename the file and Move the file to archive the folder. For testing I figure If I can rename the file I can move it. I suspect I have permission issues and need to provide the SQL Server Agent permissions to this folder and file. I have my PC setup as a SQL 2000 Server and am attempting to get this step only working on my local machine. I created a nightly Job that remanes a file that I created in a Job and that is all it does. I am running the Job as SA but am still having issues.

The step being executed by the Job is "Ren C:\MyTestFile.csv C:\MyTestFile1.csv" (with the quotes). If I run this statment (without the Quotes from a command prompt, the file is renamed.

I have set the Type as "Operating System Command (CmdEXEC)". The Job history shows "The process could not be created for step 2 of job 0x71D51027F920A140A2913234DB7FF509 (reason: The system cannot find the file specified). The step failed."

As I said, I suspect that it is a permissions issue as the command works from the command prompt. What is the windows account that the SQL Server Agent uses to commit these commands? I added "Everyone" with Full access to the folder and I still get the same failure.

I would appreciate any assistance anyone could provide. Thanks in advance!

SQL Server Agent has its own service account -it doesn't use the 'sa' account.

In Enterprise Manager, right-click on SQL Agent, then Properties, and you can view (and/or change) the service account for the SQL Server Agent service.

Here are a couple of resources about setting the SQL Agent account:

Configuration -Service Accounts, SQL Server 2005 - Setting Up Windows Service Accounts
http://msdn2.microsoft.com/en-us/library/ms143691.aspx
http://msdn2.microsoft.com/en-us/library/ms143504.aspx

Configuration -Service Accounts, SQL Server or SQL Server Agent service account
http://support.microsoft.com/kb/283811/en-us
http://msdn2.microsoft.com/en-us/library/ms143691.aspx

Configuration -Service Accounts,Selecting an Account for the SQL Server Agent Service
http://msdn2.microsoft.com/en-us/library/ms191543.aspx
http://support.microsoft.com/kb/907557