You can upgrade from any version 2005+ to any other version

There’s a persistent myth that you cannot upgrade a database to a version more that is more then two versions newer.

It’s not true.

You can backup+restore (safest way) or detach+attach (not a safe way) from SQL Server 2005 (or higher) to any other newer version. You just can’t do an in-place upgrade to the latest version from SQL Server 2005.

I didn’t know this until a few weeks ago, and it’s not common knowledge, hence this short blog post.

Here’s the proof, restoring a SQL Server 2005 database directly to SQL Server 2016, and I tried it successfully on SQL Server 2014 and SQL Server 2012 as well.


Microsoft SQL Server 2016 (RC3) - 13.0.1400.361 (X64) <snip>

(1 row(s) affected)

<snip> DatabaseName   DatabaseVersion DatabaseCreationDate    <snip>
       SalesDB        611             2008-08-06 12:47:41.000 
(1 row(s) affected)
WITH MOVE N'SalesDBData' TO N'C:\SQLskills\SalesDBData.mdf',
MOVE N'SalesDBLog' TO N'C:\SQLskills\SalesDBLog.ldf',
Processed 24480 pages for database 'SalesDB', file 'SalesDBData' on file 1.
Processed 2 pages for database 'SalesDB', file 'SalesDBLog' on file 1.
Converting database 'SalesDB' from version 611 to the current version 852.
Database 'SalesDB' running the upgrade step from version 611 to version 621.
Database 'SalesDB' running the upgrade step from version 621 to version 622.
Database 'SalesDB' running the upgrade step from version 622 to version 625.
Database 'SalesDB' running the upgrade step from version 625 to version 626.
Database 'SalesDB' running the upgrade step from version 626 to version 627.
Database 'SalesDB' running the upgrade step from version 627 to version 628.
Database 'SalesDB' running the upgrade step from version 628 to version 629.


Database 'SalesDB' running the upgrade step from version 845 to version 846.
Database 'SalesDB' running the upgrade step from version 846 to version 847.
Database 'SalesDB' running the upgrade step from version 847 to version 848.
Database 'SalesDB' running the upgrade step from version 848 to version 849.
Database 'SalesDB' running the upgrade step from version 849 to version 850.
Database 'SalesDB' running the upgrade step from version 850 to version 851.
Database 'SalesDB' running the upgrade step from version 851 to version 852.
RESTORE DATABASE successfully processed 24482 pages in 0.142 seconds (1346.892 MB/sec).

Very cool! This is going to make upgrading some of our clients a lot easier.

Also, remember that upgrading is a one-way operation. You absolutely cannot take the database and attach or restore it to an older version of SQL Server.

Some Microsoft links around this:


