none
Sync after a schema change not publishing RRS feed

  • Question

  • Hope someone can tell me what I did wrong. 

    Here's a background on our architecture.  I'm syncing between CE on the client and SQL Server in the cloud over WCF.  I am set for two-way sync on most of the tables.

    Over the weekend I decided to do a schema change. I deprovision and make my schema changes.  I reprovision.  On my local machine, I delete my CE database, and let it take the new schema.  I seem to be working ok.  This is about a 20 MB file.  I copy it to a thumb drive.

    I go into work on Monday, and delete everyone's CE db and put the database from my thumb drive on their machine.  I did not push a new software program since the software does not yet access these new fields. 

    Users go into the field and start data collecting.  For whatever reason, the data they are collecting are not syncing to the cloud.  They are receiving data but not publishing data. 

    Can anyone tell me what I did wrong?

    Wednesday, September 14, 2011 2:07 PM

All replies

  • you cant just copy one sdf from one machine to the other and use it to sync immediately. do a performpostrestorefixup for every client you restore the backup sdf that you use to initialize each client.

    another approach is from the original/first sdf, use generatesnapshot to create a new sdf and copy that new sdf to each client.

    Wednesday, September 14, 2011 3:01 PM
    Moderator
  • Thanks for your reply JuneT, I appreciate your feedback.

    Looking over the msdn page for PerformPostRestoreFixup, it says the following...

    Updates synchronization metadata in a SQL Server database after the database has been restored from a backup.

    I haven't restored a SQL Server backup?  Sorry I am missing something here. 

    Reading over GenerateSnapshot, looks like what I should have done before copying the file to all the other machines.  I will do this going forward. 

    Is there anyway to restore the data that has already been collected?

    Wednesday, September 14, 2011 3:27 PM
  • there are some metadata in the database that uniquely identifies each client replica. by copying the database, you will have client Db's having the same id.

    the performpostrestorefixup will make adjustments to the metadata.

    by copying a client db to another client, you actually made a "backup" of the file and restored on another machine. not technically SQL Server backup, but have the same net effect as doing a sql server backup and restoring on another machine.

    Wednesday, September 14, 2011 11:51 PM
    Moderator
  • Thanks again for your help. 

    I can't seem to initialize SqlSyncStoreRestore with a connection to a SQL CE database.  This seems to only work with SQL Server databases.

    Is there any way to run PerformPostRestoreFixup against a CE database?

    Thursday, September 15, 2011 12:53 PM
  • apologies for the late reply and for the wrong advice. i always forget that sqlcesyncprovider doesnt have the post restore fixup.

    anyway, here's something you can try.

    for each client sdf you have, create a small utility that generates a snapshot of each client's sdf using the GenerateSnapshot functionality.

    then replace the original sdf with the snapshot sdf.

    the next sync should detect the sdf is a snapshot and make the necessary adjustment to the metadata.

    let me know how it goes.

    Tuesday, September 20, 2011 1:55 AM
    Moderator
  • That does not work.  I get this message...

    Cannot continue processing scope 'bob' because the database contains synchronization knowledge that is not valid.  Local knowledge was updated on a snapshot before the database was properly initialized.

    Wednesday, September 21, 2011 9:23 PM
  • No worries.  I will chalk this one up to a learning experience.  Firing up SSIS to fix the database. 
    Wednesday, September 21, 2011 9:23 PM
  • just out of curiosity, did you sync the SDF first before creating the snapshot?

    Thursday, September 22, 2011 1:41 AM
    Moderator
  • I didn't, but the people that data collect tried to sync several times before I realized the mistake I had made.  They sent their SDFs to me, and I generated a snapshot.  I attempt to synchronize with the snapshot version and I get the error above.
    Thursday, September 22, 2011 5:56 PM
  • the SDF from which you generated the snapshots may have pending/unsynchronized data.
    Friday, September 23, 2011 1:29 AM
    Moderator