Methods of Implementation

SQL Replication

Replication

Methods of Implementation

Methods for implementing replication, developing replication applications, and maintaining replication are: replication wizards and properties, replication programming interfaces, scripting of system stored procedures, and Windows Synchronization Manager.

Replication Wizards and Properties

SQL Server Enterprise Manager includes several wizards and properties dialog boxes you can use to simplify the installation and maintenance of replication. SQL Server Enterprise Manager allows you to view and modify the properties of replication, and provides graphical navigational tools. It also provides the replication folder and Replication Monitor, which help you monitor and troubleshoot replication activity.

The following replication wizards and properties dialog boxes provide a guided approach to implementing replication:

  • The Configure Publishing and Distribution Wizard helps you specify a server to use as a Distributor and, optionally, specify other replication components. After the Publisher and Distributor are configured initially, changes can be made in the Publisher and Distributor Properties dialog box.

  • The Create Publication Wizard guides you through the process of choosing the type of replication and replication options, specifying the data or database objects that you want to replicate, the types of Subscribers that will access the publication, as well as other properties of the publication. After the publication is created using the Create Publication Wizard, changes can be made in the Publication Properties dialog box.

  • The Push Subscription Wizard helps you create a subscription to a publication that will be distributed to a specified Subscriber. You can view the options selected for a push subscription in the Subscription Properties dialog box.

  • The Pull Subscription Wizard helps you create a subscription to a publication requested by a Subscriber. After the subscription is created, you can view the options in the Pull Subscription Properties dialog box.

  • The Disable Publishing and Distribution Wizard helps you disable publishing, distribution, or both, on a server.

After replication is configured using wizards, you can script different configuration processes of replication. For example, after creating a standard subscription to a publication for one Subscriber, you can script the set up of the subscription, run it at various Subscribers, and substitute the correct Subscriber name in the script as necessary. For more information, see Scripting Replication.

Replication Programming Interfaces

Another method of replication implementation and administration is by using one of, or a combination of, the replication programming interfaces:

  • SQL-DMO

  • Microsoft® ActiveX® controls for replication

  • Replication Distributor Interface

SQL-DMO has more options available than the replication wizards (which are based on SQL-DMO), and you can create custom applications using Microsoft Visual Basic® or Microsoft Visual C++® that allow you to configure or maintain a replication topology. SQL-DMO can be used to program replication administration such as configuring distribution, creating subscriptions, and so on.

ActiveX controls for replication enable you to control Snapshot Agent, Merge Agent, and Distribution Agent activity programmatically. This allows users to program replication into their applications. The controls also offer some lightweight administration options to create, delete, and reinitialize subscriptions, and to control, monitor, and troubleshoot replication agents. These controls can be used to program activity needed to operate replication. For example, for an application that provides online and offline capabilities, you may want to expose a Synchronize button. That button can be associated with the merge ActiveX control, and whenever the users click the button, the Merge Agent connects to the Publisher, and data is synchronized for the specified publication.

The Replication Distributor Interface provides the capability to replicate data from heterogeneous data sources such as Microsoft Access or Oracle. The Replication Distributor Interface is used primarily by independent service vendors, or others who need to develop a custom replication application based on proprietary data sources.

Essentially, this interface allows a custom solution while employing the replication distribution system, but developers assume the data modification detection capabilities that would typically be conducted by the Log Reader Agent.

Replication System Stored Procedures

Replication system stored procedures are documented and available as a method for implementing replication in special circumstances or for use in batch files and scripts. In most cases, however, you are better served by using the programming interfaces SQL-DMO and replication ActiveX controls for programming replication. SQL-DMO provides an easier method and higher-level solution than direct use of stored procedures.

The stored procedures are typically used if you use the scripting features from SQL Server Enterprise Manager. When you script replication, SQL Server generates Transact-SQL batches that re-create the replication environment (configuring publishing and distribution, creating publications and subscriptions, and so on). After the scripts are generated, you can edit them as needed using SQL Query Analyzer.

Windows Synchronization Manager

Windows Synchronization Manager is a utility available with the Microsoft Windows® 2000 operating system and anywhere Microsoft Internet Explorer version 5.0 or later is installed. It allows you to synchronize data between instances of Microsoft SQL Server™. You can use SQL Server Enterprise Manager to enable pull subscriptions for use in Windows Synchronization Manager, or you can enable subscriptions programmatically for use in Windows Synchronization Manager by using ActiveX controls for replication.

Using Windows Synchronization Manager, you can schedule synchronizations or instruct Windows to synchronize selected items automatically when you log on to the computer or when the computer is idle for a specified length of time. Windows Synchronization Manager is located under the Accessories folder on the Windows Start menu.

See Also

Developing SQL-DMO Applications

Getting Started with Replication Programming

Replication Tools