From: xo on 13 Jul 2010 17:33 Hello - 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. Can someone help? Thanks in advance.
From: Erland Sommarskog on 13 Jul 2010 18:13 xo (xo5555ox(a)gmail.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, esquel(a)sommarskog.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/prodinfo/previousversions/books.mspx
From: xo on 13 Jul 2010 20:21 On Jul 13, 3:13 pm, Erland Sommarskog <esq...(a)sommarskog.se> wrote: > xo (xo555...(a)gmail.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...(a)sommarskog.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/prodinfo/previousversions/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. Any other thoughts.
From: Bob Barrows on 13 Jul 2010 21:30 xo wrote: > On Jul 13, 3:13 pm, Erland Sommarskog <esq...(a)sommarskog.se> wrote: >> xo (xo555...(a)gmail.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...(a)sommarskog.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/prodinfo/previousversions/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)
From: xo on 14 Jul 2010 19:15 On Jul 13, 6:30 pm, "Bob Barrows" <reb01...(a)yahoo.com> wrote: > xo wrote: > > On Jul 13, 3:13 pm, Erland Sommarskog <esq...(a)sommarskog.se> wrote: > >> xo (xo555...(a)gmail.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...(a)sommarskog.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/prodinfo/previousversions/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) Thanks - it is all working now.
|
Pages: 1 Prev: URGENT! PLS HELP - Production problem Next: Capture, log and parse all access - how? |