locked
Synchronization between two SQL Server Databases RRS feed

  • Question

  • Alex,  Neil,

    Could you point me the some code samples (or share yours) that resemble this scenario.
    What I want to achieve is to do peer to peer syncronization between 2 SQL Server DB (one of which is master and one is parent subscriber) . Parent subscriber will than act as Distributor DB that would allow other Client DBs (SQL Server, SQL Desktop or SQL Compact DB) to do filtered syncronization via Web services. Filtering would be done via ParentSubscriberKey/ChildSubscriberKey combination. So basically Master DB would know what data to send to each children of Parent DB.
    I am still now sure if Peer to Peer syncronization supports syncronizing between 2 SQL Server DBs.

    Thanks

    Rad

    P.S If you do have some samples can you please email me at radoslavATeverestkcDOTnet
    • Moved by Max Wang_1983 Thursday, April 21, 2011 5:23 PM forum consolidation (From:SyncFx - Technical Discussion [ReadOnly])
    Tuesday, March 11, 2008 8:35 PM

Answers

  • Hi Rad,

    Firstly, the peer-to-peer Synchronization (Collaboration scenarios) in Sync Services for ADO.Net v2.0 does support synchronizing between 2 SQL Server DBs. About the sample code, you can take a look of the link: http://msdn.microsoft.com/en-us/library/bb902853.aspx. If you installed the SyncSDK.msi, you should be able to find some code samples in your "Program Files\Microsoft SDKs\Microsoft SyncFramwork\v1.0\Runtime\ADO.NET\v2.0\Samples" directory as well.

    Secondly, the peer sync provider doesn't support dynamic filter. If you can partition your database by the ParentSubscriberKey/ChildSubscriberKey, you can create different sync scopes for each Key combination. It works as a static filter. For each sync scope, you will prepare different DbSyncAdapter selection commands that only select the sub-set of table that satisfied a particular key combination. In this case, other rows will not be enumerated and synced in the current sync scope.


    Finally, I saw somebody tried to remove unwanted rows from ChangeSelectedEventArgs to achieve dynamic filtering. There is a DbSyncConext that contains the full Dataset. It may work if you will not change the client machine ClientsubscriberKey, but the underneath knowledge is not right anymore. If you need to update the client machine with another ClientsubscriberKey, you need to re-initiate the client (re-provision the client database for sync).

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Tuesday, May 26, 2009 7:49 PM
    Moderator

All replies

  • Hi i am Also faceing same problem .

    any one please explainn sync with two SQL Server databases

    thanks
    Monday, May 25, 2009 10:48 AM
  • Hi Rad,

    Firstly, the peer-to-peer Synchronization (Collaboration scenarios) in Sync Services for ADO.Net v2.0 does support synchronizing between 2 SQL Server DBs. About the sample code, you can take a look of the link: http://msdn.microsoft.com/en-us/library/bb902853.aspx. If you installed the SyncSDK.msi, you should be able to find some code samples in your "Program Files\Microsoft SDKs\Microsoft SyncFramwork\v1.0\Runtime\ADO.NET\v2.0\Samples" directory as well.

    Secondly, the peer sync provider doesn't support dynamic filter. If you can partition your database by the ParentSubscriberKey/ChildSubscriberKey, you can create different sync scopes for each Key combination. It works as a static filter. For each sync scope, you will prepare different DbSyncAdapter selection commands that only select the sub-set of table that satisfied a particular key combination. In this case, other rows will not be enumerated and synced in the current sync scope.


    Finally, I saw somebody tried to remove unwanted rows from ChangeSelectedEventArgs to achieve dynamic filtering. There is a DbSyncConext that contains the full Dataset. It may work if you will not change the client machine ClientsubscriberKey, but the underneath knowledge is not right anymore. If you need to update the client machine with another ClientsubscriberKey, you need to re-initiate the client (re-provision the client database for sync).

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Tuesday, May 26, 2009 7:49 PM
    Moderator