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.
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.
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.
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)
- .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.
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
Install the replication samples. For more information, see Installing Samples.
At the command prompt, navigate to the SQL Server 2005 samples installation directory. The default is C:\Program Files\Microsoft SQL Server\90\Samples.
Execute the following at a .NET Framework or Microsoft Visual Studio 2005 command prompt:
sn -k SampleKey.snk
You can skip this step if this key was previously created for use with another sample.
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.
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
Start SubscriberMonitorUtility.exe from Visual Studio 2005 or from the command prompt.
In the Select Subscription to Monitor dialog box, choose an instance of SQL Server from the Local Server Name drop-down box.
Select a subscription to monitor from the Available Subscriptions drop-down list box.
(Optional) Click the Edit button to change subscription properties.
Select a Merge Agent session from the Merge Sessions tree view.
(Optional) Click the Refresh button to refresh the session list.
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.
Help and Information
5 December 2005