Sql server SSI同步不同服务器上的两个表
我是SSIS的初学者。如果您有任何指导,请具体说明。非常感谢。 我正在尝试同步两台不同服务器上的两个表 服务器A上的表A(60k数据)和服务器B上的表B(60k数据)。 主要有三点:Sql server SSI同步不同服务器上的两个表,sql-server,ssis,Sql Server,Ssis,我是SSIS的初学者。如果您有任何指导,请具体说明。非常感谢。 我正在尝试同步两台不同服务器上的两个表 服务器A上的表A(60k数据)和服务器B上的表B(60k数据)。 主要有三点: 在表A而不是表B中添加新记录 更新表A和表B都有的记录并更新它们 删除不在表A中但在表B中的记录 两个表中都没有主键。但将两列放在一起通常有助于查找某些记录(每个表都有重复项,但并不多) 我试着用这家伙的方法来解决这个问题,但失败了。我在两个有几行数据的示例表上尝试了这种方法,成功了 在实表上,我将列A和B设置为
希望得到帮助!再次感谢您,祝您节日快乐 尝试以下步骤:
COPY table from ServerA to a working table on ServerB
Handle Duplicates by theoretical index
Are these 'duplicates' differentiatable by adding additional fields?
If so, add those fields to the indexing.
If not, assume that all of these rows on ServerB will end up looking like one row from ServerA
DELETE rows from B that do not match rows from A
UPDATE rows in B where the keys match in A but data differs (it is worthwhile to compare the data and only update if the data is actually different).
INSERT the new rows from A
DROP or TRUNCATE the working table.
请尝试以下步骤:
COPY table from ServerA to a working table on ServerB
Handle Duplicates by theoretical index
Are these 'duplicates' differentiatable by adding additional fields?
If so, add those fields to the indexing.
If not, assume that all of these rows on ServerB will end up looking like one row from ServerA
DELETE rows from B that do not match rows from A
UPDATE rows in B where the keys match in A but data differs (it is worthwhile to compare the data and only update if the data is actually different).
INSERT the new rows from A
DROP or TRUNCATE the working table.
如果源和目标没有作为实际公共唯一标识符的任何字段组合,则通常会出现重大问题。另外,在服务器之间工作时,我经常发现显式地将一个表复制到另一台服务器上的临时表将大大加快速度。这不是SQL问题,而是后勤问题。您必须有一种唯一的方法来标识行,这正是唯一ID列的本质。即使是列的组合,如果没有唯一的索引,性能也会很差。看来我的问题出在合并连接部分。在不知道原因的情况下,通过的数据是不正确的。如果源和目标没有用作实际公共唯一标识符的任何字段组合,则通常会出现重大问题。另外,在服务器之间工作时,我经常发现显式地将一个表复制到另一台服务器上的临时表将大大加快速度。这不是SQL问题,而是后勤问题。您必须有一种唯一的方法来标识行,这正是唯一ID列的本质。即使是列的组合,如果没有唯一的索引,性能也会很差。看来我的问题出在合并连接部分。在不知道原因的情况下,数据是不正确的。删除/更新/插入操作顺序实际上很重要,因为这将最小化必须执行的索引查找的数量。删除/更新/插入操作顺序实际上很重要,因为这将最小化必须执行的索引查找的数量。