Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

742


Part V: Enterprise Data Management


columns that you want to replicate. The Article Properties button enables you to
control how tables will be replicated. (For example, you can choose to replicate user
indexes.) Click Next. The Article Issues dialog then warns you that a unique identi-
fi er (GUID) column will be added to all tables you are indexing.


  1. Click Next to advance to the Filter Rows dialog. Merge replication is designed to
    replicate only a subset of the data to the subscriber. Part of the reason for this
    is because merge replication is frequently used over low bandwidth lines, such
    as over a phone line or the Internet. By fi ltering rows you can minimize the
    amount of data sent to your subscriber. You can also use join fi lters. Basically,
    join fi lters extend a fi lter you place on a table to all the other tables that have
    foreign key relationships on the fi ltered column. Consider the SalesTerritory
    table in the AdventureWorks database. It is joined to the SalesOrderHeader
    table by TerritoryID, and the SalesOrderHeaderTable is joined to the
    SalesOrderDetail table by the SalesOrderID column. If you fi lter on the
    TerritoryID, subscribers would get only the related data for a particular
    TerritoryID.
    To use join fi lters, click the Add button in the Filter Table Rows dialog, and select
    Automatically Generate Filters, or click the Add Filter button, and select the tables
    and rows you want to fi lter on. You then have the option to click the Add Button
    again and select Add Join to Extend the Selected Filter. You can also fi lter on Host_
    Name() and USER_NAME(), both of which can be overridden by the Merge Agent
    (HostName and PublisherLogin, respectively).

  2. After you create your fi lters, click Next to launch the Snapshot Agent dialog; in
    most cases you want to accept the default. Click Next to launch the Snapshot
    Security Agent dialog and set the appropriate accounts for your Snapshot Agent.

  3. Click Next to advance to the Snapshot Options dialog, where you can either gener-
    ate your publication or script it out. Click Next to name your publication, and then
    click Finish. When your publication has been created, click Close.
    Creating merge replication subscriptions is almost identical to creating subscriptions to
    transactional and snapshot publications. There are two differences:


■ (^) The fi rst is that there is a Subscription Type dialog. This controls confl icts.
Confl icts arise when an attempt is made to update a row that has been deleted on
the subscriber between syncs, or the same primary key value is assigned on the
publisher and subscriber between syncs. The Subscription Type dialog controls how
confl icts are resolved. For example, you can assign a value of 75 percent to your
subscriber. This means that the subscriber change remains on the publisher unless
another subscriber with a higher priority syncs that row at a later point in time. In
this case, the subscriber with a higher priority replaces the value that came from
the lower priority subscriber. The other subscription type is Client, which means
that the fi rst value to the publisher wins any confl icts.
c28.indd 742c28.indd 742 7/31/2012 9:51:13 AM7/31/2012 9:51:13 AM
http://www.it-ebooks.info

Free download pdf