Step by step teach you how to configure SQL server merge and copy (5) Configure publisher (on)

Source: Internet
Author: User
Note: Many of the content in this article is also one of the most important links for merging and copying. Therefore, configuring publisher will be divided into two chapters for translation.)
When SQL Server distributorAfter the configuration is complete, you can configure it as full as possible. SQL Server publisher PublisherIs a database that provides data for Synchronous replication by devices. We must implement it. First, open your SQL ServerIn the resource manager window, expand ReplicationRight-click the folder. Local publicationsFolder, and then select New Publication.

The first interface is the wizard interface. If you don't want to talk about anything, clickNext.

InDistributorThis interface selects a serverDistributor, The first button is to select the local just releasedDistributor, The second button is to select another server, we select the second, and clickAdd.

The pop-up page will guide you to connect toSQL ServerServer, we selectSyncidstributorThen clickConnect.

Then you will see the added button in the box of the second button you just selected.SyncdistributorAnd clickNext.

InAdministrative PasswordOn this page, the password is used remotely.DistributorAnd localPublisherFor verification, we enter the password and confirm the password.P @ sswordAnd then clickNext.

InPublication DatabaseIn this interface, we chooseParksurveyThe database is used for publishing, and then clickNext.

InPublication typeThis interface is usedSQL mobileSo we chooseMerge publicationThen clickNext.

InSubscriber typesIn this interface, we need to specify a database that needs to be synchronized with the distribution database. Here we chooseSQL Server 2005 compact EditionThen clickNext.

InArticlesThis interface shows that the published database should be followedSQL Server compactSynchronization. here you will see the listed tables for release, stored procedures, and user-defined functions, but only tables can workSQL Server compact. If you do not want to publish the entire table for copying, you can also filter some fields to reduce the number of snapshots andSQL Server compactOf course, some sensitive data is also protected.

When you select a table separately, you will find a check box on the right.Highlighted table is download onlyIf you select this check box, it means that the data synchronized to the device database will not be tracked, which can greatly reduce the space of the server and the device database. However, this means that the subscriber will not change the data in this table. The premise is that the subscriber will not add, delete, or update the records in this table. Here we chooseCitiesAndParksBoth tables are markedHighlighted table is download only,SurveyThis is not needed. Then we select a table and clickArticle Properties.

Here you can set some global attributes of the table. Below are all attributes of the table.

(Note: This is an important part of merging and copying. You will gain some insights.)
Take a closer look at this attribute table and you will find that you have five main parts. The first part is copy objects and settings to subscriber. This section describes whether the device copies the primary key, foreign key, association, index, and trigger when copying a table from the server. It is best to use the default value here, because the system has set everything for you.

In the secondDestination objectClickSyncchronization directionThis attribute has three values for us to choose oneBidirectional, One isDownload-only to subscriber, prohibit subscriber changes,The third value isDownload-only to subscriber, allow subscriber changes. The first value indicates that the server will track the synchronized table and allow the device to modify, update, and add the table for synchronization, the second value indicates that the server does not track the table synchronized and does not allow the device to make any changes to the table, the third value means that the server does not track the synchronized table but allows the device to change it.

SkipIdentificationLet's look at it directly.Identity range managementThis attribute block exists only when your table contains an auto-increment column. Here, I don't want to modify it, but I want you to understand what it is. In many cases, database tables contain an auto-increment column as a unique primary key, but the problem is that when the server synchronizes this table to many devices, when they all add a column in the table, they will add the same primary key in the table, but the content is different. When these modifications are submitted back to the server, a primary key conflict occurs. Therefore, only one device change can be submitted to the server, and other device changes cannot be submitted to the server. SQL Server solves this problem by giving each subscriber a range of 1000 auto-growth columns. For example, the auto-growth ID range of a device is 1 ~ 1000, the other one may be 1001 ~ 2000. In this way, our primary keys will not conflict. In this way, you don't have to worry about primary key conflicts. Of course, you can modify the value of 1000 to make it bigger or smaller to meet your needs.

Next let's take a lookMerging changesThis attribute block, the first attribute you can see isTracking levelThe default system will optimize your selectionRow-level trackingThis value indicates that two subscriber are at the same time in any field of the same row.
Changed,Merge AgentThe conflict manager is automatically started. Only one of the two subscribers can update the modification to the server database, and the other subscriber's modification is automatically added to the conflict table. If you selectColumn-level trackingIf the two subscribers modify different columns in the same row, their modifications will be submitted to publisher. This is used to reduce data conflicts. In terms of performance,Row-level trackingBetter performanceColumn-levelIf your table does not contain fields of the image, ntext, binary, or nvarchar (max) type.

When we clickResolverThis option bar may surprise you, because you have not seen a lot of content, this place is to choose a tool for managing conflicts, I did not choose a custom conflict management tool, because I think the default conflict manager can solve our problem well.CancelThen clickNext.

Article lssuesThis page prompts you that an item that identifies a unique column will be addedPublisher. ClickNext.


(Note: The next article describes how to synchronize a specific table with a specific person)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.