0% found this document useful (0 votes)
61 views

How To Migrate A SQL Server Database To A Newer Version of SQL Server

This document discusses how to migrate a SQL Server database to a newer version of SQL Server. It describes restoring a backup on an intermediate version to update the compatibility level before restoring on the target version. It also covers using SQL Server Management Studio to script the database and generate scripts to recreate the database objects on the newer version. Alternatively, it recommends using ApexSQL Diff and ApexSQL Data Diff tools to compare and synchronize the database backup to the target version.

Uploaded by

RonaldMartinez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views

How To Migrate A SQL Server Database To A Newer Version of SQL Server

This document discusses how to migrate a SQL Server database to a newer version of SQL Server. It describes restoring a backup on an intermediate version to update the compatibility level before restoring on the target version. It also covers using SQL Server Management Studio to script the database and generate scripts to recreate the database objects on the newer version. Alternatively, it recommends using ApexSQL Diff and ApexSQL Data Diff tools to compare and synchronize the database backup to the target version.

Uploaded by

RonaldMartinez
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

DOWNLOADS (HTTPS://WWW.APEXSQL.COM/DOWNLOAD.ASPX)
®

(https://www.apexsql.com)

PRICES (HTTPS://WWW.APEXSQL.COM/PURCHASE.ASPX)

SUPPORT (HTTPS://SUPPORT.QUEST.COM/)

(https://blog.apexsql.com)

(https://www.apexsql.com/contact/)

(https://shop.quest.com/)
(https://solutioncenter.apexsql.com/)

Solution center

How to migrate a SQL Server database to a newer ver‐


sion of SQL Server

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:

(/wp-content/uploads/2019/02/c-users-ninja-desktop-apexsql-data-diff-content-w-1.png)

One of the solutions is to:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 1/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

1. Restore the SQL Server 2000 backup on SQL Server 2008


2. Set the compatibility level to 100
3. Create a database backup on SQL Server 2008
4. Restore the SQL Server 2008 backup on SQL Server 2012
5. 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:

1. Start SQL Server Management Studio and connect to the instance that contains the database

2. In the database context menu, right-click a desired database and navigate to Tasks => Generate
Scripts:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 2/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-143.png)

3. This will invoke the Generate Scripts wizard. In the Introduction step of the wizard, click the Next
button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 3/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-144.png)

4. In the Choose Objects step of the wizard, make sure that the Script entire database and all data‐
base objects option is selected and click the Next button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 4/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-145.png)

5. In the Set Scripting options step of the wizard:

a. Select the Save scripts to a specific location option

b. Specify whether database objects and data will be scripted to a single or multiple files, as well
as the path and encoding of the generated scripts:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 5/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-146.png)

c. Click the Advanced button

d. 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

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 6/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-147.png)

6. Click the Next button

7. In the Summary step of the wizard, click the Next button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 7/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-148.png)

8. In the Save Scripts step of the wizard, click the Finish button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 8/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-149.png)

9. Execute the generated SQL script(s) against the newer SQL instance

Although the procedure listed above should work:

1. The discontinued or deprecated T-SQL features would have to be manually removed


2. It might fail if a database contains dependencies which SQL Server fails to recognize (e.g. dependen‐
cies 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 (https://www.apexsql.com/sql_tools_diff.aspx) and ApexSQL Data Diff


(https://www.apexsql.com/sql_tools_datadiff.aspx) can help.

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 9/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

ApexSQL Diff (https://www.apexsql.com/sql_tools_diff.aspx) is a SQL Server database comparison and syn‐


chronization 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 (https://www.apexsql.com/sql_tools_datadiff.aspx)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:

1. On the target SQL instance, create an empty database to hold the data and objects restored from the
backup

2. Start ApexSQL Diff (https://www.apexsql.com/sql_tools_diff.aspx)

3. Click the New button in the Project management window:

(/wp-content/uploads/2019/02/word-image-150.png)

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 10/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

4. In the Source panel:

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

5. 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 lo‐
cated, 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

(/wp-content/uploads/2019/02/word-image-151.png)

6. Click the Compare button in the bottom-right corner of the New project window

7. Select all the objects listed in the Results grid:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 11/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-152.png)

8. Click the Synchronize button in the Actions region of the ribbon’s Home tab:

9. Click the Next button in the Synchronization direction step of the Synchronization wizard:

(/wp-content/uploads/2019/02/word-image-154.png)

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 12/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

10. Click the Next button in the Dependencies step of the Synchronization wizard, since all objects will
be synchronized all depended objects are included and this list will be empty:

(/wp-content/uploads/2019/02/word-image-155.png)

11. In the Output options step of the Synchronization wizard, select the Synchronize now action and
click the Next button:

(/wp-content/uploads/2019/02/word-image-156.png)

12. Review the synchronization summary and warnings, if there are any, and click the Synchronize
button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 13/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-157.png)

13. The Results window will be shown upon finished synchronization process:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 14/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

14. Start ApexSQL Data Diff (https://www.apexsql.com/sql_tools_datadiff.aspx)

15. Click the New button in the Project management window:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 15/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-159.png)

16. In the Source panel:

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

17. 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

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 16/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-160.png)

18. Click the Compare button in the bottom-right corner of the New project window

19. In the Results grid, select the database tables the data is to be recovered to:

(/wp-content/uploads/2019/02/word-image-161.png)

20. In the Data difference view panel, select the rows to be recovered:

(/wp-content/uploads/2019/02/word-image-162.png)

21. Click the Synchronize button in the Actions region of the ribbon’s Home tab:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 17/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

22. Click the Next button in the Synchronization direction step of the Synchronization wizard:

(/wp-content/uploads/2019/02/word-image-164.png)

23. In the Output options step of the Synchronization wizard, select the Synchronize now action and
click the Next button:

(/wp-content/uploads/2019/02/word-image-165.png)

24. Review the synchronization summary and warnings, if there are any, and click the Synchronize button:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 18/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(/wp-content/uploads/2019/02/word-image-166.png)

25. The Results window will be shown upon finished synchronization process:

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 19/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

This way, migrating an old version of SQL Server database to a newer version is done via the schema syn‐
chronization of the original database backup and a blank live database first, and data synchronization after‐
wards. ApexSQL Diff (https://www.apexsql.com/sql_tools_diff.aspx) and ApexSQL Data Diff
(https://www.apexsql.com/sql_tools_datadiff.aspx) will take care of all depreciated and discontinued
features.

Related Posts:
1. How to restore a SQL Server database backup to an older version of SQL Server
(https://solutioncenter.apexsql.com/restore-sql-server-database-backup-to-older-version-
of-sql-server/)
2. How to compare and synchronize databases programmatically
(https://solutioncenter.apexsql.com/comparing-and-synchronizing-databases-
programmatically/)
3. SQL Server database continuous integration workflow SYNC step – Creating the
synchronization/migration script (https://solutioncenter.apexsql.com/sql-server-database-
continuous-integration-workflow-sync-step-creating-synchronization-migration-script/)
4. How to automatically compare and synchronize multiple databases on different SQL Server
instances (https://solutioncenter.apexsql.com/how-to-automatically-compare-and-synchro‐
nize-multiple-databases-on-different-sql-server-instances/)
5. How to automatically pull SQL Server database objects from a shared script folder to a local
database (https://solutioncenter.apexsql.com/how-to-automatically-pull-sql-server-data‐
base-objects-from-a-shared-script-folder-to-a-local-database/)

April 4, 2013

Software Sales

What's supported Support plans (https://support.quest.com/essentials/support-


(https://www.apexsql.com/supported-software.aspx) offerings)
Requirements Renewals and upgrades
(https://www.apexsql.com/requirements.aspx) (https://www.apexsql.com/renewals_and_upgrades.aspx)
Testimonials Licensing (https://blog.apexsql.com/how-are-apexsql-tools-
(https://www.apexsql.com/testimonials.aspx) licensed/)
Help News

Support (https://support.quest.com/) What's new


(https://www.apexsql.com/whats_new.aspx)
Resend keys (https://www.apexsql.com/resend_keys.aspx)
Blog (https://blog.apexsql.com/)
Free Company

Plan exploration (https://www.apexsql.com/sql-tools- Contact (https://www.apexsql.com/contact/)


plan.aspx)
About (https://www.apexsql.com/AboutUs.aspx)
SQL formatter (https://www.sql-formatter.online/)

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 20/21
14/7/2021 How to migrate a SQL Server database to a newer version of SQL Server

(https://tv.apexsql.com/) 

(https://www.linkedin.com/company/apexsql/) 

(https://twitter.com/ApexSQL) 

(https://www.facebook.com/ApexSQL) 

(https://blog.apexsql.com)
(https://www.apexsql.com/#SubscribeBox)

© 2021 Quest Software Inc. ALL RIGHTS RESERVED.   |   GDPR (https://www.quest.com/legal/gdpr-hq.aspx)   |   Terms of Use
(https://www.quest.com/legal)   |   Privacy (https://www.quest.com/legal/privacy.aspx)

https://solutioncenter.apexsql.com/restore-sql-server-backup-to-a-newer-version-of-sql-server/ 21/21

You might also like