Latest recommendations for Import\Export of SQl Server bacpac files [duplicate]
Asked Answered
B

2

6

I'm trying to get up and running with Windows Azure but finding the database side extremely frustrating. I need to export my local database to a bacpac file from SQL 2008 and then import into Azure. I would also like to be able to export from Azure and then import to my local database for debugging.

I have found a few tutorials online for achieving this but every time I get part way through one of them I eventually hit a section that requires a step where the information or download is marked as outdated! it seems to have changed quite a bit over time and I can't find an up to date resource

Can anyone provide an updated link on how to do this?

Thanks

Beating answered 15/11, 2012 at 10:17 Comment(0)
G
13

I had the same issues, all documentation on importing/exporting .bacpac mostly reference SQL 2012. I needed to export a sql 2008 R2 express database to azure as well as to be able to export from azure to my local devlopment environment.

I found the SQL Database Migration Wizard v3.9.9 & v4.0.12 to do the trick.

Download Link: http://sqlazuremw.codeplex.com/releases/view/32334

Also download the documentation and it will go through the migration of .bacpac to and from the azure and your local server. What is great about the tool is it will perform a compatibility check on the database to ensure it is ready to deploy to azure.

There is also another command line tool I investigated sqlpackage.exe that can be downloaded as part of Microsoft SQL Server Data Tools

Download Link: http://msdn.microsoft.com/en-us/data/hh297027

Below is an example of exporting a .bacpac file:

sqlpackage.exe /a:Export /ssn:SERVERNAME\sqlexpress /sdn:SOURCEDATABASENAME /su:DATABASEUSER /sp:DATABASEPASSWORD /tf:c:\SOURCEDATABASENAME.bacpac
Git answered 27/11, 2012 at 3:51 Comment(1)
Thanks! SqlPackage.exe help page was also useful: msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspxSyncrisis
C
7

I needed to export a SQL Azure database and then import it into a local SQL 2008 R2 server (Note I am also using Visual Studio 2010). Microsoft certainly went out of their way to make this a painful task, however, I was able to do it by doing the following:

  1. Goto think link http://msdn.microsoft.com/en-us/jj650014 and install the SQL Server Data Tools for Visual Studio 2010

  2. This will install on your local drive. In my case here is where it put it: C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin

  3. Browse to this via the command line or powershell

  4. You are going to want to execute the SqlPackage.exe

  5. Open up this link to see a list of all the parameter options for SqlPackage.exe (http://msdn.microsoft.com/en-us/library/hh550080(v=vs.103).aspx)

  6. Here is my command line that I needed to execute to import a .bacpac file into my local SQL 2008 R2 server:

    .\SqlPackage.exe /a:Import /sf:C:\mydatabasefile.bacpac /tdn:NorthWind /tsn:BINGBONG

/tdn is the name of the database you want your bacpac file to restore to. /tsn is the name of your SQL server.

You can see all these parameter descriptions on the link from #5.

Clough answered 14/3, 2013 at 21:6 Comment(2)
If you can post exactly the same answer to two questions then it's a sign that the questions are duplicates. Rather than post a second answer you should flag (or vote) to close as a duplicate.Hindustan
ChrisF This is not a duplicate as the answer you referenced talks about SQL 2012. This question is regarding SQL 2008.Git

© 2022 - 2024 — McMap. All rights reserved.