Why can't I restore a SQL Backup on a newer Version? Error 3169 - backup

I am trying to restore a backup from an Azure Managed Instance to an SQL Server running on an Azure VM.
When running the Backup Script, I get this error Message:
Meldung 3169, Ebene 16, Status 1, Zeile 2
The database was backed up on a server running version 15.00.2000. That version is incompatible with this server, which is running version 15.00.4073.
Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.
Firstly, when running the Script
SELECT ##VERSION
the managed instance seems to run on version 12.0.2000.8 and
secondly, the new SQL Server is running a newer version than the source DB from the error print, which means it shouldn't be a problem, right?
What am I missing?
Thanks in advance
Justus

The output from ##VERSION from the Managed Instance is misleading.
Because a Managed Instance is an evergreen deployment (it is ALWAYS the latest version) this means that it is always a newer version than any version of SQL Server you will get on a VM.
You will need to consider other methods such as BACPACs or replication to get your DB copy on the VM

I agree with Martin. The versioning of Azure SQL DB and Azure SQL MI are known as V12 as compared to on-prem versions. You can backup DB from SQL Server -> Azure SQL MI but it is not backward compatible.
You will need to BACPAC or replication as an option.
On the positive note, there is a lot of request for backward compatibility and I am hearing that it might be coming in preview later this year but not 100% sure.

Related

SSDT failing to publish: "Unable to connect to master or target server"

I'm attempting to use SSDT to publish to a SQL Server database in Azure. When I do so, I am seeing the following error:
Unable to connect to master or target server 'DATABASE_NAME'. You must have a user with the same password in master or target server 'DATABASE_NAME'.
Ignoring the fact that it's listing a database name as the server name in the error, I'm not sure how to resolve it. When I specify the target database, I can successfully Test Connection. I can also connect using the same creds to the database through SSMS.
After researching the error, it seems like it is often that the firewall for the database in Azure does not include the IP address of the machine you're publishing from. It not only contains my IP, but I added another firewall rule to allow every IP (0.0.0.0-255.255.255.255) to eliminate the firewall as a potential cause of the problem.
Any ideas?
This is a known issue. This happens due to the new compatibility level 140 for newly created SQL Azure databases. The issue has been documented here and updating SSDT from here to the latest version may solve the issue.
Alternatively, you can change the compatibility level of your database to 130.
ALTER DATABASE database_name
SET COMPATIBILITY_LEVEL = 130;
Hope this helps.
Initializing deployment (Start)
Initializing deployment (Failed)
*** Could not deploy package.
Unable to connect to master or target server 'DbName'. You must have a user with the same password in master or target server 'DbName'.
Issue occurred while deploying build through VisualStudio-2015 and it support to publish database on the database servers whose version up to only 2016.
Solution: For SQL server 2017 we need to Publish Database with Visual Studia 2017 only. Need to upgrade SSDT.
Faced same issue when trying to deploy a DB from local SQL Server to Azure SQL DB via SSMS.
Tried to alter source DB's compatibility level to 130, still got same error.
Tried to add same user logins to master DB, no help.
Eventually, started looking for other approaches. Succeeded by using Data Migration Assistant, as instructed in https://learn.microsoft.com/en-us/azure/sql-database/sql-database-cloud-migrate.
My situation was slightly different in that I had exported an Azure database (with compat level 140) from SQL Azure and then tried to import it into a local SQL Server 2017 installation - using the latest SSMS 2017 that I just installed yesterday - and still got this message.
Turned out that although I did have latest SSMS installed, I was actually opening SSMS 2016 by mistake! So be sure to select and pin the correct version to avoid it happening again. Just typing 'SSMS' into the Windows Start menu may not show both.
So if you use SSMS to import you only need the latest version, and no separate tools.
Footnote: Even after opening the correct SSMS version I got another error - something about contained databases.
An Azure database is a 'contained' database (or at least mine was) - meaning that its user logins are embedded in the database. This isn't enabled by default apparently in standard SQL Server 2017.
After running this in the local SQL in master I was able to import it successfully.
sp_configure 'contained database authentication', 1;
GO
RECONFIGURE;
GO
When this happened to me it was due to the version of tools I was using. I thought it strange that the most recent SqlPackage.exe I found in C:\Program Files (x86)\Microsoft SQL Server didn't work and publishing from visual studio did, so I found the most recent
under the visual studio directories:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\Extensions\Microsoft\SQLDB\DAC\150\SqlPackage.exe
* to publish to a SQL Server database in Azure*, you can use "Data Migration Assistant" (DMA).
I just tried it and it works smoothly without any issues (firewall and compatibility level)
please refer to this link SQL Server database migration to Azure SQL Database
for step by step: 10. How to migrate the SQL database to Azure with the Azure Database Migration Service
I got the same error while trying to update a local SQL Server database from Visual Studio database project (i.e. not i Azure). Turns out the problem was I was running SSDT for Visual Studio 2017 while using Visual Studio 2015. Visual Studio discovered an updated version of SSDT (just happened to see it in notifications!), pointing to the right Visual Studio version. Now it works!
My setup: BizTalk Server 2016 forces me to use Visual Studio 2015. My local database is on SQL Server 2017. Using SSDT for Visual Studio 2015 works for updating databases in SQL Server 2017. Just so you know. ;)
Most of the sources recommend to set COMPATIBILITY_LEVEL = 130; and, usually, it solves the issue. Unfortunately, this did not help me.
In my case, I had to downgrade SQL Server 2017 on my machine to SQL Server 2016 Developer Edition.
I ended up having to install DacFramework.msi on the SQL server that my azure runner agent was installed to get past this error. My server is a VM running in our network. not running in azure...
the description on the msi says:
'This installer database contains the logic and data required to install Microsoft SQL Server Data-Tier Application Framework (x64).'
Try to connect to the SQL Azure database using Sql Server Management Studio and the ip getting listed in the management studio is the right ip address. Try to add to the SQL Azure firewall rules. The ip address listed in the firewall page of Sql Azure portal is not accurate.

