By: K. Brian Kelley | Updated: 2012-04-17 | Comments (13) | Related: 1 | 2 | > Restore
Problem
We recently upgraded one of our SQL Server to a newer version. When I took the backup from one of the databases on that server and attempted to restore it to our test restore server (where we verify backups), I received an error. The test server wasn't upgraded to the newest version, but there's nothing in the database that's incompatible with the older version. I walked through the prompts and it seemed like SQL Server recognized the backup just fine. However, when it went to actually do the restore, it failed. What am I doing wrong?
Solution
You aren't doing anything wrong. You cannot take a backup from a newer version of SQL Server and restore it to an older version. This is true, even though SQL Server Management Studio obviously appears to recognize the backup, like so:
If you select to restore this backup, but you are on an older version of SQL Server, you likely received an error similar to this one:
In this particular case, SQL Server Management Studio is telling me that when SQL Server attempted to restore the backup, it realized that the backup was from SQL Server 2008R2 but I was restoring to SQL Server 2008. As a result, the restore failed.
Why This Happens
It is important to note that though SQL Server can obviously tell a lot about the backup because it ascertain the right version of SQL Server where this backup was taken, it still can't be forced to restore the backup. Even if all of the elements within the database, all of the tables, views, stored procedures, datatypes, etc. are fully compatible with the older version of SQL Server, the restore will always fail. That's because the version of a database is about more than just those things. There are changes to the databases with each version of SQL Server, and this includes service packs and cumulative updates. For instance, consider if I run the following command, restoring a backup taken on SQL Server 2005 to a SQL Server 2008 server:
RESTORE DATABASE Some_2005_DB
FROM DISK='C:\TEMP\Some_2005_DB.bak'
WITH MOVE 'Some_2005_DB_Data' TO 'C:\temp\Some_2005_DB.mdf',
MOVE 'Some_2005_DB_Log' TO 'C:\temp\Some_2005_DB_log.pdf',
RECOVERY;
I end up getting a bunch of notifications of the database being upgraded:
Processed 296 pages for database 'Some_2005_DB', file 'Some_2005_DB_Data' on file 1.
Processed 2 pages for database 'Some_2005_DB', file 'Some_2005_DB_Log' on file 1.
Converting database 'Some_2005_DB' from version 611 to the current version 655.
Database 'Some_2005_DB' running the upgrade step from version 611 to version 621.
Database 'Some_2005_DB' running the upgrade step from version 621 to version 622.
Database 'Some_2005_DB' running the upgrade step from version 622 to version 625.
Database 'Some_2005_DB' running the upgrade step from version 625 to version 626.
Database 'Some_2005_DB' running the upgrade step from version 626 to version 627.
Database 'Some_2005_DB' running the upgrade step from version 627 to version 628.
Database 'Some_2005_DB' running the upgrade step from version 628 to version 629.
Database 'Some_2005_DB' running the upgrade step from version 629 to version 630.
Database 'Some_2005_DB' running the upgrade step from version 630 to version 631.
Database 'Some_2005_DB' running the upgrade step from version 631 to version 632.
Database 'Some_2005_DB' running the upgrade step from version 632 to version 633.
Database 'Some_2005_DB' running the upgrade step from version 633 to version 634.
Database 'Some_2005_DB' running the upgrade step from version 634 to version 635.
Database 'Some_2005_DB' running the upgrade step from version 635 to version 636.
Database 'Some_2005_DB' running the upgrade step from version 636 to version 637.
Database 'Some_2005_DB' running the upgrade step from version 637 to version 638.
Database 'Some_2005_DB' running the upgrade step from version 638 to version 639.
Database 'Some_2005_DB' running the upgrade step from version 639 to version 640.
Database 'Some_2005_DB' running the upgrade step from version 640 to version 641.
Database 'Some_2005_DB' running the upgrade step from version 641 to version 642.
Database 'Some_2005_DB' running the upgrade step from version 642 to version 643.
Database 'Some_2005_DB' running the upgrade step from version 643 to version 644.
Database 'Some_2005_DB' running the upgrade step from version 644 to version 645.
Database 'Some_2005_DB' running the upgrade step from version 645 to version 646.
Database 'Some_2005_DB' running the upgrade step from version 646 to version 647.
(and so on)
The Options
Therefore, you have a handful of options if you need to get a database from a newer version of SQL Server to an older one:
- 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.
Next Steps
- Learn how to backup and restore databases programmatically.
- Find out how to auto-generate backup scripts.
- Troubleshoot replication errors when using transactional replication to keep data in sync.
- Work through a tutorial on SSIS.
About the author
This author pledges the content of this article is based on professional experience and not AI generated.
View all my tips
Article Last Updated: 2012-04-17