SQL Server migration validation checklist
A practical checklist for validating a SQL Server migration: what to capture beforehand, data and object checks, logins and orphaned users, jobs, backups, performance and sign-off.
"The database is online on the new server" is where validation starts, not where it ends. A migration can look complete while users can't log in, a nightly job is missing, backups aren't running or a key table is a few thousand rows short. Proper validation catches those things before users do.
This checklist covers what to capture before the migration, what to check afterwards and how to sign it off. Adapt it to your environment, but try not to skip whole sections.
Before the migration: capture a baseline
You can only prove the target matches the source if you recorded what the source looked like. Before cutover, capture:
- **Row counts** for every table, or at least every important one.
- **Checksums or totals** on key columns of critical tables, such as order totals by month or the sum of account balances.
- **Object counts** by type for each database: tables, views, procedures, functions, triggers.
- **Server-level objects**: logins, server roles, linked servers, credentials, SQL Agent jobs, operators and alerts.
- **Database settings**: compatibility level, recovery model, collation, isolation options.
- **Performance baselines** for the most important queries and jobs, so you can compare afterwards.
Save it all somewhere you can compare against later, with the time it was captured.
Data checks
After the data has moved, and before users come back:
- Every database is online and in the expected state.
- Row counts match the baseline for every table, allowing for any changes you expect during the cutover.
- Checksums or totals on key columns match.
- Reference and lookup tables match exactly.
- Identity values on the target are at or above the highest key in each table.
- `DBCC CHECKDB` runs cleanly on the migrated databases.
Row counts from `sys.partitions` are quick to compare across many tables:
```sql
SELECT SCHEMA_NAME(t.schema_id) + '.' + t.name AS table_name, SUM(p.rows) AS row_count
FROM sys.tables t
JOIN sys.partitions p ON p.object_id = t.object_id AND p.index_id IN (0, 1)
GROUP BY t.schema_id, t.name
ORDER BY table_name;
```
Object and settings checks
- Object counts by type match the source for each database.
- Code objects match, by comparing definition hashes or using a schema comparison tool.
- Compatibility level, recovery model and collation are what you intended. Migrating to a newer version doesn't change the compatibility level automatically after a restore, so decide deliberately whether to raise it.
- Database-scoped configuration matches, or has been changed on purpose.
Logins and users
Logins are one of the most common post-migration problems. Database users are linked to server logins by a security identifier (SID). If a SQL login was created on the new server with a different SID, the user in the database is "orphaned" and logins fail.
- Every login the applications and people need exists on the new server.
- SQL logins were copied with their original SIDs and passwords, or their users have been remapped.
- No orphaned users remain in any migrated database.
This finds orphaned users in a database, skipping built-in principals and contained database users:
```sql
SELECT dp.name AS user_name, dp.type_desc
FROM sys.database_principals dp
LEFT JOIN sys.server_principals sp ON sp.sid = dp.sid
WHERE dp.type IN ('S', 'U', 'G') AND sp.sid IS NULL
AND dp.authentication_type_desc IN ('INSTANCE', 'WINDOWS')
AND dp.principal_id > 4;
```
Fix any it finds with `ALTER USER ... WITH LOGIN = ...`.
Jobs, linked servers and other server objects
- Every SQL Agent job from the source exists on the target, or has been deliberately retired.
- Jobs are enabled or disabled as intended, with the right owners and schedules.
- Jobs have run successfully on the new server at least once, or have been run manually as a test.
- Linked servers exist and point where they should, with working credentials.
- Operators, alerts and Database Mail are set up, and a test email arrives.
- Jobs on the old server that would now act on the wrong data are disabled.
Backups and maintenance
- Full, differential and log backups are scheduled and have completed successfully on the new server.
- A test restore of at least one backup from the new server has worked.
- Integrity checks and index and statistics maintenance are scheduled.
- Monitoring and alerting cover the new server.
Application and performance checks
- Applications connect using the new server name, alias or listener.
- The application's critical paths have been tested by someone who knows them, such as logging in, placing an order or running a key report.
- The most important queries and jobs perform at least as well as their baselines.
- Nothing is still connecting to the old server; check its connections for a few days.
Sign-off
Agree in advance who signs off, and on what evidence. A short record of each check, its result and who did it is usually enough. Keep the old server available, ideally read-only, until sign-off is complete and a rollback is no longer needed. Only then plan its decommissioning.
Troubleshooting Scenarios
Users get "not able to access the database under the current security context"
Check for orphaned users and remap them with ALTER USER WITH LOGIN.
Row counts differ slightly
Check whether the source was still being written to during the cutover. If not, find which tables differ and why.
A job that ran on the old server doesn't exist on the new one
Jobs live in msdb, not in user databases, so they must be copied separately. Compare job lists between the two servers.
Queries are slower after the migration
Check the compatibility level, statistics and server settings such as MAXDOP and memory, and compare plans with the old server.
FAQ
How do I validate a SQL Server migration?
Capture a baseline beforehand, then check data, objects, settings, logins, jobs, backups, application behaviour and performance against it.
How do I compare row counts after a migration?
Sum rows from sys.partitions for each table on both servers and compare the results.
What is an orphaned user?
A database user whose SID no longer matches a login on the server, usually after a restore to a different server. It can't log in until remapped.
Does restoring to a newer SQL Server version change compatibility level?
No. The database keeps its compatibility level until you change it, which lets you test before raising it.
When can the old server be decommissioned?
After sign-off, once you are sure no rollback is needed and nothing still connects to it.