Back to results for “Architecture”
SQL Server › Replication

What steps are involved in setting up transactional replication for the first time between a publisher and a new subscriber?

Intermediate

Answer

You configure a distributor if one does not already exist, create a publication on the source database specifying which articles, meaning tables or other objects, should be included, create a subscription on the target database pointing back to that publication, and then perform an initial synchronization, often through a snapshot, before ongoing transactional changes begin flowing automatically.
EXEC sp_addpublication @publication = 'SalesPublication';
EXEC sp_addarticle @publication = 'SalesPublication', @article = 'Orders';
EXEC sp_addsubscription @publication = 'SalesPublication', @subscriber = 'SubscriberServer';
Real-world example A team sets up a brand new reporting subscriber for their sales publication, following the standard sequence of configuring the distributor, defining the publication and its articles, and finally creating the subscription before replication begins flowing.

Common follow-ups: What happens during the initial snapshot synchronization step?;How long does the initial setup typically take for a large publication?