简体   繁体   English

SQL Server数据传输

[英]SQL Server data transfer

In SQL Server, I have a data source server which has 22 databases and in each database there are 5 tables. 在SQL Server中,我有一个数据源服务器,该服务器具有22个数据库,每个数据库中有5个表。 Every db has the same table includes different data separated through years. 每个数据库都有相同的表,其中包含不同的数据,这些数据以年份分隔。

I want to collect all this data into one single database. 我想将所有这些数据收集到一个数据库中。 Destination database will have only 5 tables, while source has 22 x 5 = 110 tables. 目标数据库只有5个表,而源数据库只有22 x 5 = 110个表。 I'm using import-export wizard to transfer data but it takes too long and really annoying stuff. 我正在使用导入导出向导来传输数据,但是它花费的时间太长,而且确实令人讨厌。 For 110 tables I'm going to have to start import-export wizard. 对于110个表,我将必须启动导入导出向导。

Is there a simple way, tool to do this? 有没有简单的方法可以做到这一点? There is no linked server between servers. 服务器之间没有链接服务器。

Here is a simple figure that explains my situation. 这是一个简单的图,解释了我的情况。

说明

Posting my comment as an answer: 发表我的评论作为答案:

Back up each database, restore it to server 2 and then insert the records across using a simple INSERT .. SELECT statement, then drop the restored database and restore the next? 备份每个数据库,将其还原到服务器2,然后使用简单的INSERT .. SELECT语句插入记录,然后删除还原的数据库并还原下一个数据库? You should be able to script this to work unattended, even the creation of all the backups could be scripted to only need a single 'run' which will run for all databases 您应该能够编写脚本以使其在无人值守的情况下工作,即使所有备份的创建都可以编写脚本以仅需要一个“运行”即可针对所有数据库运行

Your other option (if space permits) is to create a new database on server 1 (potentially a restore of the database on server 2 if it has data already in it), then import all records across into this new database, then backup this database and restore it on server 2. 您的另一个选择(如果空间允许)是在服务器1上创建一个新数据库(如果已经有数据在服务器2上恢复数据库),然后将所有记录导入到该新数据库中,然后备份该数据库。并将其还原到服务器2上。

It depends on several thing like how often do you want the data to be moved, will it be changed on the destinations DB's? 这取决于几件事,例如您希望多久移动一次数据,是否会在目标数据库上更改它?

There are 4 methods of High Availability on SQL Server. SQL Server上有4种高可用性方法。 One of them will surely fits to your scenario (probably a merge replication) 其中之一肯定适合您的方案(可能是合并复制)

http://msdn.microsoft.com/en-us/library/ms190202.aspx http://msdn.microsoft.com/en-us/library/ms190202.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM