在 NAS 共享上使用 SQL Server 2008 数据库
我正在 Visual Studio 中处理一个项目,我想在项目目录中创建一个本地数据库文件 (.mdf),以便可以将其签入 SubVersion 并进行配置管理。不幸的是,尝试在网络共享上创建/附加数据库会导致错误。
我发现的所有支持 NAS 功能的资源都是基于 SQL Server 2000 的,不适用于 2005/2008。
我不关心非本地存储数据库的性能问题,并且在附加数据库期间我可以保证 100% 的正常运行时间和与文件服务器的连接。我确实关心将我的数据库文件与项目一起存储。
澄清一下,我的 SubVersion 工作集位于 NAS 上。公司流动性意味着我稍后可能会在不同的工作站,并且需要访问我的工作集。
另外,我不希望任何答案告诉我我不应该这样做......我知道强烈建议反对。然而,在某种数据库损坏的情况下,我总是可以恢复到存储库版本。
I'm working on a project in Visual Studio, and I want to create a local database file (.mdf) within the project directory so that it can be checked into SubVersion and have configuration management. Unfortunately, trying to create/attach a database on a network share leads to an error.
All of the resources I have found to enable NAS functionality are SQL Server 2000 based and do not work for 2005/2008.
I don't care about the performance issues surrounding storing a database non-locally and I can guarantee 100% up-time and connectivity to the file server during the periods that I have the database attached. I do care about having my database files stored with the project.
To clarify, my working set from SubVersion is on the NAS. Corporate mobility means I might be at a different workstation later and I'll need access to my working set.
Also, I don't want any answers telling me that I shouldn't do this... I know its strongly recommended against. However, in the case of some sort of database corruption I can always just revert back to the repository version.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
每个人(包括微软)都可以、应该并且将会告诉你,这不一定是一个好主意。尽管如此,MS 确实在 SQL 2005(可能更早,也可能更晚)中提供了一种方法来执行此操作:跟踪标志 1807。请参阅 MS 知识库文章 304261 了解详细信息。 (我不知道2008年是否仍然有效。)
Everyone (including Microsoft) can, should, and will tell you that this is not necessarily a good idea. Be that as it may, MS did provide a way to do this in SQL 2005 (and maybe earlier and maybe later): trace flag 1807. See the MS KB article 304261 for details. (I don't know if it's still valid for 2008.)
Jeff Atwood 写了一篇关于此主题的文章
查看他的博客条目< /a> “让您的数据库处于版本控制之下”,包含指向该主题和此 博客条目。另请查看评论
这里有一些用于版本控制数据库的工具
Jeff Atwood hat written an article about this topic
Check out his blog entry "Get Your Database Under Version Control" with links to the topic and this blog entry. Also look at the comments
Here are some tools for versioning Databases
我很确定你不能用本地中密度纤维板来做到这一点。您需要运行 SQL Server 实例(即使是 Express)。安装实例时,您需要告诉安装程序包在何处存储其数据和日志文件。此时,告诉 SQL 将其数据和日志保留在 NAS 上。
I'm pretty sure that you cannot do this with a local mdf. You need to run an instance of SQL Server (even if its express). When you install the instance, you tell the installer package where to store its data and log files. At this point, tell SQL to keep its data and logs on the NAS.