0

They should be synced at all servers,update on any table at any server should be synced.In short,all tables should have same data at all times.

DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription("Scope");

        // get the description of the table from SyncDB dtabase
        DbSyncTableDescription tableDesc = SqlSyncDescriptionBuilder.GetDescriptionForTable("table1", serverConn);
        DbSyncTableDescription tableDesc1 = SqlSyncDescriptionBuilder.GetDescriptionForTable("table2", serverConn);

        // add the table description to the sync scope definition
        scopeDesc.Tables.Add(tableDesc);
        scopeDesc.Tables.Add(tableDesc1);

        // create a server scope provisioning object based on the Scope
        SqlSyncScopeProvisioning serverProvision = new SqlSyncScopeProvisioning(serverConn, scopeDesc);

        // skipping the creation of table since table already exists 
        serverProvision.SetCreateTableDefault(DbSyncCreationOption.Skip);

        //Create new selectchanges procedure for our scope
        serverProvision.SetCreateProceduresForAdditionalScopeDefault(DbSyncCreationOption.Create);

        // Start the provision-USE ONLY ONCE
        //serverProvision.Apply();

        //Get definition for Scope 
        DbSyncScopeDescription scopeDescription = SqlSyncDescriptionBuilder.GetDescriptionForScope("Scope", serverConn);

        //Provise NODE using this definition
        SqlSyncScopeProvisioning productionProvisioning = new SqlSyncScopeProvisioning(serverConn2, scopeDescription);
        SqlSyncScopeProvisioning productionProvisioning2 = new SqlSyncScopeProvisioning(serverConn3, scopeDescription);
        // Start the provision-USE ONLY ONCE
        //productionProvisioning.Apply();
        //productionProvisioning2.Apply();

        SyncOrchestrator syncOrchestrator = new SyncOrchestrator();

        //Specify source database
        syncOrchestrator.RemoteProvider = new SqlSyncProvider("Scope", serverConn, null, null);

        //Specify production database
        syncOrchestrator.LocalProvider = new SqlSyncProvider("Scope", serverConn2, null, null);
        SyncFn(syncOrchestrator);

        syncOrchestrator.LocalProvider = new SqlSyncProvider("Scope", serverConn3, null, null);
        SyncFn(syncOrchestrator);

    }
    public void SyncFn(SyncOrchestrator syncOrchestrator)
    {
        // execute the synchronization process
        SyncOperationStatistics syncStats = syncOrchestrator.Synchronize();
        Initiatedtxtbx.Text = syncStats.SyncStartTime.ToString();
        ChngesUptxtbx.Text = syncStats.UploadChangesTotal.ToString();
        ChngesDwntxtbx.Text = syncStats.DownloadChangesTotal.ToString();
        Completntxtbx.Text = syncStats.SyncEndTime.ToString();
    }

It works with 1 same table in 2 databases.

data in table1 is around 20000rows and table 2 300000rows.The first instance of SyncFn(syncOrchestrator) itself keeps running indefinitely without errors, cant understand whether its processing or stuck somewhere;i changed only 1 row to check sync.

do i need change tracking if so how to implement?

closed as too broad by LowlyDBA, Paul White Feb 11 at 22:53

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • I don't think question is clear here, could you please elaborate a bit more. Please provide the detailed description of your requirement and what you have done so far in this case. – Pranaw Feb 11 at 12:01
  • i want to sync multiple tables at remote databases(nodes),update/delete record at any node should be reflected to all other nodes. – sahil dombe Feb 11 at 12:08
  • You can follow replication methodology for achieving this. What method have you tried so far? In case, you have one primary database and multiple secondary databases or you need to merge changes across the databases, you can implement different method - Log-shipping, merge. Please check more at --> dba.stackexchange.com/questions/36966/… – Pranaw Feb 11 at 12:15
  • Add logging. When your code has processed X rows (a parameter) it will write to a log file / the console / a message queue. Look at that to see how progress is progressing. – Michael Green Feb 11 at 20:53
  • @LowlyDBA,@Paul White remove hold i have edited question.You guys instantly put it on hold but won't remove hold 20hours after editing the post.Use your position to help newbies not discourage them,rtrd moderators – sahil dombe Feb 13 at 5:36