Database import : MS Azure to local SQL server

Working with Microsoft Azure, I came across a problem of restoring the azure database to sql server several times, and it took me long to find the solution. After some research, i found the way out that was simple. Before describing the issue i would like to mention that azure generates the backup files with .bacpac extension instead of .bak. While restoring the azure database following error occurred

Couldn’t load schema model from package

This is more than likely due to the version of the Client tools you are using.  If I created a new database, the default version will be the v12 release. Or I might have upgraded my azure database to the v12. Here are a few prerequisites to understand the scenario.

1)      SQL Server Management studio must be the latest version released with SQL Server 2014 for compatibility of Azure Database v12. Mentioning earlier versions of Azure database are compatible with SQL Server Management Studio 12. SQL server need not to be 2014 only the client is the problem.

2)      A common problem with restoring MSSQL Server .bak files is you cannot restore them to earlier versions of MS SQL Server (e.g. 2008 R2 to 2008, or 2008 to 2005). Ability of restoring .bacpac file needs minimum version of 2012 of MSSQL Server.

3)      You must have storage account name and key where the bacpac file resides on server. Or you can download the bacpac file to the local disk and use that.

Here are the steps to restore database from Microsoft Azure.

1)      Right click on database and click on Import-Data-tier-Application in the options.

2)      Click next, then click on second radio button Import from Windows Azure. Then click on connect button

3)      Enter your storage account name and account key. Now click on connect button.

4)      Choose the manual backup from container (dropdown), choose the database that you want to restore it and click next.

 

 

  After completing the steps, .bacpac file will be successfully imported into your local sql server.

 

Note:

If you find this error while importing your .bacpac file.

“Count not load schema model from package. (Microsoft.SqlServer.Dac)

Additional Information: 
Internal Error. The database platform service with type Microsoft.Data.Tools.Schema.Sql.SqlAzureV12DatabaseSchemaProvider is not valid. You must make sure the service is loaded, or you must provide the full type name of a valid database platform service. (Microsoft.Data.Tools.Schema.Sql)

Then go to below link and install both the x64 and x86 versions.

Microsoft SQL Server Data-Tier Application Framework (February 2015) 

comments powered by Disqus