Let’s consider a scenario we have a database in which we have 3 tables 2 of them are already added in replication and we want to add a third table in publication.
This is more important when we have a larger database and we don’t want to reinitialize the replication.
To avoid complete snapshot of the Publisher database and to avoid re-initialization we need to make some changes in the existing replication. We need to set 2 properties to False as shown below
- allow_anonymous
- Immediate_sync
Execute below commands
Now add table T3 again from Publisher properties and press ok.
- USE
- GO
- EXEC sp_changepublication @publication = ‘PubDB’,
- @property = ‘allow_anonymous’,
- @value = ‘false’
- GO
- USE
- GO
- EXEC sp_changepublication @publication = ‘PubDB’,
- @property = ‘immediate_sync’,
- @value = ‘false’
- GO
Now add the new articles in existing publication
Now start Snapshot Agent
Now you can notice that it only creates a snapshot of one article instead of all articles, now start log reader agent if it’s in the stopped state.
Now as you can see a snapshot was generated but only for one article, so this article will be replicated to all subscriber without impacting existing replication.
Don’t forgot to execute below command at last to enable the disabled properties.
- Use
- GO
- EXEC sp_changepublication @publication = ‘PubDB’,
- @property = ‘allow_anonymous’ ,
- @value = ‘True’
- GO
- Use
- GO
- EXEC sp_changepublication @publication = ‘PubDB’,
- @property = ‘immediate_sync’ ,
- @value = ‘True’
- GO
Now you can verify the article on all your subscribers
If you want to know more about immediate sync command follow below link