SQL Server 2005 Replication Enhancements
In this tutorial you will learn about Overview of Replication Enhancements, User Interface Enhancements, Merge replication concurrency Enhancements, Programming changes, The Replication Monitor, Performance and Scalability Features, Pre-computed partitions, Updates to unique keys, Transactional parallelism, Download and upload only articles, Reduced contention and Managing replication.
Overview of Replication Enhancements
The most striking aspects of the enhancements made to SQL Server 2005 replication services are that configuration wizards have been made simpler and shorter and performance and scalability have been improved.
User Interface Enhancements
The first of these is the wizard enhancements. These have been redesigned with fewer pages(40% less), simplification of pages, improved default values and auto detection and less branching. These wizards can be used to implement or generate scripts for later execution against a server instance.
New subscriptions wizards have been introduced. The Push Subscription Wizard and the Pull Subscription Wizard of the earlier versions have been merged into a single wizard tool called the New Subscription Wizard. This wizard includes an ability to simultaneously create multiple subscriptions with different properties for a publication. This greatly decreases the effort required for setting up replication for small deployments. All subscriptions can be generated by running the wizard once. Larger deployments can be managed by generating scripts for later execution.
Merge replication concurrency Enhancements
Concurrency issues occur when merge replication of a delivery fails halfway through a process. This may require all the tables to be updated or none should be updated. SQL Server 2005 introduces the concept of logical records that enable the DBA define relationships between merge table articles. This ensures that related rows are all delivered together and that concurrency issues do not occur.
Programming changes:
SQL Server 2005 introduces the Replication Management objects(RMO) to implement all the programming needs within the replicated system. Since the RMO is a managed application programming interface, it can be used in .NET applications without use of complex COM interoperability code. Though SQL DMO is still supported new projects should be designed using RMO.
The RMO has a .NET assembly library that can be used by developers to program replication tasks. It is implemented in a library called Microsoft.SqlServer.Rmo.dll. The object model can be used by developers to work with individual classes without traversing the entire object model. It also has the capability of caching objects while they are in use and it allows the garbage collector clear unused memory. This enhances scalability.
Other types of objects that can be replicated are .NET user defined types and .NET assemblies.
The Replication Monitor
The replication monitor tool is a new introduction in SQL Sever 2005. This tool lets users monitor replications on a server. It functions independent of the SQL Server Management Studio and allows delegation of monitoring tasks to non-administrators. Since it is an independent application it can function in the passive mode without impacting the server.
The Replication monitor helps identify performance issues before they attain criticality and endanger the stability of the applications. Acceptable performance thresholds for a publication can be defined. When the threshold is reached, alerts can be used to warn the user.
Information is displayed in the Replication monitor is updated at an interval of a minute by default. This information is executed as part of the Replication monitoring refresher for distribution job and the results are cached to reduce the number of queries and calculations when different pages are selected in the monitor. The Publisher settings can be configured in the dialog box of the Replication Monitor and the refresh rate is defined. More resources are used when the refresh rate is set at a high value.
The replication monitor helps, DBAs easily and quickly identify any articles that impact performance issues. The upload and download statistics provide fine granular performance data.
The replication monitor enables the tracking of latency of transactional replication. Real time system analysis can be performed using tracer tokens that store the time of committal of transactions.
Performance and Scalability Features
The goal of the replication in SQL Server 2005 was to service a large number of subscribers. A number of enhancements have been made to improve the performance and scalability capabilities of the product.
Pre-computed partitions
Earlier versions of SQL Server required that rows replicated to subscribers be evaluated at the start of the synchronization with the subscriber. This becomes a performance bottleneck which SQL Server 2005 tries to overcome by introducing precomputed partitions that evaluate partition member ship when changes are made to data. The data transfer process begins when synchronization starts.
Updates to unique keys
SQL Server 2005 replicates the changes to the unique keys as UPDATE statements instead of DELETE statements of SQL Server 2000. This results in improved performance.
Transactional parallelism
In transaction replication the rate of transaction transfer from the publisher to the distributor using the log agent is minimal but the rate of transfer to subscribers from the distributor left much to be desired in the earlier versions of the server. The reason for this poor performance was that transactions which in the publisher occurred in parallel from multiple clients were being transferred in serial from the distributor to the subscriber. In SQL Server 2000 this issue is solved by enabling the Independent Agent option of the publication to be used per publication per subscriber. In SQL Server 2005 this is enabled by default.
Download and upload only articles
In replication scenarios where subscribers only use a subset of the data and there is no requirement of merging the data, the change tracking metadata is not required to be transferred. The publication which meets this requirement is to be marked as download-only article and the performance of the application would vastly improve.
Reduced contention
Contention can be reduced on subscribers that are created for reporting purposes by using snapshot isolation levels.
Managing replication
Replication in SQL Server 2005 can be managed using the new and upgraded features. Subscribers can be initialized by using standard backup and restore procedures or by using any standard method of copying a database or by using dynamic snapshots for filtered merge replication subscriber. Subscription becomes immediately available when the subscription is created if these initializing methods are used.
If snapshot delivery is interrupted, the snapshot agent becomes active and automatically resumes the delivery.
Replication of DDL statements are automatic for ALTER TABLE, ALTER VIEW, ALTER PROCEDURE, ALTER FUNCITON and ALTER TRIGGER. This function can be disabled in SQL Server Management Studio by setting the Replicate Schema changes property in the Subscription options of the publication to False. The sp_changepublication stored procedure can be called when developing scripts using the replicate_ddl parameter to enable and disable replication of DDL statements.
Finally, Anonymous subscriptions can be created without being predefined by the publisher to reduce the management tasks associated with creating subscriptions for popular publications.