问题描述
在一个理想的世界中,每个数据库都会有一个非常新的备份,但即使这样,如果必须进行恢复,我们也会遇到一些同步问题。
In an ideal world, every database would have a very recent backup, but even then we can have some synchronization issues if a restore has to happen.
在应用程序中我正在努力,我们有一个中心和辐条设计。 我将集线器称为主数据库,并将每个辐条称为卫星。 Master和Satellite都是SqlServer的一些变体,无论是2005年还是2008年,还是Express或更好,
所以没有CE。 始终从Satellite执行同步。 我们的架构上有一个定义对象所有权的机制,并且同步作用域具有利用它的过滤器,因此当Satellite执行同步时,它总是
(我将避免使用术语'download'和'upload'因为它们要模糊不清)将Master拥有的数据传输到Satellite,并将Satellite拥有的数据传输给Master。 最终,每个卫星应该拥有其所有数据加上
Master的数据,而Master应该拥有它的数据加上每个卫星的数据。 我知道,这让头部旋转。 但是,所有这些都很有效。
In the application I am working on, we have a hub and spoke design. I refer to the hub as the master database and each spoke as a satellite. Master and Satellite are all some variant of SqlServer, either 2005 or 2008, and either Express or better, so no CE. Synchronization is always performed from the Satellite. We have a mechanism on our schema that defines object ownership, and the synchronization scopes have filters that leverage this, so when a Satellite performs synchronization, it always (I am going to avoid the terms 'download' and 'upload' because they are to vague) transfers data owned by the Master to the Satellite, and data owned by the Satellite to the Master. Ultimately, each Satellite should have all of its data plus the Master's data, while the Master should have it's data plus EVERY Satellite's data. I know, it makes the head spin. However, all of this works great.
但是,假设必须恢复数据库。 我们假设它是一颗卫星。 在那个卫星重新上线后,我们完成了PerformPostRestoreFixup过程,我观察到的是Master拥有的任何对象在
之间的变化,备份时间和恢复重新同步并完全显示在卫星,但卫星拥有的那些在这段时间内被改变的物体(由于缺乏更好的术语)在主人身上变得"陈旧"。 如果数据已在卫星上创建
,则在恢复后它不再存在,但是主人认为它确实存在。 如果数据已存在但已更改,则从卫星的角度来看,更改会丢失,但是主人会看到更改。 如果数据被删除了
,它又回到了卫星上,但是主人仍然认为它已经消失了。
BUT, suppose a database has to be restored. Let's say it was a satellite. After that satellite comes back on line, and we complete the PerformPostRestoreFixup process, what I observe is that any objects owned by the Master that were changed between the time of the backup and the restore re-sync and appear perfectly on the satellite, but any objects owned by the Satellite that were changed in that period of time become (for lack of a better term) 'stale' on the Master. If the data had been created on the satellite, it not longer exists after the restore, but the Master thinks it does. If the data had existed, but was changed, the change is lost from the point of view of the satellite, but the Master sees the change. If the data had been deleted, it is back on the satellite, but the master still thinks it is gone.
如果主人是这样的,那么相反的问题会发生恢复的数据库...它只会在那种情况下导致每个卫星出现问题。
The same problems happen the other way around if the Master is the restored database ... it just causes problems on every satellite in that situation.
我当然可以理解为什么会这样......而且我不认为这是一个失败的同步本身,但我希望这里有一些可能已经面临并解决了这个问题的人的想法。 或者也许只是一些有创意的思想家!
I certainly can understand why this is so ... and I don't see this as a failing of Synchronization itself, but I am hoping there are some ideas here from people that maybe already have faced and solved this problem. Or maybe just some creative thinkers!
谢谢,
-Kevin
推荐答案
查看"了解同步数据库的备份和还原"部分@
http://msdn.microsoft.com/en-us/library/ee617375(v=SQL.105)的.aspx 。由于备份和恢复期间Satellite的更改不在备份中,因此无法恢复
。
Take a look at section "Understanding Backup and Restore for Databases That Are Synchronized"@http://msdn.microsoft.com/en-us/library/ee617375(v=SQL.105).aspx. Since the changes on the Satellite during the time of backup and restore are not in the backup, those couldn't be restored.
谢谢,
这篇关于应对数据库还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!