MySQL 到 SQL Server 的迁移

2022-01-23 00:00:00 database migration mysql sql-server

我有一个 mysql 数据库,其中包含我需要保留但迁移到 SQL Server 2008 的数据.

I have a mysql database full of data which I need to keep but migrate to SQL Server 2008.

我知道数据应该从表到表的端到端去向,但我不知道如何移动数据.我环顾了网络,但似乎有解决方案",您必须下载并运行.如果可能的话,我宁愿自己在编写脚本或代码方面做一些事情.

I know end to end where the data should go, table to table but I have no idea how to go about moving the data. I've looked around the web but it seems there are 'solutions' which you have to download and run. I'd rather if possible do something myself in terms of writing scripts or code.

谁能推荐最好的方法吗?

Can anyone recommend the best way to do this please?

推荐答案

这里有几个选项:

  • 在 sql 服务器端,您可以使用称为 链接服务器.这将允许您为从 mysql 表返回数据的 sql server 编写 sql 代码.您可以使用它来构建 INSERT 或 SELECT INTO 语句.
  • 您可以为mysql编写查询以将数据导出为csv,然后使用sql server的BULK INSERT功能有效地导入csv数据.
  • 您可以使用 Sql Server 集成服务来设置从 mysql 移动数据.
  • On the sql server side, you can set up a connection to your old mysql db using something called a linked server. This will allow you to write sql code for sql server that returns data from the mysql tables. You can use this to build INSERT or SELECT INTO statements.
  • You can write queries for mysql to export your data as csv, and then use the BULK INSERT features of sql server to efficiently import the csv data.
  • You can use Sql Server integration services to set move the data over from mysql.

无论您选择哪个,都必须手动移动索引、外键、触发器、存储过程和安全性等非数据工件.

Regardless of which you choose, non-data artifacts like indexes, foreign keys, triggers, stored procedures, and security will have to be moved manually.

相关文章