In which server does the snapshot agent run?

Posted on

Question :

While configuring a publisher for replication, we execute sp_startpublication_snapshot SP and provide the publication name as a parameter to the SP. We do not specify the distribution server’s login/password. So, I am confused if the snapshot agent runs on the publisher or distributor. Even if it runs on distributor then how can we trigger it from publisher (sp_startpublication_snapshot has to run at publisher as per MSDN tutorials)

Answer :

The Snapshot Agent (snapshot.exe) runs on the Distributor.

From Books Online:

Replication Agents Overview

Snapshot Agent

The Snapshot Agent is typically used with all types of replication. It
prepares schema and initial data files of published tables and other
objects, stores the snapshot files, and records information about
synchronization in the distribution database. The Snapshot Agent
runs at the Distributor
. For more information, see Replication
Snapshot Agent
.

However, the stored procedure sp_startpublication_snapshot is executed at the Publisher on the publication database and is used to start the Snapshot Agent job that generates the initial snapshot for a publication.

When you configured replication and created the publication, you specified the accounts in which the Snapshot Agent will run under at the Distributor and the Publisher. This account information is saved. This is covered in Snapshot Agent Security.

Even though you execute sp_startpublication_snapshot from the Publisher, it already has all of the necessary information to connect to the Distributor and start the Snapshot Agent.

Leave a Reply

Your email address will not be published. Required fields are marked *