Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

So I'm trying to use XP_CMDSHELL to set up my drive for using a backup. I already have the drive mapped, but per http://blogs.msdn.com/b/varund/archive/2009/06/04/backup-sql-server-database-to-a-share-drive-on-another-server.aspx, I figured I'd need to mount the drive using net use.

But when I do, I get System error 53, 'The network path was not found.'

EXEC XP_CMDSHELL 'net use S: \\sql-backup'

I know this unc is accessible from the server because it is mounted as a network share on the sql server.

Any ideas why the unc is unreachable?

share|improve this question
1  
Why don't you just backup straight to the UNC path, use that in your backup command, in place of mapping it? –  Shawn Melton Apr 14 '12 at 3:03
1  
+1 Shawn. There's no reason to use xp_cmdshell for this. Honestly, with all the tools available (CLRs, SSIS, the ability to invoke the command shell via the agent, Powershell...), there's really no legitimate reason to use xp_cmdshell. xp_cmdshell was a good "pre SQL 2005" tool that, for security reasons, most experts now recommend disabling. –  brian Aug 19 '12 at 18:57

2 Answers 2

You have to give it both the server name and a shared folder, i.e., \\Server\SharedFolder.

share|improve this answer

An idea would be to check to see if the account identity for the SQL Service has access to that network share.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.