Free Newsletters:
DatabaseJournal  
DBANews
Search Database Journal:
 
HOME News MS SQL Oracle DB2 Access MySQL PostgreSQL PHP SQL Etc Scripts Links Discussion
internet.com

» HOME
» NEWS
» FEATURES
» SERIES
MS SQL
Oracle
MS Access
MySQL
DB2
» RESOURCES
Products
Scripts
Links
» DISCUSSION
» TECH JOBS

Marketplace Partners
Be a Marketplace Partner




internet.commerce
Be a Commerce Partner
Find Software
Shop
Imprinted Promotions
Web Hosting Directory
Prepaid Phone Card
Condos For Sale
Server Racks
Data Center Solutions
PDA Phones & Cases
Web Design
Promotional Golf
Car Donations
Online Universities
Computer Deals




MySpace Joins eBay, Yahoo in Open Profile Push

News Corp. Unit Under Fire for Ties to Hacker

Are Non-PC Devices Hurting 'Net Innovation?

internet.com
IT
Developer
Internet News
Small Business
Personal Technology
International

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Linked Data Planet Conference & Expo

CA ERwin® Data Modeler Proven database design and modeling. Efficiently analyze, design and deploy effective database solutions. Whitepaper: Manage SQL Server Deployments
Try it free: CA ERwin® Data Modeler


Solaris 8 Migration Assistant
Rapidly move your Solaris 8 application environments to new systems running Solaris 10 with the Solaris 8 Migration Assistant. Reduce migration risk while taking advantage of increased performance, reliability and security of the latest SPARC hardware platforms and Solaris 10 OS. »

 
Sun Eco Innovation: Good for Business, Good for the Environment
A complete solution to help you optimize and refresh your datacenter while properly recycling equipment and eliminating eWaste, including money-saving promotions to lower hardware acquisition costs. »

 
Sun Eco Innovation: Power Calculators
Power consumption has increasingly become a priority in customer's minds when purchasing new systems or storage. Sun's Power Calculators provide data on power consumption of Sun products allowing IT managers to better plan the power requirements in the datacenter to achieve better energy and cost savings. »

 
Optimize the Web Tier: Consolidate to Get More Performance in Less Space and Lower Power Consumption
Expansion in the Web tier is generally accomplished by adding more servers whenever extra capacity is needed. As the pool of servers grows larger, however, the complexity of the environment can grow exponentially. »
Related Articles
SQL Server 2005 Express Edition - Part 3 - Installation
SQL Server 2005 Express Edition - Part 2
SQL Server 2005 Express Edition - Part 1

Production Manager (hands on)
Aquent
US-MA-Cambridge

Justtechjobs.com Post A Job | Post A Resume
MS SQL
February 8, 2008
SQL Server 2005 Express Edition - Part 16 - Transactional and Merge Replication
By Marcin Policht

In the recent installments of our series dedicated to SQL Server 2005 Express Edition, we started exploring its replication characteristics. As we have pointed out, its capabilities in this area are fairly restricted, limiting it exclusively to the role of a subscriber. Absence of SQL Server Agent has further impact on the range of available configuration options, necessitating employing somewhat unconventional implementation methods. In particular, setting up pull subscriptions requires a workaround that leverages either Windows Synchronization Manager (a utility built into the operating system), replication-specific executables (included with SQL Server 2005 Express Edition installation files), or custom coding (based on .NET Replication Management Objects programming model).

In our previous article, we have presented the first one of these solutions in the context of deploying snapshot replication. As we have demonstrated, while such an approach has several important benefits (ease of setup and inherent scheduling abilities), it suffers from a number of limitations, especially on Windows XP and Vista clients. (In the case of the former, only a single subscription can appear in the "Items to Synchronize" dialog box; with the latter, Sync Center does not offer support for SQL Server 2005 Express at all). Depending on your requirements, this situation might force you to resort to the remaining alternatives. However, before we provide their overview, we will first step through sample implementation of the other replication two categories - transactional and merge (whose basic characteristics we have described earlier).

