Job Fail – Xcopy | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Job Fail – Xcopy

Hi, I am facing a problem with xcopy job [SQL 2005]. The job is for copying ‘.Bak’ file to a remote server[log shipping]. The command what i given is ,
XCOPY D:LOGSHIPDATABASEDATA.BAK \SERVER2D$LOGDATABASE /Y – This will work fine in command promt but the job is failing. Both machine firewall are disabled. Can any one let me know how I can identify the actuall reason for failing ? However It will be working fine in local server…. Thanks

It depends on the permissions on both source and target locations, for the account under which the SQL Server service is running on the computer that is hosting the instance of SQL 2005. If you’re executing xcopy at the command prompt, your own permissions apply. That’s the difference. I believe in SQL 2005 you can EXEC with the "AS" option to work around this?
Can you explain ‘I believe in SQL 2005 you can EXEC with the "AS" option to work around this?’
I was assuming you had a T-SQL command like EXEC xp_cmdshell ‘xcopy blabla’ A quick check in BOL 2005: EXECUTE AS USER = ‘user1’;
EXEC xp_cmdshell ‘xcopy blabla’;

What are privileges for the SQLAgent service account?
Ensure it has privileges on D: drive and specified share too. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
@http://www.askasqlguru.com/ This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
Thanks satya, It was the problem with ‘service account’ privilege issue. Thanks for your help
Ajith

]]>