![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I am having trouble trying to schedule cmd step using xcopy command to copy a file from one server to another server. I am getting Invalid drive specification error. However, when I run the same command under command prompt, it works fine. |
#3
| |||
| |||
|
|
xo (xo555... (AT) gmail (DOT) com) writes: I am having trouble trying to schedule cmd step using xcopy command to copy a file from one server to another server. I am getting Invalid drive specification error. However, when I run the same command under command prompt, it works fine. First or all use UNC paths; drive letters for network drives are local to your process. Next, make sure that SQL Server Agent runs under a domain account with access to the destination folder. If it runs under LocalSystem it will never work out. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000:http://www.microsoft.com/sql/prodinf...ons/books.mspx |
#4
| |||
| |||
|
|
On Jul 13, 3:13 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: xo (xo555... (AT) gmail (DOT) com) writes: I am having trouble trying to schedule cmd step using xcopy command to copy a file from one server to another server. I am getting Invalid drive specification error. However, when I run the same command under command prompt, it works fine. First or all use UNC paths; drive letters for network drives are local to your process. Next, make sure that SQL Server Agent runs under a domain account with access to the destination folder. If it runs under LocalSystem it will never work out. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000:http://www.microsoft.com/sql/prodinf...ons/books.mspx Hi Erland, Thanks for your respond. And I am using the UNC paths; the cmdexec command inside sql server is as follows and it works when I run it under command prompt - xcopy d:\mssql\backup\backup.bak \\nnn.nnn.nnn.nnn\E$\restore\ /y /c And I am not using Local system or Local service account for SQL Server Agent. You've just confirmed Erland's diagnosis. The account that SQL Agent is |
#5
| |||
| |||
|
|
xo wrote: On Jul 13, 3:13 pm, Erland Sommarskog <esq... (AT) sommarskog (DOT) se> wrote: xo (xo555... (AT) gmail (DOT) com) writes: I am having trouble trying to schedule cmd step using xcopy command to copy a file from one server to another server. I am getting Invalid drive specification error. However, when I run the same command under command prompt, it works fine. First or all use UNC paths; drive letters for network drives are local to your process. Next, make sure that SQL Server Agent runs under a domain account with access to the destination folder. If it runs under LocalSystem it will never work out. -- Erland Sommarskog, SQL Server MVP, esq... (AT) sommarskog (DOT) se Links for SQL Server Books Online: SQL 2008:http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005:http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx SQL 2000:http://www.microsoft.com/sql/prodinf...ons/books.mspx Hi Erland, Thanks for your respond. And I am using the UNC paths; the cmdexec command inside sql server is as follows and it works when I run it under command prompt - xcopy d:\mssql\backup\backup.bak \\nnn.nnn.nnn.nnn\E$\restore\ /y /c And I am not using Local system or Local service account for SQL Server Agent. You've just confirmed Erland's diagnosis. The account that SQL Agent is being run under does not have the same permissions as your account. You have to make sure the job runs using an account that has the proper permissions. Look up creating credentials and proxy accounts in Books Online (see the links in Erland's sig) |
![]() |
| Thread Tools | |
| Display Modes | |
| |