Sqlserver2012 on two different servers database synchronization

Synchronization almost a month, ha ha, because the way is too much trouble for the first time, local encounter trouble and stopped, finally synchronization is successful, ha ha, here I will introduce my two database synchronized implementation process .

  First, the configuration needs to pay attention to things:

  1. Open sqlserver configuration manager, start sqlserver agent, setting properties, the start mode to start automatically (both servers need to be configured), specifically shown:

  

  2. Create a new query in sqlserver, enter the sql statement select @@ SERVERNAME, alias query to this server, (because sqlserver on a computer connected to other computers connected sqlserver when an error in the database will be synchronized, has tried mistake , so advance that here), the alias of this inquiry to the sqlserver, the machine outside the network ip alias and write hosts file, (C: \ Windows \ System32 \ drivers \ etc \ hosts), two servers need each other its hosts file and write each other's ip aliases.

  

  3. Next to start the main part of it, to establish a database DB_test, create a table tb1 in the database, write several fields, but be sure to add a set of primary key fields

  4. Click Copy sqlserver on the left side -> local publishing, you will be prompted to configure the Distributor, here in the D drive to build a file folder named ReplData, will address written address to this folder.

  

  The local publishing process :( conduct the Publisher)

  Click to copy the local releases, the new right-publish, select the database you want to publish, at this time there are four kinds of publishing types to choose from, now choose a transactional publication, select the database table you want to sync, click Next, click on the right adding, can override screening criteria, click Next, select create a snapshot immediately and use the snapshot remains available, in order to initialize the subscription, click Next, the right side of the security settings, enter the appropriate information, has been the next point, until the publication success. Specifically as shown:

  

  

  

  

  

  6. Local subscription process carried out on the subscriber :()

  

                                      

 

  Enter an alias, sa and password to connect to the database will be ready for release to see the name of the database had just released "test_8.15"

  选择一个 订阅数据库与发布数据库同步

  

  

  

  

  这时你就可以看到订阅服务器的 你选择的数据库中已经有你发布服务器的那个数据库和表及其表中数据了,到此,同步完成。

  我认为需要注意的问题有:

  本文中的两台机器必定是可以使用sqlserver客户端互联(在sqlserver studio中设置'允许远程链接',同时要设置相应的ip地址,以及在配置管理器中开启tcp/ip协议即可)。

  这就是我本次两台数据库同步的基本操作,请大家参考。

Guess you like

Origin www.cnblogs.com/SyncNavigator8-4-1/p/10974168.html