Zum Inhalt springen

Diese Seite ist noch nicht auf Deutsch verfügbar und wird daher auf Englisch angezeigt.

Database Migration Best Practices

Practical best practices for SQL Server migrations: inventory and dependencies, choosing a method, rehearsals, a written cutover plan, rollback, validation and communication.

Most database migrations that go wrong don't fail because of the technology. Backups restore, data copies and servers start. They fail because of something nobody knew about: a linked server on the old box, a job that ran there and nowhere else, an application with a hard-coded connection string, or a cutover that took four hours when everyone had planned for one.

The best practices below are about finding those surprises before the night itself. They apply whether you are moving to new hardware, a new version, a different data centre or the cloud.

Know exactly what you are moving

Start with a complete inventory of what lives on the source, not just the databases:

  • **Databases**, with their sizes, recovery models, compatibility levels and growth rates.
  • **Logins and permissions**, including SQL logins with their passwords and SIDs, so users map correctly after the move.
  • **SQL Agent jobs, operators and alerts.**
  • **Linked servers, credentials and proxies.**
  • **Server-level objects** such as server triggers, endpoints, custom error messages and server configuration.
  • **Anything outside SQL Server** that the server does: file shares, scheduled tasks, SSIS packages, reporting.

PowerShell tools such as dbatools can copy many of these between instances, but you still need the list to know what to check afterwards.

Map the dependencies

Next, find everything that connects to the source. Look at current connections in `sys.dm_exec_sessions` over a typical week, not just one afternoon, so you catch the monthly report and the weekend batch job. Check linked servers on other instances that point at this one, and ask application teams for their connection strings. Every one of those needs updating or redirecting at cutover. A DNS alias or listener name that you can repoint is far easier than updating dozens of applications.

Choose the method to fit the downtime

The right method depends mostly on how much downtime you can accept and how much data there is:

| Method | Typical downtime | Notes |

| --- | --- | --- |

| Backup and restore | Long: the time to take, copy and restore a full backup | Simple and reliable for smaller databases or generous windows |

| Full backup, then differential and log backups | Short: only the final log backup and restore | Most of the data moves before the cutover night |

| Log shipping | Short | Keeps the target close to the source until you switch |

| Availability groups | Very short: a failover | Needs compatible versions and configuration on both sides |

| Table-level synchronisation | Short, per table | Useful when only part of the data moves, or schemas differ |

For most migrations, the goal is to move the bulk of the data ahead of time and leave only a small final catch-up for the cutover window.

Rehearse, and time it

Run the migration at least once, end to end, against a copy of production, and time every step. Rehearsals find missing permissions, steps that take far longer than expected and scripts that don't work on the real data volume. They also give you real timings for the cutover plan, rather than guesses. If a rehearsal goes badly, that is a success: it is much cheaper than the real night going badly.

Write the cutover plan down

The cutover plan should be a numbered list of steps, each with an owner, an expected duration and a check that confirms it worked. Include:

  • When applications are stopped and how you confirm they have stopped.
  • The final data catch-up and how you confirm it is complete.
  • Repointing connections, aliases or DNS.
  • Validation checks before you let users back in.
  • A **go/no-go point**: a time by which, if things aren't on track, you roll back.

Walk through the plan with everyone involved before the night.

Plan the rollback

Every migration needs a way back. Usually that means leaving the source untouched and read-only until the new system is proven, so you can switch connections back if something goes badly wrong. Decide in advance what would trigger a rollback, who makes the call and how long you would wait before making it. A rollback plan that only exists in someone's head isn't a plan.

Validate properly

"It started" isn't validation. Check row counts on important tables, compare checksums or totals on key columns, run the application's critical paths, check that jobs ran on the new server and that backups are working there. Our [SQL Server migration validation checklist](/guides/sql-server-migration-validation-checklist) covers this in detail.

Communicate before, during and after

Tell the people affected when the migration will happen, what downtime to expect and how they will know it is finished. During the cutover, keep a running update for stakeholders. Afterwards, confirm it is done, say what changed, such as a new server name, and tell them who to contact if something looks wrong.

Troubleshooting Scenarios

Users can't log in after the migration

SQL logins probably have different SIDs on the new server. Copy logins with their SIDs, or fix orphaned users in each database.

A job that used to run no longer does

It wasn't copied, or it depends on something only the old server had. Compare jobs between the two servers as part of validation.

The cutover took far longer than planned

The plan wasn't based on rehearsal timings. Rehearse with production-sized data and use those timings next time.

An application is still connecting to the old server

It wasn't in the dependency list. Check connections on the old server for a few weeks after cutover before decommissioning it.

Where SQL Cockpit fits

Migrations involve a lot of moving parts across several environments, and keeping track of them is half the work. SQL Cockpit includes tools for planning and running SQL Server migration and table synchronisation work, alongside visibility of jobs and object context in the environments involved. The planning, rehearsals and sign-off described here still come from your team.

FAQ

What are the most important database migration best practices?

Inventory everything, map dependencies, pick a method that fits your downtime, rehearse with real data, write a cutover plan with a rollback and validate properly.

How do I minimise downtime during a SQL Server migration?

Move most of the data beforehand, using backups plus differentials and logs, log shipping or availability groups, so only a short catch-up happens at cutover.

Why rehearse a database migration?

Rehearsals expose missing steps and permissions and give you real timings for the cutover plan.

How do I avoid orphaned users after a migration?

Copy SQL logins with their original SIDs, or remap database users to logins on the new server after restoring.

When should the old server be decommissioned?

Only after the new system is proven and you have checked for a few weeks that nothing still connects to the old one.

Semantic Keywords

  • database migration best practices
  • schema drift
  • table synchronisation
  • environment comparison
  • migration orchestration
  • SQL Server monitoring
  • SQL Agent monitoring
  • runtime analysis
  • runtime baselines
  • runtime variance
  • SQL Server operations
  • database telemetry
  • historical analysis
  • operational dashboards
  • cross-server monitoring

Suggested Related Articles