Sander's space

Just another WordPress.com site

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: