The company has a very important SQL database, how to achieve real-time database synchronization?

First, customer demand

Customers now have a demand, the company has a very important SQL database, Payouyitian server or system crash, leading to all SQL database data loss, the customer wants to database data, the number of libraries in some way by real-time synchronization to another server on, so you can make a backup.

Then how the customer needs to achieve it?

Second, the solution:

Through the analysis and research, using a built-in SQL publish and subscribe capabilities, the old version of SQL Server 2008, to install a new version of SQL Server 2014, released by the old SQL Serer, and then through the SQL Server2014 subscribe to synchronize database data.

Third, the implementation process

3.1 released

Before release preparation: first between the two servers to be able to communicate with each other, which is able to ping command can pass. Usually when we connect to the database, it is often used ip landing, but when released can not do this, we must use the server name.

If you can add the corresponding IP address and host name of the hosts file on both servers in different segments of two database servers.

On the old server, open the SQL Server database software, SQL database publishing.

1, on the old server, find the copy - a local publication, right-click on the new release.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

2. Select the name of the database needs to be published.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

3, choose a transactional publication.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

4, in this database to view the table, whether can normally be released, as shown below, some of the tables can not be released properly, then how to do?

The company has a very important SQL database, how to achieve real-time database synchronization?

 

5, since these tables are found to not have a primary key, which need to set the primary key three table.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

6, set the primary key.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

8, I found that there is a table can not be published.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

9 to see why.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

10, you need a table, save this requirement to prevent re-create the table to change the entry to remove the check.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

11, after removal, may be found in the table set the primary key normal.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

12, you can see all the tables are normally released.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

13, the next step.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

14, select Add.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

15, select Create a snapshot immediately and snapshot remains available to initialize subscriptions.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

16, select Security Settings.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

17, entered into the database sa user name and password.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

18, select Next. Then pay attention, we need to open the proxy service database, and SQL browser service is turned on.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

19, create a publication.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

20, a new name.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

21, publishing success.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

22, released at the same time, we must ensure that the following SQL This directory can read and write.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

3.2, subscribe

1, to the new server, locate the SQL Server Agent server, turn it on, automatically.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

2, find the SQL Browser service will be open.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

3. Ping the host name of the server release.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

4, find the copy - local subscription.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

5, select Next.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

6, select Find SQL Server Publisher.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

7, select the name of the publisher, or input manually publish the server name, user name sa entered Publisher, the Publisher database sa password.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

8, you can query the database names we have just released.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

9, select Run all agents at the Publisher PRD-SQL.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

10, choose New Database.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

11, create a new database, to synchronize the Publisher database.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

12, the new database is complete, click Next.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

13, connected to the subscriber's choice.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

14, enter the subscriber database sa user name and password.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

15, select Next.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

16, select continuous operation.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

17, select the initialization time immediately.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

18, choose to create a subscription.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

19, select Done.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

20, subscribe to create success.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

3.3 Test Results

1, see the synchronization status on the publisher.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

2, you can see the database tables being synchronized.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

The company has a very important SQL database, how to achieve real-time database synchronization?

 

3. After synchronization is complete, you can view the database data and how many subscribers comparison, if the same description successful.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

4, at the subscriber, you can view all the tables are synchronized over. And total data entry and publisher data, the real-time data backup success.

When, publisher of this database are subject to change, subscriber database will change in real time.

The company has a very important SQL database, how to achieve real-time database synchronization?

 

Guess you like

Origin www.cnblogs.com/twelvezuo/p/11671196.html