Invalid drive specification using XCOPY in a scheduled job in SQL Server [closed]

bihw5rsg  于 12个月前  发布在  SQL Server
关注(0)|答案(1)|浏览(175)

Closed. This question is not about programming or software development . It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers . If you believe the question would be on-topic on another Stack Exchange site , you can leave a comment to explain where the question may be able to be answered.

Closed last month.
Improve this question

I use SQL Server 2014 on a Windows 2012r2 machine, and I need to copy backup files to another server (2012r2). I read this SO post:

Invalid drive specification using XCOPY

I was able to run the following successfully

net use Z: \\SQL02\H$

xcopy F:\BackupTest\*.bak Z:\BackupTest\ /s /d

However, I got the "Invalid drive specification" when using the same xcopy code in a scheduled job in the SQL Server database.

klsxnrf1

klsxnrf11#

There's no need to map a drive. XCopy can use the UNC paths, eg

xcopy F:\BackupTest\*.bak \\SQL02\H$\BackupTest\ /s /d

But the SQL Server service account needs permissions. The 'H$' is an admin share, so the service account or the machine account would need admin permissions on the other server. If you create a regular share on the other server you can set granular permissions.

相关问题