Read SQL Server Backup File on Mac OS X
I have a .bak file from an SQL Server database on an old hosting account, is there any way to view this file with an application on Mac OS X? All I need to do is get the data out of it.
Thanks,
Kyle
EDIT: I see that you can't read the file on Mac OS, however is there a relatively easy way to split the .bak file into it's component .mdf and .ldf files? A Mac solution is preferable but anything that doesn't require SQL Server to be installed is good. Thanks.
Solution 1:
Short answer: No.
There is a similar question on Stackoverflow that is somewhat related.
The .bak file is actually two files in one - a .mdf (data) and an .ldf (logs)
If you are somehow able to load the .bak file back into SQL Server you could then export a format that could be read.
Alternatively you can always try opening it in your favourite text editor (eg. TextMate, TextWrangler, BBEdit, emacs, vim, etc.) and see what information you can pull from the file.
Solution 2:
Easiest thing to do is fire up your copy of parallels/vmware fusion or bootcamp with your favourite version of Windows and install SQL Server Express and do a restore.
As long as your database isn't bigger then 4GB you should be ok. If not, get your hands on SQL Server 2008 Developer.
You may have some success with Redgate Data Compare which can read .bak files. You may be able to trick it into generating SQL statements without SQL Server from the .bak, but you'll still need Windows.
Solution 3:
In fact you can :)
If you extract .mdf file from .bak, you can use MDF Viewer over Wine. Works for me as a charm. MDF Viewer over Wine on macOS Sierra
Solution 4:
The easiest(? or at least most versatile) method as of recent years might be to just spin up a Docker container from any of the official mssql/server
, issue the RESTORE
commands using sqlcmd
, all inside the container and then just connect to 1433 mapped from the container using your MacOS TDS/MSSQL client of choice.