Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to restore a backup of SQL Server 2014 on SQL Server 2012?

I know that you can't (at least not easily) restore a SQL Server 2012 backup on SQL Server 2008. But how does it work for SQL Server 2014 to SQL Server 2012 ?

On database level there is the property to adjust the compatibility mode to any other SQL Server version.

How does this helps or work ? Will it only disallow the features from 2014?

To be honest I already tried to restore a backup, but 2012 didn't recognize the datafile, so I couldn't click ok Button to start the restore procedure.

Did I miss some important option ?

like image 240
RayofCommand Avatar asked Jul 30 '14 17:07

RayofCommand


People also ask

Can we restore SQL Server 2014 backup to 2012?

You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility.

Can we restore SQL Server 2016 backup to 2012?

If you do a backup on SQL Server 2016/2014, you cannot restore it on SQL Server 2012 even if the database you backup has a compatibility level of 2012.

Can we restore SQL Server 2017 backup to 2012?

Yes, SQL Server is backward compatible. You can restore a database from any previous version of SQL Server that was supported at the time of the release.

Can we restore SQL Server 2014 backup to 2008?

No, it is not possible. Stack Overflow wants me to answer with a longer answer, so I will say no again. Backups that are created by more recent version of SQL Server cannot be restored in earlier versions of SQL Server.


1 Answers

You CANNOT do this - you cannot attach/detach or backup/restore a database from a newer version of SQL Server down to an older version - the internal file structures are just too different to support backwards compatibility. This is still true in SQL Server 2014 - you cannot restore a 2014 backup on anything other than another 2014 box (or something newer).

You can either get around this problem by

  • using the same version of SQL Server on all your machines - then you can easily backup/restore databases between instances

  • otherwise you can create the database scripts for both structure (tables, view, stored procedures etc.) and for contents (the actual data contained in the tables) either in SQL Server Management Studio (Tasks > Generate Scripts) or using a third-party tool

  • or you can use a third-party tool like Red-Gate's SQL Compare and SQL Data Compare to do "diffing" between your source and target, generate update scripts from those differences, and then execute those scripts on the target platform; this works across different SQL Server versions.

The compatibility mode setting just controls what T-SQL features are available to you - which can help to prevent accidentally using new features not available in other servers. But it does NOT change the internal file format for the .mdf files - this is NOT a solution for that particular problem - there is no solution for restoring a backup from a newer version of SQL Server on an older instance.

like image 108
marc_s Avatar answered Sep 20 '22 23:09

marc_s