Monday, 6 May 2013

How to restore BACPAC onto MS SQL 2008 R2

I have been struggling with restoring databases from Azure onto my local machine. At first I thought it is because my SQL Management Studio is outdated, but even after updating to 2012 I was getting
The internal target platform type SqlAzureDatabaseSchemaProvider does not support schema file version ’2.5′.

Solution: 1. Quick Google research showed an update on SQL Server Data Tools 2012 update 2. You can use a tool inside
C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin
called SQLPackage.exe 3. Example:
.\SqlPackage.exe /a:Import /sf:D:\backups\testdatabase.bacpac /tdn:MyDatabaseName /tsn:MyDatabaseInstanceName

Alternatively, you can try to use Import/Export inside SQL Server Management Studio 2012 - however I had more problems with it than SQLPackage tool.