In order to implement transactional replication, launch the New Publication Wizard on the publisher (using the New Publication... option in the context sensitive menu of the Local Publications subnode of the Replication node in the Object Explorer window of SQL Server Management Studio). As before, we will choose AdventureWorks as the source database, select Transactional publication (instead of Snapshot publication) entry on the Publication Type page and use the Department (HumanResources) table as the replication article (on the Articles page), without specifying any filtering. Since transactional replication relies on availability of the initial snapshot, you will be prompted to decide whether you want to create one immediately so it is ready when the subscription is initialized (this is the approach we will use in our demonstration) or whether to schedule the snapshot agent at a later date and time. You will also need to configure security options for both snapshot and log reader agent accounts (for more information about the recommended settings, refer to the Replication Agent Security Model article of the SQL Server 2005 Books Online). In the final step, assign a unique name to your publication and click on the Finish command button to complete the procedure.

The process of subscribing to this new publication is very similar to the one we documented earlier when discussing snapshot replication. As before, start by launching the New Subscription Wizard using the New Subscription... entry from the context sensitive menu of the Local Subscriptions subnode (located under the Replication node of Object Explorer of the SQL Server Management Studio Express on the subscriber). Once on the Publication page, connect to the SQL Server instance operating as the publisher and select the transactional publication, whose creation we described in the previous section. At this point, you will have to decide whether to implement a push (with its agents running on the distributor) or a pull subscription (which, in our case, in absence of the SQL Server Agent component, implies the need for an alternative synchronization method). In addition, you will be prompted to designate a subscription database, pick (irrelevant in our case) the Distribution Agent Security mechanism (which determines whether to impersonate the process account for connections to the distributor and the subscriber), as well as confirm the synchronization schedule. Note that you will not be able to choose the continuous option, which is available when subscriptions are hosted on an instance of SQL Server 2005 Standard or Enterprise Editions, but instead, you will have to leverage the "Run on demand only" setting (triggered by one of our custom workarounds). Finally, specify that you want to initialize the new subscription at the first synchronization, ensure that the checkbox "Create the subscription" on the Wizard Actions page is enabled, and click on the Finish command button on the last page of the wizard.

After you confirmed that the initial snapshot of the Department (HumanResources) table has been created, (it should appear in the snapshot folder as long as you followed the instructions provided above), you can employ Windows Synchronization Manager (providing that you enabled the "Use Windows Synchronization Manager" option in the subscription Properties dialog box in the Local Subscriptions node of the Object Explorer in the SQL Server Management Studio Express on the subscriber) to initiate synchronization. (The Status entry in the subscription Properties dialog box would provide the summary of its outcome). By reviewing the content of the same Properties dialog box of the subscription, you should be able to monitor its status (displayed in the lower right corner).

Setup of merge replication can also be handled using the friendly interface of the New Publication wizard. Once you select its entry on the Publication Type page, you will be prompted to select the version of the database engine on prospective subscribers from the following list:

  • SQL Server 2005 (which is the option suitable in our case),
  • SQL Server 2005 Mobile Edition (requiring snapshot files in character format),
  • SQL Server 2000 (lacking support for such features as logical records or replication of Data Definition Language changes),
  • SQL Server for Windows CE (subject to all of the listed above restrictions).

Next, you will see the familiar Articles page, where, for the purpose of our example, we will choose the Production.ProductDescription table (which already includes the uniqueidenifier column, required for resolution of potential merge conflicts). While on this page, note that the range of properties that can be configured for the selected articles is significantly more extensive compared with those available for snapshot or transactional replication (including the ability to manage identity range, control change merging behavior, or dictate which object types and settings should be copied to subscribers). For the sake of simplicity, accept the defaults and skip the filtering options. Accept the default entries on the Snapshot Agent page (leading to the immediate creation of a snapshot and scheduling its agent to run on biweekly basis). Finally, set the snapshot agent security, assign a unique name to the publication, and trigger its creation by completing the wizard.

