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

This question already has answers here:
Azure SQL Database Bacpac Local Restore
(6 answers)
Closed 9 years ago.
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

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

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:
Goto think link http://msdn.microsoft.com/en-us/jj650014 and install the SQL Server Data Tools for Visual Studio 2010
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
Browse to this via the command line or powershell
You are going to want to execute the SqlPackage.exe
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)
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.

Related

getting error while taking azure sql backup

I'm using below command to take azure sql databse backup, but getting error.
*** Error exporting database:Database source is not a supported version of SQL Server...tcp:xxxxx.database.windows.net,1433
"C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\SqlPackage.exe" /Action:Export /SourceServerName:"tcp:xxxxx.database.windows.net,1433" /SourceDatabaseName:DbName /SourceUser:user /SourcePassword:password /TargetFile:C:\backups\backup.bacpac
What this mean? even export data tier application also throws same error.
Please download the latest version of SQL Server Management Studio (SSMS). It seems you are using an old version of SSMS.
Alternatively, you can install a newer version of DacFx. Please download from here.
You can also use the Export option of Azure portal. To export to a blob storage account on Azure and then download the bacpac from there.

Importing .bacpac fails on 'Importing Database'

I am trying to import a .bacpac file into my SQL Server 2016 Express database, however it's failing on the Importing Database step. Has anyone seen this before? Are there any common causes for it to fail at this step?
Whenever I've run into this problem, it's been because the .bacpac came from a different version of SQL Server than I was running. Last time it was because the backup came from SQL Server 2016 and I was running 2014. Upgraded to 2016 and the backup imported just fine.

SQL Server Import and Export Wizard: Data destination issue

I am trying to get familiar with SQL Server commands and procedures. So I have downloaded from my university's Dreamspark account the Visual Studio 2015 Enterprise Edition.
My idea (call it personal project) was to try and import an excel table with dimensions 34162x465. And then within Visual Studio to try and manipulate it. For that reason I downloaded the SSDT for Visual Studio 2015 in order to use the SQL Server Import and Export Wizard.
I successfully researched and solved the first shortcoming, which was a Microsoft.ACE.OLEDB.12.0 problem.
But then, after I chose the excel file as a source, and when I reached the next step, to pick a destination, I chose SQL Server Native Client 11.0. The problem is that I cannot assign a SQL server because the drop down list is empty.
**I have already set up a local server (C:) and a database in Visual Studio's SQL environment, but I have no idea why the Wizard cannot detect its name.
Apologies if the question sounds ambiguous or I have missed any crucial details. Also, I have searched in various forums and online for similar issues but I couldn't find a solution.

Create SQL Server 2008 Backup from 2008 R2

I've created a Backup of a Database on a server with SQL Server 2008 R2.
I wish to restore this onto a server that is running SQL Server 2008.
I've received the error:
"The database was backed up on a server running version 10.50.4000.
That version is incompatible with this server, which is running
version 10.00.5500."
Is it possible to produce a version 10.00.5500 compatible backup from 10.50.4000.
If not what other options do I have, or other ways to create the database.
I have tried to use the Copy Database task, but also received errors.
This is not possible. At least, you won't be able to use the backup to restore on an older version.
Nenad Zivkovic provided a good link and there are several ways out of this situation listed:
Upgrade the older version of SQL Server to be at the same level as the newer SQL Server.
Script out the objects from the newer database and then usp a bcp process to extract the data from the newer database and import it into the older database.
Use the SQL Server Import and Export Wizard to build an SSIS package to move the data (it will move the data only).
Build a custom SSIS package to do the data move.
Use replication to move the data from the newer database to the older one.
Use some other form of scripting, such as with PowerShell, to keep the databases in sync.
(Source: http://www.mssqltips.com/sqlservertip/2675/why-cant-i-restore-a-database-to-an-older-version-of-sql-server/)

How to use SQL Server 2008 Database project in installation time

I have created SQL Server 2008 Database project using visual studio 2010. after build and deploy this project i saw dbschema file that contain SQL queries that i use to create my database inside the XML tags. And there is another .sql file(This file also contain that sql queries. but there is no XML tags)
In this 2 files i want to know what is the file that i can use to create database in installation time and how to execute that file in installation time.
I found some details from http://msmvps.com/blogs/deborahk/archive/2010/05/02/vs-2010-database-project-an-introduction.aspx
Hope you guys can help me to get some solution.
To deploy the database project you just need to .dbschema file.
If your database is composed of multiple .dbschema then you have to deploy using the manifest.
The tool you need is vsdbcmd.exe in VS 2010. It works with SQL 2008. It does not work in SQL 2012.
Check out the following link on how to do it.
http://msdn.microsoft.com/en-us/library/dd193283.aspx