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

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

问题描述

标题是不言自明的.是否可以直接进行这种导入?

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

推荐答案

来自SQL Server的.BAK文件采用Microsoft磁带格式(MTF)ref:

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 Server提取它们. 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:\temp\mydbName-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:\temp\mydbName-2009-09-29-v10.bak'
WITH 
   MOVE 'mydbName' TO 'c:\temp\mydbName_data.mdf', 
   MOVE 'mydbName_log' TO 'c:\temp\mydbName_data.ldf';
GO

此时,您已提取数据库-然后安装此导出工具,您将拥有一个包含数据库的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天全站免登陆