You can migrate SQL Server 2012 to 2019 with four methods. Backup and restore moves databases to a new 2019 server. An in place upgrade needs SQL Server 2012 SP4. Log shipping shortens downtime. Migration software exports a live database or an MDF file when the old server is gone. Raise the compatibility level after you test the application.
Microsoft ended support for SQL Server 2012 on 12 July 2022. You now need a plan to migrate SQL Server 2012 to 2019 because security fixes no longer arrive for the old instance.
Most guides show one restore and stop. Few explain the SP4 rule for in place upgrades or how to move a database when only its MDF file survives.
This guide explains four methods to move SQL Server 2012 to 2019, with the checks before the move and the tasks after it.
Microsoft lists SQL Server 2012 SP4 as the lowest source for a direct upgrade in its supported version and edition upgrades article.
Why Migrate SQL Server 2012 to 2019?
Support is the main reason. Three facts explain the urgency:
- Security Fixes. SQL Server 2012 receives no security updates, bug fixes or technical support after 12 July 2022.
- Paid Updates. Microsoft sells Extended Security Updates for SQL Server 2012 only to eligible customers with Software Assurance under an Enterprise Agreement.
- Azure Option. Microsoft names Azure virtual machines as a destination with free extra security updates. Confirm the terms for SQL Server 2012 before you plan around them.
Microsoft states that SQL Server 2008 and 2008 R2 cannot upgrade in place to 2019. You can still restore a backup from 2008 or later on 2019 when its compatibility level is 100 or higher.
Which Migration Path Fits Your Server?
Match your situation to a path in this table:
| Situation | Path |
|---|---|
| New server and a long maintenance window | Backup and restore |
| One server on SP4 and no spare hardware | In place upgrade |
| Large database and a short outage window | Log shipping |
| Only an MDF file or no working 2012 server | Migration software |
What Must You Check Before You Migrate?
Six checks come before any move:
- Check the service pack with this query:
SELECT SERVERPROPERTY('ProductVersion') AS version,
SERVERPROPERTY('ProductLevel') AS service_pack;
- Confirm that the new server uses a supported operating system and 64 bit SQL Server 2019.
- Backup every user database and the master, model and msdb system databases. The Explore Different Types of Backups in SQL Server guide has the scripts for full, differential and log backups.
- Note the collation of ShopDB and keep the same collation on the new server.
- List the logins, linked servers and Agent tasks that the application needs.
- Check the free disk space on the new server for the data and log files.
4 Ways to Migrate SQL Server 2012 to 2019
Three methods use tools from Microsoft and the fourth adds software for MDF files.
| Method | Server | Main limit |
|---|---|---|
| Backup and Restore | New SQL Server 2019 server | Logins and Agent tasks move separately |
| In Place Upgrade | Same server | Needs SQL Server 2012 SP4 |
| Log Shipping | Two servers | Needs the full or bulk logged recovery model |
| Migration Software | New SQL Server 2019 server | Trial record limit |
Method #1: Restore a SQL Server 2012 Backup on 2019 (Free, Easy Rollback)
A backup from SQL Server 2012 restores directly on SQL Server 2019. The old instance remains online and gives you a quick return path. Six steps move ShopDB:
- Install SQL Server 2019 on the new server.
- Backup ShopDB on the old instance:
BACKUP DATABASE ShopDB
TO DISK = N'G:\Migrate\ShopDB.bak'
WITH CHECKSUM, STATS = 10;
- Copy ShopDB.bak to the new server.
- Restore ShopDB and relocate the files:
RESTORE DATABASE ShopDB
FROM DISK = N'H:\Migrate\ShopDB.bak'
WITH MOVE N'ShopDB' TO N'H:\Data\ShopDB.mdf',
MOVE N'ShopDB_log' TO N'I:\Logs\ShopDB_log.ldf',
STATS = 10;
- Create the old logins on the new instance.
- Check the compatibility level and raise it after the application tests.
Note: SQL Server 2012 databases arrive at compatibility level 110 and keep it until you raise it. The Restore a SQL Database From a BAK File guide explains every restore dialog.
Method #2: Upgrade in Place With SQL Server 2019 Setup (Free, Needs SP4)
Setup replaces the 2012 engine on the same server and preserves the databases. Microsoft requires SQL Server 2012 SP4 for this path. Eight steps start the upgrade:
- Install SQL Server 2012 SP4 when the build is older.
- Restart Windows when a restart is pending because Setup stops the upgrade in that case.
- Open the SQL Server 2019 media, right click setup.exe and select Run as administrator.
- Select Installation and then Upgrade from a previous version of SQL Server.
- Accept the license terms and fix every failed rule on Install Rules.
- Select the SQL Server 2012 instance on Select Instance.
- Click Upgrade on Ready to Upgrade.
- Execute
SELECT @@VERSION;in SSMS to confirm version 15.Setup cannot add new features during an upgrade and cannot convert a 32 bit instance to 64 bit. Add features afterward or restore on a new 64 bit instance.
Note: Add the SQL Server Agent service account to the sysadmin role and enable Windows Authentication for the Agent before Setup starts. Take the backups first because an in place upgrade cannot be undone.
Method #3: Move With Log Shipping for a Short Outage (Free, Two Servers)
Log shipping updates a copy of ShopDB on SQL Server 2019 while users work on the old server. Microsoft lists log shipping as a migration path to SQL Server 2019. The database needs the full or bulk logged recovery model. Six steps set it up:
- Right click ShopDB on the 2012 instance and select Properties.
- Select Transaction Log Shipping and tick Enable this as a primary database in a log shipping configuration.
- Click Backup Settings and add a network path for the log backups.
- Click Add under Secondary databases and connect to the 2019 server.
- Select No recovery mode on the Restore Transaction Log tab.
- Click OK to start the backup, copy and restore tasks.
On the cutover night stop the application and let the last log backup restore. Then backup the tail of the log on the old server and restore it on the new one with WITH RECOVERY:
BACKUP LOG ShopDB
TO DISK = N'G:\Migrate\ShopDB_tail.trn'
WITH NORECOVERY;
RESTORE LOG ShopDB
FROM DISK = N'H:\Migrate\ShopDB_tail.trn'
WITH RECOVERY;
Note: The database upgrades when it recovers on SQL Server 2019. You cannot send it back to SQL Server 2012 afterward. Save the old backups.
Method #4: Migrate a SQL Server 2012 MDF File to 2019 With EmailDoctor (Free Preview, Paid Export)
Teams without a working 2012 server open the MDF file with EmailDoctor SQL Server Data Migration Tool. The migration software scans the file and exports its objects with schema and data to the SQL Server 2019 instance. Vendor notes list SQL Server 2019 and earlier releases.
The free trial previews every object but exports only 25 records per table and 5 other categories. Paid versions remove that limit.
Open the MDF File of SQL Server 2012
Six steps scan the file and show its objects:
- Start the software on a Windows PC and select Offline mode.
- Click Browse and add the MDF file.
- Choose Quick Scan for a healthy file or Advance Scan for a damaged file.
- Select SQL Server 2012 as the file version.
- Click OK and close the message when the scan ends.
- Browse the tree to review tables, views and procedures.
Export to the SQL Server 2019 Instance
Six steps send the objects to the new instance:
- Click Export at the top.
- Select SQL Server Database as the type.
- Add the Server Name with Authentication of the 2019 instance.
- Select Create New Database or Export to Existing Database and set Collation Settings.
- Tick the objects to move and choose With Schema & Data.
- Click Save and then OK when Export Completed appears.
Note: Online mode connects to a live 2012 instance when the server still works. Select SQL Server Compatible SQL Scripts to create a script file.
Which Tasks Finish the Migration?
Four closing tasks apply to every method.
- Backup every moved database again.
- Update the statistics after the move:
USE ShopDB;
EXEC sp_updatestats;
- Rebuild the full text catalogs of databases that use them.
- Raise the compatibility level after application tests and enable Query Store to watch for regressions:
SELECT name, compatibility_level FROM sys.databases;
ALTER DATABASE ShopDB SET QUERY_STORE = ON;
ALTER DATABASE ShopDB SET COMPATIBILITY_LEVEL = 150;
Level 150 matches SQL Server 2019. Changing it needs ALTER permission on the database. Rehearse on a restored copy first.
Which Problems Stop the Migration?
Five problems stop a migration:
| Problem | Reason | Fix |
|---|---|---|
| Setup refuses to start | A restart is pending | Restart Windows and start Setup again |
| Setup refuses to start | Windows Installer service is stopped | Start the Windows Installer service |
| 2012 instance missing on Select Instance | Source is below SP4 or is 32 bit | Install SP4 or restore on a new 64 bit server |
| Restore of a SQL Server 2008 backup fails | Compatibility level is below 100 | Raise the level on the source first |
| New features are missing | Setup cannot add features while upgrading | Add features with Setup afterward |
Frequently Asked Questions
Can I Migrate SQL Server 2012 to 2019 Directly?
Yes. Microsoft lists SQL Server 2012 SP4 or later as a source for a direct upgrade. Install the service pack first when the build is older. Migrate other builds with a restore.
Can I Migrate SQL Server 2008 to 2019?
Yes. Skip the in place upgrade because Microsoft does not list SQL Server 2008 as an upgrade source. Restore a backup from SQL Server 2008 or later on 2019 when its compatibility level is 100 or higher.
Does SQL Server 2012 Still Get Security Updates?
No. Microsoft ended support on 12 July 2022. Only eligible customers with Software Assurance under an Enterprise Agreement can buy Extended Security Updates.
Does a Restore Raise the Compatibility Level?
No. A SQL Server 2012 database retains compatibility level 110 until you raise it with ALTER DATABASE.
Can I Move a Database Back to SQL Server 2012?
No. SQL Server 2012 cannot attach a database from a newer release. Restore the backup that you took before the migration.
Can I Migrate a 32 Bit SQL Server 2012 Instance?
Yes. Use a restore because Setup cannot upgrade a 32 bit instance to 64 bit. Backup the databases and restore them on a new 64 bit instance.
Can Migration Software Open an MDF File From a Dead Server?
Yes. Select Offline mode, browse to the MDF file and choose a scan mode. The software scans the file without a live server.
Does the Trial Version Export Every Table?
No. Trial exports stop at 25 records per table and 5 other categories. Buy a license for a full export.
Author’s Verdict
Backup and restore gives the safest rollback because the old instance remains untouched. In place upgrades save hardware but need SP4 and cannot be undone.
Log shipping cuts the outage for large databases. Migration software fits MDF files and servers that no longer start.
Raise the compatibility level once the application passes its tests. Keep the old backups for one week.
- Four methods move SQL Server 2012 to 2019.
- Backup and restore gives the old instance as a rollback.
- In place needs SQL Server 2012 SP4 and a 64 bit instance.
- Log shipping shortens the outage.
- Migration software opens MDF files.
- Treat the compatibility level as a separate step and take a new backup.