getting error while taking azure sql backup - azure-sql-database

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.

Related

Unable to publish DACPAC to Azure SQL Database using sqlpackage.exe

When trying to apply a DACPAC to an Azure SQL Database I'm getting the following from sqlpackage.exe:
*** An error occurred during deployment plan generation. Deployment cannot continue.
The Element or Annotation class SqlDatabaseOptions does not contain the Property class CatalogCollation.
I've managed to use VS2017 with SSDT to create a package and then deploy it to another database using the SQL Server Object Explorer but it fails when I use sqlpackage.exe found in
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130
The Azure SQL Database Compatibility Level is set to 140 so I'm not sure if SSDT (v 15.6.0) is using a more modern version of sqlpacakage.exe, or where I would find it? I've also tried to run it from the Azure SQL Database Deployment VSTS task and get the same result.
I've tried mapping the command line switches found in this window but again, I still get the same error.
Is there a version of sqlpackage.exe that SSDT is using that I can't find, or is it a parameter that I'm missing?
For reference this is the command that I'm using:
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130>sqlpackage.exe /SourceFile:"generated.dacpac" /Action:Publish /TargetServerName:"xxxxxxx.database.windows.net" /TargetDatabaseName:"xxxxxxx" /TargetUser:"xxxxxx" /TargetPassword:"xxxxxxx" /TargetTimeout:120
It seems you may need to update Microsoft SQL Server Data-Tier Application Framework on your computer. Please download the latest version here. After installation, you will find it on the following path C:\Program Files (x86)\Microsoft SQL Server\130\DAC\bin\SqlPackage.exe” and updates independently of SSDT / SSMS.
SSMS has its own version of SqlPackage. SSDT has its own version also, which you may find at C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\130.
Azure SQL is a PaaS Service which means it receives update transparently and relatively often with a new compatibility level.
Azure SQL is now 150.
When you create a new database it will be configured using the latest version.
However, your machine, your deployment agents might not have the latest tooling deployed.
When the tooling does not match the compatibility level of your database, the deployment will fail.
If you are deploying using VSTS Hosted Agent you are not in control, and it will always lag a little behind. In that case, the easiest fix is to reduce your database Compatibility level.
This is quite easy as you just need to run an SQL Statement on the database as follow:
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 130;

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.

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/)

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

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.

Issue while restoring a Database Backup file

I get the below mentioned while restoring a database back-up file to my system. Actually the back-up has been taken in other system and I'm trying to restore that file to my systems' sql server. Could anybody assist me in explaining what the error is and how to rectify? Please...
Error:
"System.Data.SqlClient.SqlError: The database was backed up on a server running version 10.50.1600. That version is incompatible with this server, which is running version 10.00.2531. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)"
Thank You.
You SQL Server where you want to restore the database is older then the origin.
So to restore this database, you have to use a newer version.
Go to downloads.microsoft.com and get the SQL Express version of the latest, install it on any machine and restore. You can even install on the same machine.
If you cant udpate your SQL Server, you can connect both DB's then and use DTS to move the data back to your "old sql system".