附加远程存储的数据库 [英] Attach a remotely stored database

查看:125
本文介绍了附加远程存储的数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以附加存储在远程服务器上的数据库,因为在映射驱动器并尝试将其附加到Management Studio时,驱动器不会显示为选项。我移动它是因为磁盘空间,如果我不能的替代建议是什么?

Is it possible to attach a database that is stored on a remote server because when I mapped a drive and tried to attach it in management studio, the drive does not show up as an option. I moved it because of disk space and if I cannot what is the alternative suggestions?

推荐答案

你应该能够附加一个数据库在UNC路径(我不会使用映射的驱动器 - 该驱动器为您映射,而不是SQL Server服务帐户),但必须确保SQL Server服务帐户对远程文件夹具有读/写权限,您必须运行跟踪标志1807(请阅读Brent Ozar的有关此的帖子。)

You should be able to attach a database on UNC path (I wouldn't use a mapped drive - that drive is mapped for you, not the SQL Server service account), but you have to ensure that the SQL Server service account has read/write permissions on the remote folder, and you have to run trace flag 1807 (please read Brent Ozar's post about this).

也不要使用GUI。设置跟踪标志,重新启动服务并正确配置权限后,使用新的查询窗口,然后运行以下命令:

Also don't use the GUI for this. Once you have the trace flag set, have restarted the service, and have configured permissions correctly, use a new query window, and run the following command:

CREATE DATABASE db_name 
ON (Filename = '\\uncpath\share\file.mdf'),
   (Filename = '\\uncpath\share\file.ldf')
FOR ATTACH;

(UI不会为您提供UNC路径,无论您设置了什么跟踪标志,启用了哪些权限。)

(The UI is never going to offer you a UNC path no matter what trace flags you have set or what permissions are enabled.)

当然,如果网络共享下降,请准备处理已损坏且可能无法恢复的数据库。

Be prepared to handle a corrupted and possibly unrecoverable database should the network share go down, of course.

如果这听起来很可怕,好吧!这应该!这不是一个好主意。相反,您应该释放一些空间,添加驱动器或在不同的实例上托管数据库。

If that sounds scary to you, good! It should! This is not a good idea at all. Instead you should free up some space, add a drive, or host the database on a different instance.

这篇关于附加远程存储的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