How to import a SQL Server .bak file into MySQL?(如何将 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 SQL Server .bak 文件导入 MySQL?
基础教程推荐
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- 在多列上分布任意行 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
