"
DBAs are well aware that downgrading a SQL Server database cannot be done out of the box. Even when the compatibility level of the database that needs to be migrated to an older SQL Server version matches that version, the backup can’t be simply restored. Upgrading can also be a problem.
Restoring a database backup created on a SQL Server 2008 R2 to a SQL Server 2012 instance goes smoothly. But, if a SQL Server 2000 backup is tried to be restored on a SQL Server 2012, the following error will be shown:
![]()
Click To See Full Image.
One of the solutions is to:
-
Restore the SQL Server 2000 backup on SQL Server 2008
-
Set the compatibility level to 100
-
Create a database backup on SQL Server 2008
-
Restore the SQL Server 2008 backup on SQL Server 2012
-
Set compatibility level to 110
The downside of this solution is that there has to be 3 versions of SQL Server installed and the discontinued or deprecated T-SQL features would have to be manually removed.
If there is no access to the live database from which the backup was taken from:
-
Start SQL Server Management Studio and connect to the instance that contains the database
-
In the Advanced Scripting Options window that will appear:
-
In the Script for Server Version option, set SQL Server 2012
-
In the Types of data to script option, set Schema and data
-
Set the following options to True:
- Script Logins
- Script Full-Text Indexes
- Script Triggers
-
Click the OK button
![]()
Click To See Full Image.
-
Click the Next button
-
In the Summary step of the wizard, click the Next button:
![]()
Click To See Full Image.
-
In the Save Scripts step of the wizard, click the Finish button:
![]()
Click To See Full Image.
-
Execute the generated SQL script(s) against the newer SQL instance
Although the procedure listed above should work:
-
The discontinued or deprecated T-SQL features would have to be manually removed
-
It might fail if a database contains dependencies which SQL Server fails to recognize (e.g. dependencies to databases located on linked servers)
If there is no access to the original database for any reason (e.g. migrating a database to an off-site location with no network connectivity), the procedures above are not applicable.
This is where ApexSQL Diff and ApexSQL Data Diff can help.
ApexSQL Diff is a SQL Server database comparison and synchronization tool which detects differences between database objects and resolves them without errors. It generates comprehensive reports on the found differences and can automate the synchronization process between live and versioned databases, backups, snapshots, script folders and source control projects.
ApexSQL Data Diff is a SQL Server data comparison and synchronization tool which detects data differences and resolves them without errors. It can compare and synchronize live databases and native or natively compressed database backups, script folders and source control projects, and it generates comprehensive reports on the detected differences.
To restore the backup to a newer SQL Server version:
-
On the target SQL instance, create an empty database to hold the data and objects restored from the backup
-
Select Backup from the Source drop-down list
-
Click the Add button and navigate to the folder where the backup file is located
-
Select the backup and click the Open button
-
In the Destination panel:
-
Select Database from the Destination drop-down list
-
Specify the SQL instance where the database, in which objects that need to be recovered, is located, from the Server drop-down list
-
Specify the authentication method for that SQL instance (and a valid set of credentials if the SQL Server authentication is chosen)
-
Specify the name of the database where the objects will be recovered to, in the Database drop-down list
![]()
Click To See Full Image.
-
Click the Compare button in the bottom-right corner of the New project window
-
Select Backup from the Source drop-down list
-
Click the Add button and navigate to the folder where the backup file is located
-
Select the backup and click the Open button
-
In the Destination panel:
-
Select Database from the Destination drop-down list
-
Specify the SQL instance where the database from which the data that is going to be recovered from is located, from the Server drop-down list
-
Specify the authentication method for that SQL instance (and a valid set of credentials if the SQL Server authentication is chosen)
-
Specify the name of the database to which the data will be recovered to in the Database drop-down list
![]()
Click To See Full Image.
-
Click the Compare button in the bottom-right corner of the New project window
"