Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

CmdExec for delete and xcopy job failing with Access denied Expand / Collapse
Author
Message
Posted Friday, September 4, 2009 7:47 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 28, 2012 1:07 PM
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
Post #782909
Posted Friday, September 4, 2009 7:52 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:18 AM
Points: 31,078, Visits: 15,522
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
Post #782916
Posted Friday, September 4, 2009 8:08 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 28, 2012 1:07 PM
Points: 189, Visits: 658
I mean.. sql server agent serveices has the full rights on both shared disk.
Post #782935
Posted Friday, September 4, 2009 8:15 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:18 AM
Points: 31,078, Visits: 15,522
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
Post #782945
Posted Friday, September 4, 2009 8:50 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 28, 2012 1:07 PM
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.

Post #782987
Posted Friday, September 4, 2009 12:29 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 11:18 AM
Points: 31,078, Visits: 15,522
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
Post #783135
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse