none
Web synchronization : Subscription Expiration and Deactivation

    Question

  • Hello, 

    I'm maintaining a merge replication with the publisher MS SQL Server 2008 R2 and the subscriber SQL Server CE 3.5 installed the PDA through web synchronization. I am really lost on the problem on the subscription expiration. 



    As the document SQL server said, in case of the subscription expired after the retention period passed, the subscription will be deactivated, however we can reinitialize the subscription to avoid the subscription dropped by the Expired subscription clean up job. (https://docs.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms151188%28v%3dsql.105%29)



    So I wanted to reinitialize after passing the retention period, but the synchronization doesn't work with these errors messages :

     - On the publisher side : The snapshot for this publication has become obsolete. The snapshot agent needs to be run again before the subscription can be synchronized.

    - On the subscriber side : A call to SQL Server Reconciler failed. Try to resynchronize. SQL CODE 29006



    I've got to know that after regenerate the snapshot, the synchronization works well. But it is not the goal to generate manually whenever it happens. So I wonder 

    - Why the snapshot always become obsolete after the expiration of subscription? Even though there is no change on the schema but only on the data. 

    - Is there a way to run the regeneration of snapshot before synchronization on C# sqlSeverCE?

    - On the current status, the generationg snapshot runs every 2 weeks, if i run it every days at 5am, it will create too much metadata?

    Thanks,


    Monday, July 2, 2018 9:12 AM

All replies

  • 1) merge replication uses tracking metadata to know what has changed between synchronizations of the publisher and subscriber. In some cases you can use the option the subscription will never expire, but you will find that the publisher and subscriber have to go through so much meta data to figure out what has changed sync times become too long. Hence the merge meta data is purged after a certain point (called the retention period). If your subscriber has not synchronized within the retention period, the merge replication process does not know what to upload and download, so it fails by design.

    2) you can run the snapshot every day at midnight (for example). However, web synchronizations are anonymous and will necessitate regeneration of the snapshot each time you reinitialize. The snapshot process will keep a minimum set of metadata in the snapshot files, so it is wise to run the snapshot agent regularly before you reinitialize.

    3) Not with anonymous subscriptions.

    4) No, it will keep a trim set. 

    Monday, July 2, 2018 10:36 AM
    Moderator
  • Thank you for your reply!

    So if I understood well, as long as the difference of data exists between the publisher and the subscriber, the snapshot needs to be regenerated "manually" on the publisher before reinitialization (after the retention period)?

    Then if the job REPL-snapshot runs every 5 mins, the snapshot obsolete error would happen less?
    I want to manual operation as much as possible..

    Monday, July 2, 2018 2:49 PM
  • For web synchronization the snapshot is generated when you reinitialize.

    If you are not using web synchronization you should use a fresh snapshot, otherwise a lot of merge replication metadata will go down to the subscriber to update the old snapshot files to the current state.

    To prevent the subscriber from getting out of date and requiring reinitilaiztaion you need to update the merge agent more frequently.

    Monday, July 2, 2018 4:24 PM
    Moderator