subscriber reinitialization (Replication)

  • Posted this under sql server 7,2000 replication category and was wondering why I don't get any replies. Anyway here is my

    Scenario:

    Merge Replication

    SQLServer 2008 R2 Pulisher

    SQLServer 2008 Express Subscriber (Pull)

    Web Synchronization

    publication property auto_initialization_policy is set to 1.

    publication property replicate_ddl is set to 0.

    Snapshot recreated and publication marked for reinitialization on next sync.

    After snapshot created and before sync happens, I delete a couple of rows from the article (publication side). These rows exist already on subscriber side because of previous syncs.

    Now I sync on the subscriber side.

    After sync, I do not see the deleted rows on both sides.

    I guess my question is, when a snapshot is applied, does it not mean the end data should be what's in the snapshot? and not all the recent changes after the snapshot is created? otherwise what is the use of applying the snapshot? for schema purposes only?

    Can anyone please explain why?? data is synched before snapshot is applied right? so rows are deleted while sync and snapshot is applied after. Snapshot has the deleted rows in it because rows are deleted after snapshot creation. So why don't show up on both sides in the end?

  • I guess my question is, when a snapshot is applied, does it not mean the end data should be what's in the snapshot? and not all the recent changes after the snapshot is created? otherwise what is the use of applying the snapshot? for schema purposes only?

    - The snapshot is just a starting point. The logreader agent reads the data from the transactional log and send them to the distributor. Your subscriber (only the tables included in the subscription of cause) will contain the same data as your publisher. The snapshot contains structures and data. Any changes done to the publisher since the snapshot is created are replicated to your subscriber. When initializing you drop the tables at the subscriber and recreate them (you can also truncate but that is not default) as they look when the snapshot was created. Any changes since the creating of the snapshot are kept in the distribution database just waiting to be applied to your subscriber when you initialize.

  • mh,

    Can you post the source link to your explanation? I am doubtful that while reinitialization everything is dropped/deleted and recreated.

  • A dumb question I'm sure....did you manually run the snapshot agent?

    ______________________________________________________________________________Never argue with an idiot; Theyll drag you down to their level and beat you with experience

  • psteja2000 (7/31/2012)


    mh,

    Can you post the source link to your explanation? I am doubtful that while reinitialization everything is dropped/deleted and recreated.

    Hi Psteja

    Replication is a complicated subject of MSSQL server. The following links are a start, but I suggest that you spend an hour or two reading how replication works, books online is your friend.

    Replication requires the publisher and subscriber to have the same starting point when you start the synchronization, from here you start applying changes since the snapshot was created, this is where the logagent comes into place. The reason you are "missing" your rows is because the delete commands on the publisher is replicated to the subscriber the moment replication is initialized(reinitialized).

    If you want to run a script after the shapshot is applied but before the synchronization start this is also an option.

    Create and Apply the Snapshot

    http://msdn.microsoft.com/en-us/library/ms151785

    Documentation of the sp_addarticle command (check the [ @pre_creation_cmd =] 'pre_creation_cmd'):

    http://msdn.microsoft.com/en-us/library/ms173857.aspx

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply