r/AZURE • u/Soft_Return_6532 • 22d ago
Question Best approach for migrating SQL Server databases between Azure VMs?
Hi everyone,
We're planning to migrate SQL Server databases from existing Azure VMs to newly provisioned Azure VMs running SQL Server 2022.
The production environment must remain online during preparation, but a maintenance window can be arranged for the final migration.
We're currently evaluating two approaches:
- SQL backup/restore (export/import): Back up the databases, transfer the backup files, and restore them on the new SQL Server.
- Azure managed disk detach/attach: Detach the existing data disks from the source VM and attach them to the new VM, then attach the databases to SQL Server 2022.
We're also considering snapshots to avoid modifying the original production disks.
My questions:
- Which approach would you recommend for this scenario, considering the data volume and downtime?
- Is disk detach/attach a safe and practical option when migrating to SQL Server 2022?
- Would creating managed disks from snapshots be safer than detaching the original disks?
- What prerequisites or potential issues should we consider, particularly regarding SQL Server compatibility, database consistency, and rollback?
- Which approach would minimize production downtime while avoiding issues from the existing SQL Server environment?
Our plan is to test and validate the selected approach in TEST server before applying the same method in production.
I'd appreciate any recommendations or experiences with similar migrations.
Thanks!
5
u/mezzanine_enjoyer 22d ago
How big is the database? Are we talking a backup/restore process length of like an hour or 12 hours? I would trial this first.
2
u/iam-stevie-bee 22d ago
Backup and restore. Pre-stage a full with NORECOVERY, then apply the final log backup in the window. Old VM untouched is your rollback.
2
u/ihaxr 19d ago
I would certainly just drop all the production databases and the business the migration is complete
2
u/joyrexj9 21d ago
Self hosting SQL Server on a Windows VM in 2026?!
1
u/Typical_Cloud_6517 21d ago
Detach disk and attach disk. Be aware the db can hold metadata that will require the disks on the new VM to use identical letters and placement of files. There is a lof of stuff to take into account, so yes a test environment first is how I did it. Shrinking logs can help, but .... If you join them in a HA cluster AG it won't accept simple logs when you try to join the AG. Backup / restore takes to long, depends on size of course, but will give you like a days downtime or more (try it in test and you will see), the other disk swap can be done in a few hours downtime if planned well.
1
u/SaintTimothy 21d ago
Why not Azure Migrate? It's their built-in tool for this sort of thing.
3
u/newtonianfig 22d ago
AI slop