I was recently asked about synchronizing a Merge pull subscription in SQL Server Express using RMO, the lack of a SQL Server Agent, and what to do about it. Since SQL Server Express does not include the SQL Server Agent, pull subscriptions must be synchronized by some other means. The problem becomes evident when trying to open the View Synchronization Status dialog for a pull subscription in SQL Server Express.
The View Synchronization Status dialog depends on a SQL Server Agent job which does not exist in SQL Server Express. To accommodate for the lack of a SQL Server Agent, SQL Server Express Merge pull subscriptions can also be synchronized by executing batch scripts, Windows Synchronization Manager, or Replication Management Objects (RMO). While not optimal without the SQL Server Agent, plenty of options are available. This is where it really pays to know the different ways a subscription can be synchronized when tasked with an Express subscriber.
The Merge Agent (replmerg.exe) executable can be run from the command line on-demand or from a batch script as a scheduled task. To run from the command line, execute replmerg.exe from the COM folder.
Likewise, this can be saved as a batch file and run from Task Scheduler on a schedule. This option alone provides a pretty good replacement for the SQL Server Agent and synchronizing subscriptions in Express.
Windows Synchronization Manager
Another option to synchronize pull subscriptions in SQL Server Express is Windows Synchronization Manager, or Sync Center. Sync Center provides options for setting and viewing sync partnerships, setting subscription properties and sync schedules, and viewing sync results and conflicts. This tool is ideal for having non-technical users synchronize SQL Server Express pull subscriptions on-demand as it offers a user-friendly interface. Synchronization schedules can also be configured as needed.
For all the developers, Replication Management Objects (RMO) can be used to synchronize SQL Server Express Merge pull subscriptions through managed code access. The RMO MergeSynchronizationAgent class exposes a Synchronize method which can be used to synchronize a subscription without an agent job — additional properties must be supplied. A code sample demonstrating how to synchronize a SQL Server Express Merge pull subscription using RMO can be downloaded from the MSDN Code Gallery.
As we can see, there are options for synchronizing pull subscriptions in SQL Server Express. That is because Replication was built with SQL Server Express subscribers in mind. Pull subscriptions can be synchronized using batch scripts, Windows Synchronization Manager, and RMO which should be sufficient enough to synchronize the data. If you happen to know of another way to synchronize SQL Server Express pull subscriptions and would like to share, feel free to leave a comment below.