Publish, subscribe achieve database synchronization

  Part of said through SQL JOB way as the continuation of an introduction to synchronization, this section of the database to synchronize operations between the database by posting subscription. Subscribe to publish parts of two steps: 1, release. 2 subscription. First to publish the need to synchronize data on the data source database server, and then subscribe to the distributor on the target database server. Publication can publish a part of the data table can also be published to the entire table. The following describes the publication, subscription process.

  A , release. Posted need to use the actual server name, you can not use the server's IP address. Information can be released, including Table], [Stored Procedures], [users] function If you use the IP there have been mistakes, as shown below:

   Specific release process is as follows:

  1. Find [copy] under the database server - [local] release, select [New release]. As shown below:

 

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

 

 3, select the type of publication. Here select the default type [snapshot]. Several distinct types of release, SQL SERVER are given in the following description. As shown below:

  4, select the type of content to be released. As shown below:

The right side of the figure above is the screening of SQL statements.

  5, set the Snapshot Agent. As shown below:

 FIG synchronizing frequency changes as follows:

6, set the proxy security. As shown below:

7. Fill in name

8, complete release. As shown below:

Second, subscribe to . Subscribe snapshot of the database is to synchronize the release, the release of the data source data synchronization to the target database. DETAILED subscription process is as follows;

1. Find [copy] under the database server - [local] subscription, select Subscribe [New]. As shown below:

2, choose to subscribe to the publication. As shown below:

3, the distribution agent selected position; FIG follows:

4, select a store on the subscriber data or synchronized from multiple target databases. As shown below:

To add more subscription database, then click [Add] subscribers. As shown below:

5, set up security for the Distribution Agent. As shown below:

6, set the synchronization schedule. As shown below:

7, to complete the subscription. As shown below:

This completes the entire process publishing and subscriptions.

Here, and on section with just introduced over two kinds of SQL Server database synchronization, I hope useful to you.

 
 

  上篇中说了通过SQL JOB的方式对数据库的同步,这一节作为上一节的延续介绍通过发布订阅的方式实现数据库之间的同步操作。发布订阅份为两个步骤:1、发布。2订阅。首先在数据源数据库服务器上对需要同步的数据进行发布,然后在目标数据库服务器上对上述发布进行订阅。发布可以发布一张表的部分数据,也可以对整张表进行发布。下面分别介绍发布、订阅的过程。

  一、发布。发布需要用实际的服务器名称,不能使用服务器的IP地址进行。能发布的信息包括【表】、【存储过程】、【用户函数】如果使用IP会有错误,如下图:

   具体发布过程如下:

  1、找到数据库服务器下的【复制】--【本地发布】,选择【新建发布】。如下图:

 

  2.选择待发布的数据库。如下图:

 

 3、选择发布类型。这里选择的默认类型【快照发布】。几种发布类型的区别,SQL SERVER都在下面给出了说明。如下图:

  4、选择待发布的类容。如下图:

上图中右侧就是筛选的SQL语句。

  5、设置快照代理。如下图:

 更改同步频率如下图:

6、设置代理安全性。如下图:

7、填写发布名称

8、完成发布。如下图:

二、订阅。订阅是对数据库发布的快照进行同步,将发布的数据源数据同步到目标数据库。具体订阅过程如下;

1、找到数据库服务器下的【复制】--【本地订阅】,选择【新建订阅】。如下图:

2、选择订阅的发布。如下图:

3、选择分发代理的位置;如下图:

4、选择订阅服务器上的存放同步过来的数据的一个或者多个目标数据库。如下图:

若要添加多个订阅数据库,则点击【添加订阅服务器】。如下图:

5、设置分发代理的安全性。如下图:

6、设置同步计划。如下图:

7、完成订阅。如下图:

这样就完成了发布与订阅的整个流程。

这里,和上节一起就介绍完了SQL Server数据库同步的两种方式,希望对你有用。

Guess you like

Origin www.cnblogs.com/linybo/p/12028694.html