3

I am using the Visual Studio Database Project for my database. I have it setup to auto-build twice a week. When it builds it drops the database and recreates it from scripts.

I really like the tear down and re-build system as it prevents junk from accumulating in my Development databases.

I now need to add a second database to the mix and get it receiving some replicated tables from the first database.

I know that replication is a server level thing, but I am hoping to just add some post deploy scripts to my database and have that script setup the replication publisher and subscriber (for my first and second database respectively).

Is this going to work? I don't really know much of the in depth stuff with replication. If there is an easier way, I would love to hear it.

4

1 回答 1

2

虽然在服务器级别有一些复制设置,但它主要是一种数据库级别的技术。虽然按照您所说的做在技术上是可行的,但它似乎并不真正符合复制的目标(在我看来,复制的目标是将一个数据库中的更改连续分发到一个或多个其他数据库) . 因为你不断地把它拆掉,所以复制只是一个花哨的副本。问问自己是否真的需要复杂性,即在重建数据库时仅复制一份数据库就足够了。

但是,如果您下定决心要这样做,请查看 sp_adddistributiondb 和 sp_adddistpublisher 用于一次性服务器级设置,以及 sp_addpublication、sp_addarticle、sp_addsubscription 和 sp_startpublication_snapshot 用于数据库级设置。祝你好运!

于 2011-09-20T15:21:46.877 回答