如何将 SQL Server .bak 文件导入 MySQL? [英] How to import a SQL Server .bak file into MySQL?

查看:164
本文介绍了如何将 SQL Server .bak 文件导入 MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是不言自明的.有没有办法直接进行这种导入?

The title is self explanatory. Is there a way of directly doing such kind of importing?

推荐答案

来自 SQL 服务器的 .BAK 文件采用 Microsoft 磁带格式 (MTF) ref: http://www.fpns.net/willy/msbackup.htm

The .BAK files from SQL server are in Microsoft Tape Format (MTF) ref: http://www.fpns.net/willy/msbackup.htm

bak 文件可能包含 SQL Server 用于存储数据库的 LDF 和 MDF 文件.

The bak file will probably contain the LDF and MDF files that SQL server uses to store the database.

您将需要使用 SQL 服务器来提取这些.SQL Server Express 是免费的,可以完成这项工作.

You will need to use SQL server to extract these. SQL Server Express is free and will do the job.

所以,安装 SQL Server Express 版本,然后打开 SQL Server Powershell.执行 sqlcmd -S <COMPUTERNAME>SQLExpress(以管理员身份登录)

So, install SQL Server Express edition, and open the SQL Server Powershell. There execute sqlcmd -S <COMPUTERNAME>SQLExpress (whilst logged in as administrator)

然后发出以下命令.

restore filelistonly from disk='c:	empmydbName-2009-09-29-v10.bak';
GO

这将列出备份的内容——你需要的是第一个告诉你逻辑名称的字段——一个是实际的数据库,另一个是日志文件.

This will list the contents of the backup - what you need is the first fields that tell you the logical names - one will be the actual database and the other the log file.

RESTORE DATABASE mydbName FROM disk='c:	empmydbName-2009-09-29-v10.bak'
WITH 
   MOVE 'mydbName' TO 'c:	empmydbName_data.mdf', 
   MOVE 'mydbName_log' TO 'c:	empmydbName_data.ldf';
GO

此时您已提取数据库 - 然后安装 微软的"Sql Web Data Administrator".连同这个导出工具,您将拥有一个包含数据库的 SQL 脚本.

At this point you have extracted the database - then install Microsoft's "Sql Web Data Administrator". together with this export tool and you will have an SQL script that contains the database.

这篇关于如何将 SQL Server .bak 文件导入 MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