6

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.

6 Answers 6

4

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.

1
  • Alright, that's sort of what I thought, I have had some success with a text editor, thanks.
    – Kyle
    Aug 5, 2009 at 5:40
4

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.

1

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

1

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.

1

I recently found out that you can now easily restore MSSQL bak files using Azure Data Studio (previously known as SQL Operations Studio) when you enable preview features.

You can install it using a docker container or by using Homebrew: brew install --cask azure-data-studio

You can find detailed instructions here.

0

No you can't. There's no software for the Mac that can read the file. You'd have to restore the database to a SQL Server of the same version of higher to get anything useful out of it.

You could read it in a text editor, as the bulk of the data is in plain text, but you won't get much out of it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.