Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 835
user1194439 Avatar asked Nov 15 '12 10:11

user1194439


People also ask

How do I export a managed SQL database to BACPAC?

To export a managed instance into a BACPAC file, use SQL Server Management Studio or SQLPackage. Use the New-AzSqlDatabaseExport cmdlet to submit an export database request to the Azure SQL Database service. Depending on the size of your database, the export operation may take some time to complete.

Why can't sqlpackage import a BACPAC with a filegroup other than primary?

Since Azure SQL Database does not support any database filegroups other than PRIMARY, all references to such filegroups present in the bacpac will be automatically replaced with references to the PRIMARY filegroup when SqlPackage imports a bacpac.

How do I export a database in sqlpackage?

Under Data management, select Import/Export history. To export a database in SQL Database using the SqlPackage command-line utility, see Export parameters and properties.

How do I import a BACPAC file in azure?

For larger bacpac files, a workaround would be to use an Azure VM to import the bacpac. We should note that the data in the bacpac file is compressed, therefore the actual source database size may be larger than some of these limits.


1 Answers

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
like image 124
maguy Avatar answered Oct 16 '22 15:10

maguy