48 thoughts on “You can upgrade from any version 2005+ to any other version

  1. Using backup restore from 05 > 12 worked for me but I ran into issues for databases that had full text catalogs. My options were to drop them or middleman the upgrade with an 08r2 instance. They would not backup, messages about incorrect metadata. A DMV that escapes me at the moment had a row to the folder FTC would sit in during 2005 time even though it got converted to a NDF during the upgrade. I was able to just drop them for my upgrade and I’m not sure how widespread a thing this is but wanted to note.

  2. Just did a few 05 to 12 on the basis of the “max two releases” theory. I decided against the attach/detach method as it’s just as time consuming for smaller DBs as the restore. I noticed you say attach/detach is not as safe and that confirms my suspicions.

    1. The reason detach/attach is not as safe is that you lose your backout option.
      With backup/restore, if something goes wrong you can simply switch on the old server again, and if that fails you can restore the backup. That’s two backout options.
      With detach/attach, the data file will be modified during the upgrade. If it fails, you cannot attach it to the old version anymore, so you have no backout mechanism. (You could of course make a file system copy of the .mdf and .ldf files before attaching, but then you probably invest more time and effort then with the backup/restore option)

      1. I agree with that, Hugo. But if I’m detaching and copying to a new machine that consideration goes out the window. I still have my original file. In most cases I’m upgrading to a new version of windows anyway. So I have a parallel system for comparison before the final restore/cutover anyway. It’s a good time to find out if there’s any corroption in the DB after the restore to the new machine anyway.

        1. Nope – I still wouldn’t detach because if there’s something wrong with the database that causes the attach to fail, now you’ve got a detached database on both servers that you can’t attach. Always better to backup/restore, or set the database offline, copy, attach, then at least it’s still attached on the source server if something goes wrong with the attach on the new server.

        2. For my personal preference I like the detach/copy/attach/. You have a clean cut off so that nothing sneaks in and you don’t have the worry of someone accidentally attaching to the old db (yes you can take it offline). I would never try to attach my ONLY copy of a database to a newer version. :-) With backup/restore on a large database you’re waiting the hours to backup and then the hours to copy (if you’re not backing up to the destination server) and the hours to restore. With detach/copy/attach you’re just waiting on copy time and bring online time (which sometimes can take a bit of time). Shrinking log files before detaching also helps speed up copy time.

  3. While restore seems to work from very old versions, when they’re talking about “upgrading”, I’m guessing they’re talking about in-place upgrading of a server. I’m guessing I could restore a SQL Server 7 backup on SQL Server 2016 but I doubt it would do an in place upgrade. In fact, both the 2016 doco say they only does upgrades from 2008+, and that upgrades from 2005 are not supported. It spells it out in detail further down this page: Attach/restore, etc. are fine. Upgrading is not.

    1. Yup – I say in the blog post above that you can’t do an in-place upgrade and only attach/detach and backup/restore are supported from 2005 to 2016.

  4. Great post. Firstly thank you for the information, but I was wondering if when you upgrade with backup/restore of one version to a more than two versions newer if it will be supported for Microsoft later in an eventual incident.

  5. A slightly off-topic comment but I noticed the speed of the restore:

    RESTORE DATABASE successfully processed 24482 pages in 0.142 seconds (1346.892 MB/sec).

    What kind of hardware are you using, just out of interest?

  6. and this does not apply to SQL Server 2000:

    Msg 3169, Level 16, State 1, Line 3
    The database was backed up on a server running version 8.00.2039. That version is incompatible with this server, which is running version 13.00.1601. Either restore the database on a server that supports the backup, or use a backup that is compatible with this server.
    Msg 3013, Level 16, State 1, Line 3
    RESTORE DATABASE is terminating abnormally.

  7. For SQL 2000, you must restore it on either 2005, 2008 or 2008R2, create a new backup there and then continue to any other newer version.

  8. Hi Paul,

    Great Post, I did what you mentioned and successfully restore/upgrade SQL 2005 to SQL 2016 using backup restore method. For compatibility mode, I run SQL Statement “ALTER DATABASE [DB1] SET COMPATIBILITY_LEVEL = 130” which successfully applied. However, when I checked DB Properties using GUI (I mean right click on DB and property – option), compatibility=130 has not been shown in property window. Is this normal or Am I missing something? or because it has been restored directly from SQL 2005 to 2016, DB compatibility won’t be shown on property window.

    Please note that after restoring backup of SQL 2005 to SQL 2016, there is no DB compatibility option appear under compatibility drop down box.


    1. Sorry Paul, my bad. I was connecting to SQL 2016 server using SSMS 2012. That’s the reason compatibility was not showing on restored db of 2016. Thanks.

  9. Based off this post (thank you BTW, saved me a test) Is it safe to assume that log-shipping from 2008R2 up to 2016 *should* work?

  10. I love this post Paul, and it was definitely something I was wondering.
    I expect that this doesn’t apply to the system databases tho! (However it’d be interesting to experiment with if I can find my SQL 2005 media)

  11. With backup/restore, you can use a FULL backup earlier with DIFF right before the move. That is, you can get the bulk of the moves done ahead of time.

    At final cutover, one last DIFF (per db of course), is all that you have to copy and restore before the final system start up.

    My company just moved *all* our dbs, many TBs, to a new site and servers. The final moves, including transfer time over the wire, was less than 5 hours, because of careful timing of the last fulls and final diffs.

    Attach / detach takes longer also because you have to run db checks very close to cutover time, to be sure that it’s really safe to detach the db. And you *must* keep 2 copies of the file, because a failed attach for any reason could modify the file being attached and force you to go back to an original copy of the file for another try.

    1. Absolutely. Glad it went well. And I’ve never recommend detach/attach, as there’s no guarantee the file will attach (anywhere) again. Always better to leave the database attached and operational on the old system.

  12. Thank-you sir.

    Here I have query when we can restore from 2005 to 2017 then why can’t we setup log shipping.

  13. Hi Paul,

    Thank you for the post. I have one question though: I have a database on a SQL 2014 SP1 server and I am migrating to a SQL 2016 SP2 server. I do it using backup and restore. However, after I restore it on 2016 and run a DBCC checkdb or DBCC checkalloc, it yields corruption on 2 PFS pages. The output of DBCC looks like this – Database error: Page (1:860785) is marked with the wrong type in PFS page (1:857328). PFS status 0x40 expected 0x60. If I restore the same backup on a 2014 server and do a checkdb, I cannot see any corruption. Nor do the weekly integrity checks on the live database output any corruption. I have restored multiple backups of the same DB on multiple SQL 2016 servers, all with the same result. This issue only occurs on one specific database that is running on Compatibility Level 2008 and is enabled for CDC. The specific pages to which the PFS point to are of a table that is partitioned. I have done multiple tests to try and find the reason for corruption at restore, and so far I have not found anything. Any suggestions? Can it be a bug in the upgrade mechanism at restore?

    Thank you!

      1. Thank you! That would be of great help. So far I have not found any way that doesn’t end up in corruption after the restore. I do have one other question: after the DBCC runs on 2016 and outputs corruption for the two PFS pages, if I run a DBCC repair with allow data loss, it fixes it in two cycles. I have read that allow data loss for PFS corruption is the one exception to the Allow_data_loss option that does not have data loss. Is that always the case?

          1. Do you have perhaps a reference about this issue? I have started a support case with Microsoft and currently there is no resolution to this, as they could not pinpoint the problem so far. If you can help me with more information, it would help a great deal.

            Looking forward to your blog post! Thanks again.

  14. How to upgrade the mdf file of older version of database to new version of database without attaching and i did not have .BAK file, i have only MDF File and LDF file,
    I have sql server 2014 version but mdf file is of lower version, so please let me know how to upgrade it?

  15. Hi thanks for the information as this has become useful, I have a quick question as I am new to server upgrades. We are in need of upgrading however the latest version we have is 2005. We have decided to go to 2016 so as I understand it and upgrade to 2016 is different to backup 2005 and restore 2016. After looking at the compatibility level it has changed from 90 to 100 after a backup restore option. Can someone explain or point me in the direction as to what the difference is between 130 and 100. After all this is a production db that has been fine on the older version and suddenly needing to have fancy new ways of doing things within 2016 is probably not needed.

  16. Paul – Microsoft says:
    Assess compatibility requirements. When planning for a SQL Server database upgrade, you’ll want to understand what features are deprecated, discontinued or changed in the new version. Being aware of these changes in advance helps you prevent performance problems and issues related to application availability.

    Should we be concerned that we’re going to break our applications when moving from SQL 2005 to a higher version because some feature that exists within SQL 2005 does not exist within a newer version.

    Thank you.

    1. Yes, that’s exactly what that means. You should always do extensive testing on the new version before moving to it in production, especially around compatibility levels and the changed cardinality estimators from 2014 onward.

  17. Great blog article Paul. Thanks to everyone for their questions and comments. This is a very succinct and thorough coverage of the issues. A great help to me.

  18. Thanks Paul. It was very useful article.
    We are planning to upgrade our Sql server 2000 and wondering which latest edition i can upgrade it?
    It will be a side by side upgrade. I know that i have to upgrade first 2008R2 then next edition but little confused as It’s only support from 2008R2 to Sql 2014/2016 or i can upgrade it to Sql 2017?

    Ex. Sql 2000 ==> Sql 2008R2 ==> which edition latest?
    Is it better i should go Sql 2000 ==> Sql 2005 ==> which edition latest?


Leave a Reply

Your email address will not be published. Required fields are marked *

Other articles

Imagine feeling confident enough to handle whatever your database throws at you.

With training and consulting from SQLskills, you’ll be able to solve big problems, elevate your team’s capacity, and take control of your data career.