Sander's space

Just another WordPress.com site

Archive for December, 2012

How to backup a SQL database to a mapped network share…

Posted by Sander on December 13, 2012

 

Step 1: Map the network drive

EXEC xp_cmdshell ‘net use <drivename> <share name>’
Example: EXEC XP_CMDSHELL ‘net use H: \\machinename\sharename’

Step 2: Verify drive mapping

Example: EXEC XP_CMDSHELL ‘Dir H:’

When done  you can start the backup. If you receive the message that Xp_CmdShell is not enabled do the following to correct this:

To allow advanced options to be changed.
EXEC sp_configure ‘show advanced options’, 1
GO
To update the currently configured value for advanced options.
RECONFIGURE
GO
To enable the feature.
EXEC sp_configure ‘xp_cmdshell’, 1
GO

To update the currently configured value for this feature.
RECONFIGURE
GO

Posted in SQL Server | Leave a Comment »