tags:

views:

159

answers:

2

I have a job running robocopy to copy files from the SQL server to a backup drive.

The job runs a CmdExec type job to call a batch file that runs robocopy. my issue is although the files copy over fine the error reports dont get registared I tested this by changing the source file to a bogus drive. It still reports job success. I have narrowed it down to it only sees robocopy and when it runs the tool is reports sucess. e.g. if i only type "robocopy" in to the batch file it still reports success.

Here is the code I am running to try and result in an error when a legite error has occorred:

robocopy "C:\backup\" "D:\backup" SET /A errlev="%ERRORLEVEL & 24%" EXIT /B %errlev%

Any thoughts?

A: 

I would take a look at: ss64's page on robocopy

Also, first time that I've seen this: RoboCopy GuI. Bet it might help you produce a working as expected command line.

Oh, an maybe I'm wrong about sql being an important part of this question. See here for a really neat guide over at SqlTeam.com that looks like it EXACTLY answers your question?

MaasSql
I read through this and set how he stated and still nothing.
andy
A: 

In your job step, check to make sure that you've selected "Quit the job reporting failure" in the "On failure action". Also, under "Process exit code of a successful command" make sure that you have 0. There are some other successful "error codes", as Maassql mentions, but I'd start with 0 until you get things working as expected, then add in the additional codes which you want to count as non-errors.

This is assuming SQL 2008. If you're on a different version, the prompts may be different.

Tom H.
Bothh have been set as stated but still not getting any results.
andy
I did run your command line here and the job errored out as expected. If I think of something else, I'll let you know.
Tom H.