Deploy SQL Database to MS Azure Storage - Error: 40804 [duplicate]

I'm trying to move my databases to a newer Azure subscription. I used to simply click "Deploy to Azure" on a local database from SSMS and have it deployed to a specified Azure server. Importing/Exporting a BACPAC file also works. However, I can't seem to do any of this on the new server. I keep getting the error:
"The service objective 'Web' specified is invalid."
Googling around, I found this thread explaining the need to update the CREATE DATABASE template to accommodate Azure Databases (Azure upgrade, I'm guessing). However, the hotfix provided is specifically for SQL Server 2014 and I'm using SQL Server 2012. I checked other cumulative updates for 2012 here but found no fix for the issue.
Is there any other way I can fix this without having to upgrade to 2014?
Just to summarize my software versions:
SQL Server 2012
SQL Management Studio 11.0.2100.60
Local database: SQL Server 10.50.16000
Old Azure server: SQL Server 11.0.9230
New Azure server: SQL Server 13.0.15
You are getting this error because the latest V12 servers are not supporting the Web and Business Editions anymore. If you don't want to upgrade to SSMS 2014, you can create a V11 server and import your DB on this server. However this is only a temporary solution as Web and Business edition databases will be retired in September. At this point you will have to work with the latest tools to avoid this problem.
There is a Hotfix for it you can download and install on your machine. Please navigate to:
https://support.microsoft.com/en-gb/kb/2936603
You need to enter your email then download link will be sent to your email address. Then install it on your machine and you can see the following options:
Install the database as a Data Project into Visual Studio,
Set the target framework in the properties window to SQL Azure,
Build the project and resolve any unsupported issues.
Publish to your azure site.
I have tried the above and did not work for me - this solution worked!

Which edition of sql server 2008,10,12,14 support replication and publication, as i need sync of data

Please help me regarding sync of data between two sql servers automatically using replication and publication.
Please help me which edition provide these features and how to configure these services to automatically sync data between local sql server and remote sql server.
Thanks
Replication has been part of SQL Server at least since the version 2005.
It's not a question of version number, but of type of edition (express, standard...)
If you need replication, you will need at least a standard version on the publisher server. Any version will work on the subscriber.
Note that if you just want to get a backup (for development purposes or a preprod server), you're probably better off writing a small script (in Powershell for instance) that generates a backup of the source server and downloads/uploads it to the target server every night or so.

Restoring database through SQL Management studio

I have a .bak file that I am restoring but SSMS gives an error that is
"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.1600. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server. (Microsoft.SqlServer.Smo)"
I have updated SSMS, now its version is 10.50.4000. But the problem is still the same.
You may not restore a backup of a higher version of SQL to a lower version of SQL.
Have a look at sql server builds.
10.50.1600 is SQL Server 2008 R2 while 10.00.1600 is SQL Server 2008.
Updating SSMS is not going to work, as it is only a Client Tool, and not the Server itself.
You need to upgrade the Server engine in order for the upgrade to work.
To see this is true, you may open your newly upgraded SSMS and login to the server where you want to restore your backup. In the tree you will see the Server's version in a parenthesis next to the Server's name. You will notice that though you upgrader SSMS, the Server's version remains the same.

SQL backup version is incompatible with this server

I get he following message when i try to restore a database backup to the customers SQL Server 2008.
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.4064.
I hade a made a backup of the database and restored in on a server which had version 10.50.1600, then once i finished my dev work i backed it up but now it wont restore on the customers server 10.00.4064.
What are my options now? Is there a way to restore this? can i do a data import or export to the customers server?
Basicly you need to do it by hand and a restore would not work. So you would need to do something of the following:
Option1: Script the entire database (tables,views,indexes,procedures,functions,Data,...) with the development verison of the SQL Management studio it works you can also do that with some other tools like Aqua data studio and such. And then just run the sql script on the client server and the whole thing will just get recreated there
Option2: setup a sql2008r2 on the client server the dev edition that is free anyway and then just use the Export GUI to transfer it over to the actual server
I would prefer Option1 since it is in my opinion a bit "cleaner"