0% found this document useful (0 votes)
107 views6 pages

Make Network Path Visible For SQL Server Backup and Restore in

The document describes how to map a network drive in SQL Server Management Studio to allow restoring a SQL Server backup file from a network location. It involves using Windows commands to map a network drive, enabling the xp_cmdshell configuration option in SQL Server, and using xp_cmdshell commands to make the network drive visible for browsing and restoring backups in SSMS.

Uploaded by

vk900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views6 pages

Make Network Path Visible For SQL Server Backup and Restore in

The document describes how to map a network drive in SQL Server Management Studio to allow restoring a SQL Server backup file from a network location. It involves using Windows commands to map a network drive, enabling the xp_cmdshell configuration option in SQL Server, and using xp_cmdshell commands to make the network drive visible for browsing and restoring backups in SSMS.

Uploaded by

vk900
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

(/) MENU

Make Network Path Visible For SQL Server Backup and


Restore in SSMS

By: Ahmad Yaseen (/sqlserverauthor/145/ahmad-yaseen/) | Updated: 2015-03-03 | Comments (41) | Related: More
(/sql-server-dba-resources/) > Restore (/sql-server-tip-category/202/restore/)

Problem
The SQL Server Business Intelligence team (/sql-server-business-intelligence-resources/) at work wanted a copy of the live
Data Warehouse database to be restored (/sql-server-tip-category/202/restore/) to their Development SQL Server by replacing
the existing database for testing purposes. Checking the Development SQL Server data drive, there was no free space to fit
both the database and the backup files. Extending the drive or adding a new drive was not a valid option. What do I do?

Solution
The SQL Server Business Intelligence team (/sql-server-business-intelligence-resources/) wanted to restore (/sql-server-tip-
category/202/restore/) the database using SQL Server Management Studio (SSMS) (/sqlservertutorial/121/restore-sql-server-
database-and-overwrite-existing-database/), so the best choice that we found was to use a network drive on another server to
restore the database. When they used SQL Server Management Studio to browse for the network drive they could only see the
local drives. In this tip we show how to see other drives to be able to do the restore when using SSMS.

When you try to browse the backup files from SQL Server Management Studio, you will find only the local drives are shown as
shown below:
(/) MENU

Mapping a Network Drive


In order to make a network share visible to SQL Server, it should be mapped as a network drive. First of all, you need to use
“Map Network Drive” from the Windows OS as follows to map the network share:
(/) MENU

Then to identify that network drive in SQL Server, you will use the xp_cmdshell command. Before that, you need to make sure
that the xp_cmdshell command is enabled in your SQL instance, as it is disabled by default. Use the sp_configure command to
enable it as shown below:

EXEC sp_configure 'show advanced options', 1;


GO
RECONFIGURE;
GO

EXEC sp_configure 'xp_cmdshell',1


GO
RECONFIGURE
GO

Now define that share drive for SQL with the xp_cmdshell command as follows:

EXEC XP_CMDSHELL 'net use H: \\RemoteServerName\ShareName'

It should now be mapped. In order to verify the new drive, you can use the below command that will show you all files in that
newly mapped drive:
EXEC XP_CMDSHELL 'Dir H:' MENU
(/)

Let’s try to use SQL Server Management Studio again to browse the path. As we can see below, we can now see the H: drive:

Now that he drive is visible, you can proceed normally with the restore process.
(/) MENU

Also you can backup any database to that network path as it is now visible to SQL Server from SSMS.

Delete the Mapped Drive


Optionally you can delete that path after you finish using the below command:

EXEC XP_CMDSHELL 'net use H: /delete'

Next Steps
• Review SQL Server Backup Tips (/sql-server-tip-category/161/backup/)
• Review SQL Server Restore Tips (/sql-server-tip-category/202/restore/)
• Read more about XP_CMDSHELL (/sqlservertip/2987/can-i-stop-a-system-admin-from-enabling-sql-server-xpcmdshell/)

Last Updated: 2015-03-03

About the author


(/sqlserverauthor/145/ahmad-yaseen/)Ahmad Yaseen is a SQL Server DBA with a bachelor’s degree in computer engineering as well as .NET
development experience.

View all my tips (/sqlserverauthor/145/ahmad-yaseen/)

Related Resources
• More SQL Server DBA Tips... (/sql-server-dba-resources/)

Follow
◦ Get Free SQL Tips (/get-free-sql-server-tips/?ref=GetFooterMenu)
◦ Twitter (https://twitter.com/mssqltips)
(/) MENU
◦ LinkedIn (https://www.linkedin.com/groups/2320891/)
◦ Facebook (https://www.facebook.com/mssqltips/)
◦ Pinterest (https://www.pinterest.com/mssqltips/)
◦ RSS (https://feeds.feedburner.com/MSSQLTips-LatestSqlServerTips)

Learning Resources
◦ DBAs (/sql-server-dba-resources/) ◦ Tutorials (/sql-server-tutorials/)
◦ Developers (/sql-server-developer-resources/) ◦ Webcasts (/sql-server-webcasts/)
◦ BI Professionals (/sql-server-business-intelligence-resources/) ◦ Whitepapers (/sql-server-whitepapers/)
◦ Careers (/sql-server-professional-development-resources/) ◦ Tools (/sql-server-tools/)

Search Community
◦ Tip Categories (/sql-server-categories/) ◦ First Timer? (/learn-more-about-mssqltips/)
◦ Search By TipID (/search-tip-id/) ◦ Pictures (/mssqltips-community/1/)
◦ Authors (/sql-server-mssqltips-authors/) ◦ Contribute (/contribute/)
◦ Event Calendar (/sql-server-event-list/)
◦ User Groups (/sql-server-user-groups/)
◦ Author of the Year (/mssqltips-author-of-year/)

More Info
◦ Join (/get-free-sql-server-tips/?ref=JoinFooterMenu)
◦ About (/about/)
◦ Copyright (/copyright/)
◦ Privacy (/privacy/)
◦ Disclaimer (/disclaimer/)
◦ Feedback (/feedback/)
◦ Advertise (/advertise/)

Copyright (c) 2006-2020 Edgewood Solutions, LLC (https://www.edgewoodsolutions.com) All rights reserved
Some names and products listed are the registered trademarks of their respective owners.

You might also like