SQL Server 2008 差异数据库
所以事情是这样的:
背景
- Hyper-V VM 可以处理差异磁盘模式,在这种模式下,可以将原始 VHD 文件设置为只读状态,并创建一个新的 vhd 来跟踪,并持续存在变化。这里的优点是您可以轻松创建新的虚拟机,而无需重新安装 Windows 等。
问题
- 我正在寻找类似的东西,但是针对 SQL Server 数据库。我们在本地进行所有开发,然后我们有一个运行 X 个实例的盒子(每个开发人员 1 个)。然后,我们有一个过程可以复制所做的生产备份并将其恢复到这些实例。完成此操作后,它会签出开发人员选择的(SQL 脚本)分支并在实例上运行脚本。这样他们就可以在实际投入生产之前在生产数据上测试代码。然而,为每个实例拥有所有生产数据库的副本确实很痛苦——最好拥有一组它们并有一个仅保留所做更改的差异选项。这是可能的还是我在做梦?
可能的解决方案
- 我想到的一个解决方案就是使用实际的差异磁盘 VHD。我将创建一个包含生产备份数据库的基础 VHD,该数据库将在夜间与生产数据库一起修改/创建。然后,我将让它修改/创建差异磁盘并将脚本应用到每个差异磁盘。这样我们就拥有了数据库的 1 个副本,并且开发人员的更改被记录到单独的差异磁盘上。然而,我希望在 SQL Server 中完成这个任务。
So here is the deal:
Background
- A Hyper-V VM can handle a differencing disk mode, where one can set the original VHD file in a read-only state and create a new vhd which keeps track of, and persists, the changes. The advantage here is you can easily create new VMs without having to reinstall Windows, etc.
Problem
- What I am looking for is something similar, but for SQL Server databases. We do all of our development locally and then we have a box that has X instances run on it (1 for each developer). We then have a process which copies the production backups that are made and restores them to these instances. After this is complete, it checks-out a branch that a developer chooses (of SQL scripts) and runs the scripts on the instance. This way they can test their code on production data prior to it actually hitting production. However, it is a real pain to have a copy of all our production dbs for each instance-- it would be nice to have 1 set of them and have a differential option which just persists the changes made. Is this possible or am I dreaming?
Possible solution
- One solution I thought of is just to use an actual differencing disk VHD. I would create a base VHD that has our production backup databases, which would be modified/created night with the production database. I then would have it modify/create differencing disks and apply the scripts to each differencing disk. This way we have 1 copy of the dbs, and the developer's changes are recorded to a separate differencing disk. However, I was hoping to accomplish this in SQL server.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
基本上我得出的结论是尝试自动化差异磁盘的过程,如下所示:
参考文献:
为了实现自动化,我将使用一组简单的批处理文件、VBS 或 PowerShell。
编辑:刚刚尝试过,效果很好!开发人员现在拥有自己的实例,它只记录他们的更改。
Basically the conclusion I have come to is to try and automate the process of differencing disks as below:
References:
To automate I'd use a simple set of batch files, VBS, or PowerShell.
Edit: Just tried this and it works great! Developers now have their own instance and it only records their changes.