locked
How to create local and server infrastructure for existin mirror bases? RRS feed

  • Question

  • I have to databases one made by copiing another. (5gb each)
    1. I need to create infrastructure for synchronzation
    2. To start synchronizing it.
    3. !!! not to copy on first time all database1 into database2 (becouse they are 5gb each, and they are already equal)

    How can i do it?

    PS: My cynch class is:

        public class Synchronizer : SyncOrchestrator
        {
    
            public static string[] tablenames = { "X1", "X2" ... };
            SqlConnection lcon;
            SqlConnection rcon;
            string sn = "main";
    
            public Synchronizer()
            {
               
                lcon = new SqlConnection(DataClassesMain.dataClassesMain.site.ServerConnectionString);
                rcon = new SqlConnection(DataClassesMain.dataClassesMain.site.RemoteServerConnectionString);
                this.Direction = SyncDirectionOrder.Upload;
                this.LocalProvider = new SqlSyncProvider(sn, lcon);
                this.RemoteProvider = new SqlSyncProvider(sn, rcon);
                
            }
    
            public void CreateLocalInfrastructure()
            {
                DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(sn);
                foreach (string taleName in tablenames)
                {
                    DbSyncTableDescription td = SqlSyncDescriptionBuilder.GetDescriptionForTable(taleName, lcon);
                    scopeDesc.Tables.Add(td);
                }
    
                SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(scopeDesc);
                DbServerSyncProvider ss = new DbServerSyncProvider();
    
                serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
                serverConfig.SetCreateProceduresDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateTrackingTableDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateTriggersDefault(DbSyncCreationOption.Create);
                serverConfig.SetPopulateTrackingTableDefault(DbSyncCreationOption.Create);
    
    
                serverConfig.Apply(lcon);
            }
    
            public void CreateRemoteInfrastructure()
            {
                DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(sn);
                foreach (string taleName in tablenames)
                {
                    DbSyncTableDescription td = SqlSyncDescriptionBuilder.GetDescriptionForTable(taleName, rcon);
                    scopeDesc.Tables.Add(td);
                }
    
                SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(scopeDesc);
                DbServerSyncProvider ss = new DbServerSyncProvider();
    
                serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
                serverConfig.SetCreateProceduresDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateTrackingTableDefault(DbSyncCreationOption.Create);
                serverConfig.SetCreateTriggersDefault(DbSyncCreationOption.Skip);
                serverConfig.SetPopulateTrackingTableDefault(DbSyncCreationOption.Create);
    
                serverConfig.Apply(rcon);
            }
    • Edited by Azec Wednesday, July 22, 2009 8:54 AM
    • Moved by Hengzhe Li Friday, April 22, 2011 2:27 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Wednesday, July 22, 2009 8:53 AM

Answers

  • Currently we don't have a way to take 2 endpoints and initialize the topology by claiming that the 2 endpoints are equal. 

    One way to maybe speed up the initialization of 2 SQL endpoints would be to create the local infrastructure (to use your terminology) then take a SQL backup of that database.  You can then restore that backup on a different machine and use the SqlSyncStoreRestore class to update the sync metadata for the remote endpoint by calling the "PerformPostRestoreFixup" method.  You can then sync as normal and that should prevent the existing data from being synchronized.

    Let me know if you have any questions.  Thanks-
    Thursday, July 23, 2009 3:52 PM

All replies

  • Currently we don't have a way to take 2 endpoints and initialize the topology by claiming that the 2 endpoints are equal. 

    One way to maybe speed up the initialization of 2 SQL endpoints would be to create the local infrastructure (to use your terminology) then take a SQL backup of that database.  You can then restore that backup on a different machine and use the SqlSyncStoreRestore class to update the sync metadata for the remote endpoint by calling the "PerformPostRestoreFixup" method.  You can then sync as normal and that should prevent the existing data from being synchronized.

    Let me know if you have any questions.  Thanks-
    Thursday, July 23, 2009 3:52 PM
  • Hm. Is there any other way? 5gb is lots of days to me to transfer.
    Mabe to change some values in support tables?
    Thursday, July 23, 2009 7:22 PM