[转]Configure Network Drive Visible for SQL Server During Backup and Restore Using SSMS
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'
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 Network Drive Visible for SQL Server During Backup and Restore Using SSMS的更多相关文章
- SQL Server Database Backup and Restore in C#
SQL Server Database Backup and Restore in C# Syed Noman Ali Shah, 7 Feb 201 ...
- SQL Server 2014 Backup Encryption
转载自: Microsoft MVP Award Program Blog 来源:Microsoft MVP Award Program Blog 的博客:https://blogs.msdn.mic ...
- SQL Server在本地计算机上用SSMS(SQL Server Management Studio)登录不上,错误消息:(Microsoft SQL Server, Error: 18456)
今天遇到了一个奇怪的问题,公司目前在SQL Server上都采用AD域账号登录,由于账号人数众多,所以我们建立了一个AD Group(域组),将大家的AD账号加入了这个AD Group,然后我们将这个 ...
- SQL SERVER备份数据库文件(使用SSMS)
微软的SQL SERVER是市面占有率比较大的数据库,在平时的使用与维护中,备份数据是一件十分重要的! 备份操作,用微软自带的ssms(SQL Server Management Studio)工具即 ...
- 转载:Restore SQL Server database and overwrite existing database
转载自:https://www.mssqltips.com/sqlservertutorial/121/restore-sql-server-database-and-overwrite-existi ...
- Ubuntu上配置SQL Server Always On Availability Group(Configure Always On Availability Group for SQL Server on Ubuntu)
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
- Configure Always On Availability Group for SQL Server on RHEL——Red Hat Enterprise Linux上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Red Hat Enterprise Linux上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的 ...
- Configure Always On Availability Group for SQL Server on Ubuntu——Ubuntu上配置SQL Server Always On Availability Group
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
- Configure Always On Availability Group for SQL Server on Ubuntu
下面简单介绍一下如何在Ubuntu上一步一步创建一个SQL Server AG(Always On Availability Group),以及配置过程中遇到的坑的填充方法. 目前在Linux上可以搭 ...
随机推荐
- CentOS7查看CPU个数
查看逻辑cpu个数:cat /proc/cpuinfo | grep "processor" | wc -l 查看物理cpu个数:cat /proc/cpuinfo | grep ...
- 如何用c#本地代码实现与Webbrowser中的JavaScript交互
关键词:.Net,Webbrowser,JavaScript,communication 参考: 链接:msdn实例-简单的相互调用 代码: [PermissionSet(SecurityAction ...
- 面试题-选择题Python
一. 6.下列表达式中返回为True的是() A.3>2>2 false B.'abc'>'xyz' false C.0x56<56 86<56 false 0x ...
- 面对对象编程(OOP, Object Oriented Programming)及其三个基本特性
一千个读者,一千个哈姆雷特.对于面对对象编程,书上都会告诉我们它有三个基本特性,封装,继承,多态,但谈起对这三点的见解,又是仁者见仁智者见智,感觉还是得多去编程中体验把 . 面向对象编程(OOP, O ...
- poj3624 Charm Bracelet
http://poj.org/problem?id=3624 题目大意:贝茜去了商场的珠宝店,发现了一个迷人的手镯.当然,她想装最好的魅力(N(1≤N≤3402)可用的魅力).每个魅力提供的列表中都有 ...
- 修正eth0,解决虚拟机桥接问题
centos 中没有 ifcfg-eth0 配置文件的解决办法 1.也就是说是centos6改用NetworkManager方式管理网络了,可以运行如下命令进行确认: chkconfig --list ...
- jvm高级特性(5)(1)(原子性,可见性,有序性,volatile,概述)
JVM高级特性与实践(十二):高效并发时的内外存交互.三大特征(原子.可见.有序性) 与 volatile型变量特殊规则 简介: 阿姆达尔定律(Amdahl):该定律通过系统中并行化与串行化的比重来描 ...
- php获取客户端ip地址方法
/** * 获取客户端IP地址 * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字 * @param boolean $adv 是否进行高级模式获取(有 ...
- 冒泡排序实现(Java)
冒泡排序是一种交换排序,它的基本思路是: 两两比较相邻记录的关键字,如果反序则交换,知道没有反序的记录位置. 依次比较相邻的两个数,将小数放在前面,大数放在后面.即在第一趟:首先比较第1个和第2个数, ...
- POJ 1247
#include<iostream> using namespace std; int main(){ ,sum=; int * guest; do{ sum=; sam_num=; ci ...