[转]Configure Network Drive Visible for SQL Server During Backup and Restore Using SSMS
2017-11-24 14:28
639 查看
本文转自:https://mytechmantra.com/LearnSQLServer/Configure-Network-Drive-Visible-for-SQL-Server-During-Backup-and-Restore-Using-SSMS/
In SQL Server Management Studio, if you try to browse the backup files, you will only see the local drives available to SQL Server Database Engine. In this article we will take a look at the approach on How to Configure SQL Server to Display Network Path Visible to SSMS to Perform Database Backup or Restore Commands.
Once the Network Drive is mapped successfully the next Step will be to identify the network drive within SQL Server. This can be achieved by using XP_CMDSHELL command. For more information, see How to Enable and Disable XP_CMDSHELL command in SQL Server.
Recommendation: You can't fix an SQL Server Performance Issues until you can identify it. Download Fully Functional Database Performance Analyzer and see how it will pinpoint SQL Server Performance Issue! Become the STAR Performer!
Once you have executed the above script successfully you will be to see "Z Drive" under Locate Backup File as shown in the below snippet.
DBAs or Developers can very well backup or restore database from Network Share without Mapping the drive. This is only required if you wish to perform backup or restore using SQL Server Management Studio.
Once you have completed the Backup or Restore as a Best Practice on should disable XP_CMDSHELL in SQL Server. For more information see, How to Enable and Disable XP_CMDSHELL command in SQL Server
Learn more about SQL Server Security Best Practices.
Introduction
Most of the Development and Test Database Servers will not have enough disk space to store both the database and backup files in order to perform the periodic database refreshes. In such scenarios, the best option will be to store the database backup files in a mapped network drive and perform the database restores from the mapped drive. However, things can become really complicated when the developer tries to restore the database using SSMS and they couldn't locate the respective mapped drive under Locate Backup File window as shown in the snippet below.In SQL Server Management Studio, if you try to browse the backup files, you will only see the local drives available to SQL Server Database Engine. In this article we will take a look at the approach on How to Configure SQL Server to Display Network Path Visible to SSMS to Perform Database Backup or Restore Commands.
How to Map a Network Drive
By default, a network share is not visible to SQL Server Database Engine. Hence, you will have to mark Network Share as a Mapped Network Drive using the using the Map Network Drive feature of the Operating System. Refer the below screenshots which highlights How to Create a Mapped Network Drive.Once the Network Drive is mapped successfully the next Step will be to identify the network drive within SQL Server. This can be achieved by using XP_CMDSHELL command. For more information, see How to Enable and Disable XP_CMDSHELL command in SQL Server.
Recommendation: You can't fix an SQL Server Performance Issues until you can identify it. Download Fully Functional Database Performance Analyzer and see how it will pinpoint SQL Server Performance Issue! Become the STAR Performer!
How to Map Network Drive in SQL Server
In the below script replace Drive Letter and Share Path with values in your environment to Map Network Drive in SQL Server.EXEC XP_CMDSHELL 'net use Z: \\RemoteServerName\ShareName'
How to Verify Mapped Network Drive Mapping in SQL Server
Execute the below query by replacing the Dirve Letter with the Drive Letter which you have provided in your environment.EXEC XP_CMDSHELL 'Dir Z:'
Once you have executed the above script successfully you will be to see "Z Drive" under Locate Backup File as shown in the below snippet.
How to Delete Mapped Network Drive Mapping in SQL Server
Execute the below TSQL code to Delete the Mapped Network Drive from SQL Server.EXEC XP_CMDSHELL 'net use Z: /delete'
Disaster Recovery: How to Repair Suspect Database in SQL Server |
Action Item
You can very well provide the full network location of the file in "File Name" field of "Locate Backup File" window. The approach mentioned in this article is only required if you wish to perform backup or restore using SQL Server Management Studio.DBAs or Developers can very well backup or restore database from Network Share without Mapping the drive. This is only required if you wish to perform backup or restore using SQL Server Management Studio.
Once you have completed the Backup or Restore as a Best Practice on should disable XP_CMDSHELL in SQL Server. For more information see, How to Enable and Disable XP_CMDSHELL command in SQL Server
Learn more about SQL Server Security Best Practices.
相关文章推荐
- Configure SQL Server Database Mirroring Using SSMS
- [SQL Server][FILESTREAM] -- How to Backup and Restore a SQL Server FILESTREAM Enabled Database
- Issue 71 - pymssql - Undefined symbols on Mac, CentOS, Redhat with pre-compiled build - A fast MS SQL Server client library for Python directly using C API instead of ODBC. It is Python DB-API 2.0 compliant. Works on Linux, *BSD, Solaris, Mac OS X and Win
- Configure SQL Server Database Mirroring Using SSMS
- backup and restore database on Microsoft SQL Server 2005
- How to backup and restore database in SQL Server
- 在MSDB中清除SQL Server 还原备份历史数据(Purging MSDB Backup and Restore History from SQL Server)
- add login,create,backup,restore database to Sql Server using SMO
- SQL Server Database Backup and Restore in C#
- SQL Server backup and restore
- Configure SQL Server Database Mirroring Using SSMS
- Configure Red Hat Enterprise Linux shared disk cluster for SQL Server
- 介绍一款替代SSMS的sqlserver管理工具 toad for sqlserver5.7
- SQLBackupAndFTP The server principal "NT AUTHORITY\SYSTEM" is not able to access the database "xxxx"
- Create a SQL Server Database and User for vCenter Server
- shrink log和查询数据库 backup,restore,shrink 进度 和 还原历史 的sql (for sqlserver)re
- [转]UTF-8 encoding support for the BCP utility and BULK INSERT Transact-SQL command in SQL Server 2014 SP2
- Auto generate change scripts in SQL Server Management Studio (SSMS) for tables
- add column for a table if this column not exists using T-SQL in SQLServer
- How To Install and Configure PHD Virtual Backup For Citrix XenServer