Answered by:
Use sync framework for synchronization where client already have replica of server data so that intial data changes are not required

Question
-
Hi,
I am syncing a SQL server 2008 database with Sql server 2008 database express edition, and using DBServerSyncProvider as server provider and SqlExpressClientProvider as Client provider. Server and client using db change tracking to track changes. The syncing is working properly, but the problem here is batching data to a new client database.
Here is the explanation of situation in more details. We are syncing approx 10 tables between client and server. For the most part, the row count for each table is quite small and requires no batching (approx < 1000 rows per table). But, there are two tables on the server that contains many rows around 1 million of rows . On an initial sync, client throws an Out Of Memory exception, so we have to batch the inserts to the client.
I was looking into the sample implementation in MSDN site which suggest the use of usp_GetNewBatchAnchor proc for batching but it also doesn't work for initial batching. So, we can up with solution of taking initial snapshot of data from the server(which were taken from the server at some point) and store it locally in the client side, when we create the client db, we will insert the data from the snapshot to prevent the initial data transfer from the server to client. But the problem here, how server will get to know that client has some part of the data and it just needed rest part(which were inserted after the snapshot has been taken) of server data and not all. In the change tracking system in the client side we are using anchor table to keep track of Last received anchor and Last sent anchor. And also server uses anchor data to keep track of client Last sync information. Can't we manually set these information into client as well as in the server to create an illusion that both table has been synced with some point and only synchronization of data required after that point.
PS : I have the replica of server database with already data in it. I want to use sync framework to track data from that point and previous data if modified.
Thanks,
Wednesday, April 28, 2010 6:38 PM
Answers
-
Got it. I was referring to this part in you first post " And also server uses anchor data to keep track of client Last sync information. "
For the anchor table on the client side, for each table being synched, just set last received anchor from the max timestamp you have on the server and set the last sent anchor to the max timestamp you have on the client.
you can do this by a direct SQL update or using the SQL Express sample client sync provider's set last received anchor and set last sent anchor methods.
- Proposed as answer by Jandeep Thursday, April 29, 2010 8:22 PM
- Marked as answer by Sid Singh [MSFT]Microsoft employee Thursday, May 27, 2010 12:30 AM
Thursday, April 29, 2010 8:19 AM
All replies
-
you can manually set the last received anchor and last received anchor in the client.
Am assuming your just using an anchor table on the server side simply to track the last time the client synched.
In the offline provider scenario, it's only the anchor table on the client side that's being used by Sync Fx.
if i may asked, have you considered using the collaboration providers in V2 instead of the sample SQL Express client provider?
Wednesday, April 28, 2010 11:08 PM -
Hello JuneT,
We are using change trackig of SQL server 2008 to track the changes, we are not maintaining anchor tables on server side, we are using this table on client side just to store information (last received anchor and last sent anchor) because it is required in SQL Express client provider.
We are using offline scenario, we have one server database and around 8 client database which will synchronized only to the server.
Server: DbServerSyncProvider, sql server 2008 change tracking
Clinet: SqlExpressSyncProvider, sql server 2008 express edition with change tracking.
Initially server and all clients will start with same database which has huge amount of data. So, we don't need to synchronize for the initial set of data we just need to synchronized for the incremental changes that is done after initial set of data and some changes that are done in the initial set of data.
Anchor table in the client side contains the information from change tracking system which is generated by serer while synchronization. Is there any way to achieve this.
Thursday, April 29, 2010 6:30 AM -
Got it. I was referring to this part in you first post " And also server uses anchor data to keep track of client Last sync information. "
For the anchor table on the client side, for each table being synched, just set last received anchor from the max timestamp you have on the server and set the last sent anchor to the max timestamp you have on the client.
you can do this by a direct SQL update or using the SQL Express sample client sync provider's set last received anchor and set last sent anchor methods.
- Proposed as answer by Jandeep Thursday, April 29, 2010 8:22 PM
- Marked as answer by Sid Singh [MSFT]Microsoft employee Thursday, May 27, 2010 12:30 AM
Thursday, April 29, 2010 8:19 AM -
Ok, Thanks,
do we have maxtimestamp in sql server 2008 internal change tracking system?? I guess internal change tracking system uses version number to track changes.
Just to be clear, we can in offline scenario we can use one server and multiple clients, where all clients will communicate with the server only.
Thursday, April 29, 2010 12:45 PM -
use change_tracking_current_version() to retrieve the values for your anchor table entries. just make sure no changes are made either on client or server before you set the values on the anchor table.Thursday, April 29, 2010 12:53 PM