Subscriber Monitor Utility Sample for Merge Replication

The Subscriber Monitor Utility sample is a Windows application that demonstrates how the Subscriber-side monitoring functionality provided by Replication Management Objects (RMO) is used to monitor merge subscriptions at the Subscriber. This sample solution can be built and run standalone at the Subscriber (using SubscriberMonitorUtility.exe). The SubscriberMonitor.dll assembly is also used by the Sales Orders Sample for Merge Replication to display subscription status.

Scenario

A replication topology is generally monitored at the Publisher or Distributor. The Microsoft SQL Server Replication Monitor is the most important tool for monitoring replication, presenting a Publisher-focused view of all replication activity. For more information, see Monitoring Replication with Replication Monitor. SQL Server Management Studio provides access to Replication Monitor. However, merge replication is designed specifically to support disconnected clients. Because it is still necessary to monitor the status of a subscription, even when the Subscriber is disconnected from the Publisher, RMO provides classes that enable this Subscriber-side monitor functionality.

Languages

  • C#

Features

The Subscriber Monitor Utility sample primarily demonstrates the facilities of RMO for monitoring merge subscriptions at the Subscriber. This sample is designed to run at a server that subscribes to a merge publication.

Prerequisites

Before running this sample, make sure the following software is installed:

  • Microsoft SQL Server 2005, including the following optionally installed components:
    • SQL Server Database Services (including replication)
    • Client Connectivity Components
    • Programming Models
    • Development Tools (including SDK)
    • Samples
    • .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See Installing the .NET Framework SDK.

Required Permissions

This sample uses Windows Authentication. To run the sample, your Windows account must be a member of the replmonitor fixed database role or the db_owner fixed database role on the subscription database.

Building and Configuring the Sample

To build the sample solution, you will need to do the following:

To build the Subscriber Monitor Utility sample

  1. Install the replication samples. For more information, see Installing Samples.

  2. At the command prompt, navigate to the SQL Server 2005 samples installation directory. The default is C:\Program Files\Microsoft SQL Server\90\Samples.

  3. Execute the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:

    sn -k SampleKey.snk

    Note

    You can skip this step if this key was previously created for use with another sample.

  4. Navigate to the SubscriberMonitorUtility folder in the replication samples directory and open the SubscriberMonitorUtility.sln solution file in Microsoft Visual Studio 2005. The location of this folder for a default installation is C:\Program Files\Microsoft SQL Server\90\Samples\Replication\Merge\SubscriberMonitorUtility\CS.

  5. Build the solution.

Running the Sample

To run the sample, you need to navigate to the location of the built executable and run it.

To run the Subscriber Monitor Utility sample at the Subscriber

  1. Start SubscriberMonitorUtility.exe from Visual Studio 2005 or from the command prompt.

  2. In the Select Subscription to Monitor dialog box, choose an instance of SQL Server from the Local Server Name drop-down box.

  3. Select a subscription to monitor from the Available Subscriptions drop-down list box.

  4. (Optional) Click the Edit button to change subscription properties.

  5. Click Connect.

  6. Select a Merge Agent session from the Merge Sessions tree view.

  7. (Optional) Click the Refresh button to refresh the session list.

Comments

Samples are provided for educational purposes only. They have not been tested in nor are they intended to be used in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.

See Also

Other Resources

How to: Programmatically Monitor Replication (RMO Programming)
Replication Developer InfoCenter
Subscriber Monitor Sample

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

5 December 2005

Changed content:
  • Updated key creation and deployment information to reflect sample updates.