SqlServer database synchronization (publish, subscribe)

In the previous article, we talked about the synchronization of databases through SQL JOB. This section, as a continuation of the previous section, introduces the synchronization operation between databases by publishing and subscribing. There are two steps to publish and subscribe: 1. Publish. 2 Subscribe. First, publish the data to be synchronized on the data source database server, and then subscribe to the above publication on the target database server. Publishing can publish part of the data of a table, or publish the entire table. The following describes the process of publishing and subscribing respectively.

  1. Publish. Publishing requires the actual server name, not the server's IP address. The information that can be published includes [Table], [Stored Procedure], [User Function] If you use IP, there will be errors, as shown below:

   The specific release process is as follows:

  1. Find [Replication] - [Local Publishing] under the database server, and select [New Publishing]. As shown below:

 

  2. Select the database to be published. As shown below:

 

 3. Select the release type. The default type selected here is [Snapshot Release]. The difference between several types of publishing, SQL SERVER is given below. As shown below:

  4. Select the category to be published. As shown below:

The right side of the above figure is the filtered SQL statement.

  5. Set the snapshot agent. As shown below:

 Change the synchronization frequency as shown below:

6. Set up proxy security. As shown below:

7. Fill in the release name

8. Complete the release. As shown below:

2. Subscribe . Subscription is to synchronize the snapshots published by the database, and synchronize the published data source data to the target database. The specific subscription process is as follows;

1. Find [Replication] - [Local Subscription] under the database server, and select [New Subscription]. As shown below:

2. Select the publication to subscribe to. As shown below:

3. Select the location of the distribution agent; as shown below:

4. Select one or more target databases on the subscriber server that store the synchronized data. As shown below:

To add multiple subscription databases, click [Add Subscriber]. As shown below:

5. Set the security of the distribution agent. As shown below:

6. Set up a synchronization plan. As shown below:

7. Complete the subscription. As shown below:

This completes the entire process of publishing and subscribing.

Here, together with the previous section, I have introduced two methods of SQL Server database synchronization, I hope it will be useful to you

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325960409&siteId=291194637