In order to subscribe to the newly created merge publication, launch the New Subscription Wizard on the subscriber (using the same "New Subscription..." entry in the context sensitive menu of the Local Subscriptions subnode of SQL Server Management Studio Express) and connect to the publisher from the Publication page. As before, you will be offered a choice between running all agents at the distributor, resulting in a push subscription, or at the subscriber, generating a pull subscription, which requires a custom synchronization mechanism (make sure that you select the latter). Follow by designating the subscription database on the subscriber, assign the same merge agent security settings we chose before ("By impersonating the process account"), accept default synchronization schedule ("Run on demand only"), and leave initialization of the subscription with its "At first synchronization" default. On the next page of the wizard, specify one of two possible subscription types you want to use on your subscriber. Client type is suitable for most scenarios, automatically performing the conflict resolution for a particular row change when the first subscriber (which introduced such change) synchronizes with the publisher (subsequent conflicts with other subscribers are effectively ignored). Server type gives you more flexibility in managing multiple changes to the same row by different subscribers (allowing assigning arbitrary priorities to each subscriber and supporting republishing data to other subscribers). For the purpose of our sample demo, select the Client option, ensure that "Create the subscription" option is enabled on the next page, and proceed with the wizard to its completion by clicking on the Finish command button.

In order to perform merge replication (via means other than the already discussed Windows Synchronization Manager), you can take advantage of the replmerg.exe utility, which is used by traditional Replication Merge SQL Server Agent jobs. Despite the fact that the agent functionality is not available in SQL Server 2005 Express Edition, this executable is still included with the installation files and can be found in the Program Files\Microsoft SQL Server\90\COM folder. While its syntax is rather cumbersome, you can fairly easily come up with parameters necessary to invoke synchronization by reviewing the content of the Replication Merge job step on any existing SQL Server 2005 Standard or Enteprise Edition installation (for a detailed description of all parameters, refer to the MSDN article Replication Merge Agent). For example, assuming that our publisher/distributor is located on the default SQL Server 2005 Enterprise Edition instance on the computer ALPHA, that our SQL Server 2005 Express Edition-based subscription database called AdventureWorksRepl resides on OMEGA, and that our publication is called ProductDescription(Production), then the following would allow you to trigger synchronization from the Command Prompt. (Note that entire content below constitutes a single command and should be typed in without any line breaks).

replmerg -Publisher [ALPHA] -PublisherDB [AdventureWorks] -Publication [ProductDescription(Production)] 
 -Distributor [ALPHA] -SubscriptionType 1 -Subscriber [OMEGA\SQLEXPRESS]
 -SubscriberSecurityMode 1 -SubscriberDB [AdventureWorksRepl] 

Similarly, you can initiate transactional replication by utilizing the distribution agent executable distrib.exe (also stored in the Program Files\Microsoft SQL Server\90\COM folder), by launching it with an equivalent set of parameters (their full listing is provided in the MSDN article Replication Distribution Agent, which, fortunately, fairly closely corresponds to those used by replmerg.exe). Assuming our sample scenario as well as identically named publisher/distributor and subscriber, you would be able to invoke transactional replication by executing the following from the Command Prompt. (Again, the entire content listed below needs to be typed as a single command).

distrib -Publisher [ALPHA] -PublisherDB [AdventureWorks] -Publication [Department(HumanResources)] 
 -Distributor [ALPHA] -SubscriptionType 1 -Subscriber [OMEGA\SQLEXPRESS] 
 -SubscriberSecurityMode 1 -SubscriberDB [AdventureWorksRepl]

Both utilities can be easily configured for unattended execution by employing Windows Scheduled Tasks functionality. In our next article of this series, we will review other replication scenarios involving SQL Server 2005 Express Edition-based subscriptions.

» See All Articles by Columnist Marcin Policht

Tools:
Add databasejournal.com to your favorites
Add databasejournal.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed

MS SQL Archives

Flash Demo: Learn how IBM Information Server Blade is easy to manage, highly scalable and efficient.
Quest Whitepaper: Improving Oracle Database Performance Using Real-Time Visual Diagnostics
Data Sheet: IBM Information Server Blade
HP eBook: Using Business Service Management (BSM) to Manage Your Business Applications
Best Practices: Make the Case for IT Investments. Complimentary Independent Report. Download Now!


Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
How To Transfer Access Data Records To SQL ?? ankurdjariwala 1 May 8th, 12:24 PM
problem with federated server linking majidkhan 1 April 29th, 10:00 AM
"SELECT rowguidcol" from tables on linked servers? brentbordelon 1 April 25th, 04:12 PM
"SELECT rowguidcol" vs. "SELECT <actual name>" rgarrison 9 April 16th, 03:46 PM







JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES