如何创建彼此不同服务器之间连接的两个数据库

时间:2017-07-06 16:00:53

标签: sql database sql-server-2012 replication

编辑:示例如果一台服务器关闭,另一台服务器具有相同的数据,我将可以使用它。

我想要实现的目标:

服务器1 - > DBExample

INSERT INTO DBExample (idExample, nameExample) VALUES (123, 'Example');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+

服务器2 - > DBExample2

SELECT * FROM DBExample2;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
+-----------+-------------+

反之亦然:

服务器2 - > DBExample2

INSERT INTO DBExample2 (idExample, nameExample) VALUES (1234, 'Example2');

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+

服务器1 - > DBExample

SELECT * FROM DBExample;
+-----------+-------------+
| idExample | nameExample |
+-----------+-------------+
|       123 | Example     |
|      1234 | Example2    |
+-----------+-------------+

1 个答案:

答案 0 :(得分:0)