SqlBak Blog

SQL Server 2008 migration

Database migration is a common task for database administrators, but it is often associated with potential issues that may not be immediately obvious.

Before starting the migration, there are two important recommendations:

1. Make sure to use the Data Migration Assistant (DMA) — a Microsoft tool that helps identify features that have been deprecated or changed in newer versions of SQL Server.

2. Always test in a staging environment. Even if no issues are reported, always test the migrated database in a test environment. Seemingly harmless changes can lead to unexpected behavior. For example, a query might start running significantly faster, which could break application logic if the frontend was built assuming slower execution.

Migrating SQL Server 2008 to a newer version

SQL Server is compatible with previous versions, meaning you can simply back up your database as described above on SQL Server 2008 and restore it to any later version of SQL Server.

How to migrate a database from a newer version to SQL Server 2008

Although the task of downgrading a database version is not typical, it can arise in practice.

Attention: The method described below will help you transfer data from a newer database to SQL Server 2008, but downgrading is usually accompanied by many initially non-obvious problems. Use this approach only if you cannot solve your issue in another way.

SQL Server does not support backward compatibility, so you won’t be able to restore a backup on an older version. However, there is a workaround through logical backups (generation of .sql scripts). You need to create a SQL script that is compatible with SQL Server 2008. This can be done through SqlBackupAndFTP or SSMS.

Using SqlBackupAndFTP

When creating a backup job in SqlBackupAndFTP, select a remote connection type – Microsoft SQL Server (SQL dump):

RemoteMSSQLServerConnection
RemoteMSSQLServerConnection

After selecting where to store the backup, go to the advanced backup job settings.

In the Target Engine Type field, select Standalone, and in Target SQL Server Version, choose SQL Server 2008 (R2):

TargetEngineType
Target Engine Type settings

Then click Run Now button to start the backup process.

StartBackupJob
Start Backup Job

Create a restore job on the server where you want to restore the database.

  1. Specify the path to the backup file
  2. Select the databases to restore
  3. Finally, choose Remote Connection – Microsoft SQL Server (SQL dump) and proceed with the restore.
Restore Job
RestoreJobLog
Restore Job Log

Using SQL Server managment studio

In SSMS, select Tasks → Generate Scripts:

Generate script from SSMS

In the Set Scripting Options window, click the Advanced button:

Generate Scripts Wizar Advanced Options

Set Script for SQL Server Version to SQL Server 2008:

Also, set Types of data to script to Schema and Data:

Complete the wizard — your script will be ready.

If your script is small, you can restore it simply by executing it in SSMS.
However, if the file is large, you can restore it using the command-line interface (sqlcmd). Learn more here:
https://sqlbak.com/blog/complete-guide-to-sql-server-backup-and-restore-using-the-command-line/

Leave a Comment