SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


CmdExec for delete and xcopy job failing with Access denied


CmdExec for delete and xcopy job failing with Access denied

Author
Message
CuriousGeorge
CuriousGeorge
SSC-Enthusiastic
SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)

Group: General Forum Members
Points: 189 Visits: 658
Hi,
I am trying to create a job with CmdExec that will call the batchfile. The batchfile has following commands:
echo new text>\\g1\sharedick\report\rpt_upload.log
echo on
echo delete files>>\\g1\sharedick\report\rpt_upload.log
del \\x1\online\reports\*.pdf /F/Q>>\\g1\sharedick\report\rpt_upload.log
echo copy files to case>>\\g1\sharedick\report\rpt_upload.log
xcopy \\g1\sharedick\Reports\*.pdf \\x1\online\reports\ /H/Q/Y/R>>\\g1\sharedick\report\rpt_upload.log

When i run the job it shows job ran successfully, however i dont see any files being deleted or copied. Checking the log it shows Access denied for the user running the sql server agent job. I had comfirmed that that user had the full control on both shared drives and folders.
we are using sql sever 2005 32 bit standard edition with SP2.
Thanks
Steve Jones
Steve Jones
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: Administrators
Points: 66232 Visits: 19120
The rights are those of the job, or agent, running the job. Not the user that runs the job. You can specify a proxy account for SQL Agent, but if it's not there, the SQL Agent service account is what needs rights.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
CuriousGeorge
CuriousGeorge
SSC-Enthusiastic
SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)

Group: General Forum Members
Points: 189 Visits: 658
I mean.. sql server agent serveices has the full rights on both shared disk.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: Administrators
Points: 66232 Visits: 19120
The user must not have rights. Access denied is a simple message. Do you have a domain user running the Agent? Can you log in as this user and execute the batch file?

I might also try creating a file. A simple "echo 'test' > newfile.txt" and see if that works on each disk.

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
CuriousGeorge
CuriousGeorge
SSC-Enthusiastic
SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)SSC-Enthusiastic (189 reputation)

Group: General Forum Members
Points: 189 Visits: 658
Yes! we have the same domain user running the all sql agent services. I have output the command to .txt file. The output file shows all commands are executed successfully. However, in sql job logs it show XXX\XYZ .....Access Denied.
Steve Jones
Steve Jones
SSC Guru
SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)SSC Guru (66K reputation)

Group: Administrators
Points: 66232 Visits: 19120
That's strange. Are you sure that the rights cover those files? Perhaps there's something weird with them?

Can you log in as the domain user running the Agent?

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search