r/SQLServer • u/SuddenlyCaralho • Sep 19 '26
Discussion Alternative way to migrate SQL Server without a file shared between data centers?
My scenario is the following:
I have two database VMs, one in Data Center A and the other in Data Center B. The client said they cannot establish a VPN, so they exposed their database VM through a public IP, and we also exposed our database VM through a public IP (of course, with proper firewall settings). The VMs can now communicate with each other for the migration.
On the destination server (Data Center B), I created an SMB shared folder so that the source server (Data Center A) can access it and write the backup directly to that folder.
I am running the backup like this:
USE [db_name]
GO
BACKUP DATABASE [db_name]
TO DISK='\\PUBLIC_IP_HERE\backup\db_name_full.BAK'
WITH STATS = 10,
FORMAT,
COPY_ONLY,
COMPRESSION,
NAME = 'Full Backup of db_name';
GOHowever, it is extremely slow. Both machines have 1 Gbps network connections.
I read that this could be related to SMB's behavior over high-latency connections, since SMB does not perform particularly well with latency.
I also cannot create the backup locally and then copy it using another tool because the source server does not have enough free disk space.
What would you recommend in this scenario? I'm running out of ideas.
I also ran an iperf speed test. It shows that without parallel streams the transfer is slow (3.32 MBytes), while with parallel streams I can reach around 64.9 MBytes
What would be the best approach to migrate the database in this scenario, given that I cannot use a VPN, cannot create a local backup first, and SMB is performing poorly over the WAN?
23
u/dbrownems Microsoft Employee Sep 19 '26
Backup to and restore from Azure.
https://learn.microsoft.com/en-us/sql/relational-databases/backup-restore/sql-server-backup-to-url?view=sql-server-ver17
8
u/az987654 Sep 19 '26
This whole set up sounds like amateur hour
34
u/VTOLfreak Sep 19 '26
You guys are running SMB over the public internet straight to a machine with production data? #clownshow
Shut that crap down and put a VPN in place. And not being able to set up a VPN is a bullshit excuse. If you can get on the machine to set up an SMB share, you can install a VPN client. Things like Tailscale and ZeroTier are free for small deployments.
52
u/BCCMNV Sep 19 '26 •
Never underestimate the bandwidth of a station wagon doing 70mph loaded up with hard drives.
1
u/jshine13371 6 Sep 21 '26
Not understanding the use case. Is this a one time migration? Or will this be a repeated process and at what cadence? How big is the database?
3
u/SirGreybush 1 Sep 19 '26
I did the tried & true Sneaker Net system last time around, and it was perfect. Instead of a USB key I used an enclosure with a 1tb nvme inside.
Did "detach" on one, drove to other location, plugged the usb into the host of the VM after the tech at the co-loc station scanned it an he was the one to plug it in, while I waited in the lounge. Once he added the usb device to the host and configured the host to mount it into the VM, a new hard drive appeared, while I was connected with Remote Desktop (RDP). Windows guy...
Then moved the file, and did "Attach". Beforehand I made sure both VMs were in the same security domain, and myself my domain user was present in both VMs before doing the "Detach" my AD user was a SA.
With detach/attach you need all the files, .mdf & .ldf. Also a backup then restore also works, but it a lot slower.
Even if the new VM is in Azure - talk to your Microsoft rep, you can supply a USB key or drive inside a usb 3.0 enclosure and they will set it up for you. For a fee of course.
3
u/alinroc 4 Sep 19 '26
Then how is the database getting backed up today?
Firewall or not, that's a terrible idea. VPN between sites is table stakes in 2026. It was in 2006 too.
2
u/CodeXploit1978 Sep 19 '26
Depending on the database size when compressed. I would do a full backup transfer that to the new server during the day, then do a norecovery restore. And then on the time of the migration just push the differential to the new server. Or use something like OneDrive for Google Drive to transfer the differential backup.
2
u/hackjob Sep 19 '26
Since you already have the smb share, consider dfsr and create a second share at DC2, let it handle the sync of the backup file across the two. As you mentioned latency could be a challenge but a managed automated sync will work if your time requirement allows.
1
u/duendeacdc Sep 19 '26
Just fast enable vpn, backup , move, close.
1
u/ITWorkAccountOnly Sep 19 '26
I won't touch opening both machines via public internet and how that sounds like a bad idea, however to speed up backups try striping the backup across multiple files. That often can speed things up as well if you have it so it splits the backup and writes to say 4 files at once.
1
u/TravellingBeard 1 Sep 19 '26 edited Sep 19 '26
It's old school, but if the better suggestions others made aren't feasible, do this:
Lots of good articles on TDE out there. If you decide to keep it in place, make sure you backup the cert and remember that password, in case of disaster. I also recommend you do a proof of concept backup and restore with a small test database that you don't care if it's intercepted. Maybe try AdventureWorks.
Also, if your source DB is massive, TDE will take a while once you turn encryption on. I recommend shrinking your transaction log first if it's very large.
1
u/ddBuddha Sep 19 '26
If you have faster network speeds on both end than you’re getting with SMB, create an s3 bucket that both sides can connect to and use it as an intermediate step. Uploads and downloads to s3 should be fast enough if your connection is decent on both sides.
This is how I personally have been handling migrations recently. It’s great.
Take a full backup, push that to the destination. Restore with NORECOVERY. Then later when you’re ready to cutover, take a diff, send it up and restore it with recovery. Then run whatever you may need to on the destination to ensure it’s all good, and you’re done.
1
u/MonkeyDDataHQ Sep 19 '26
Have you tried the Database Migration tool? It exists, is generally blazing fast and while there are annoying displaying bugs, it works extremely well.
1
u/perry147 Sep 19 '26
Have you tried log shipping?
1
u/clubfungus Sep 19 '26
Syncthing
1
u/Exciting-Sunflix Sep 19 '26
If the internet is too slow, use sneakernet
1
u/grey580a Sep 20 '26
VPN has overhead. However might be the safest bet. Then setup database mirroring. And just failover to the new server.
1
u/EljoDedor2022 Sep 20 '26
Backup the DB locally in a volumen with enough space, copy and paste to the New server, and restore in the New server 🫡🫡
1
u/Royal-Wear-6437 Sep 20 '26
Of course you can have a VPN. Client to client with OpenVPN or even Wireguard. Run on the two VMs
1
u/pointymctest Sep 21 '26
you mention Migration then mention backing up a database. do you want to move one database only or migrate the whole sql server (settings, users etc.) ?
Eitherway look at dbatools and you're bound to find something to make your life easier there whether you use azure in the end or courier an SSD over to the site.
0
u/Proper-Addition2174 Sep 19 '26
Is creating an availability group an option for you?
0
u/kona420 Sep 19 '26
Stop the database and copy the database files directly?
0
u/Upstairs_Ad_8268 Sep 20 '26
The reason you're hitting a wall is that SMB/CIFS is extremely chatty over WAN links. It relies heavily on round-trip acknowledgments, meaning high RTT/latency will destroy single-thread throughput regardless of having a 1 Gbps pipe. Exposing port 445 over a public IP is also a major security risk, even with firewall restrictions.
Since your iperf test proved that parallel streams saturate the link, here are the best ways to solve this:
Option 1: Native SQL Server Backup Striping (Easiest & Immediate Fix)
SQL Server allows you to split a backup across multiple files using multiple TO DISK targets. Each file opens an independent TCP stream over SMB. Combined with E/S memory tuning, this leverages the multi-stream performance you saw in iperf without installing extra tools on the source server.
BACKUP DATABASE [db_name]
TO DISK = '\\PUBLIC_IP_HERE\backup\db_name_part1.BAK',
DISK = '\\PUBLIC_IP_HERE\backup\db_name_part2.BAK',
DISK = '\\PUBLIC_IP_HERE\backup\db_name_part3.BAK',
DISK = '\\PUBLIC_IP_HERE\backup\db_name_part4.BAK'
WITH STATS = 10,
FORMAT,
COPY_ONLY,
COMPRESSION,
BUFFERCOUNT = 100, -- Increases I/O buffers in memory
MAXTRANSFERSIZE = 4194304, -- 4MB block size to maximize throughput
NAME = 'Full Backup Striped';
GO
To restore, just pass all 4 files in the RESTORE DATABASE ... FROM DISK = ..., DISK = ... command at the destination.
Option 2: BACKUP TO URL (Azure Blob Storage or S3-Compatible Object Store)
If you are running SQL Server 2016 or newer (or SQL Server 2012 SP1 CU2+), write the backup directly to an object store via HTTPS:
BACKUP DATABASE [db_name]
TO URL = 'https://youraccount.blob.core.windows.net/backups/db_name.bak'
WITH COPY_ONLY, COMPRESSION, CREDENTIAL = 'MyBlobCredential';
GO
Why it works: It Streams data over parallel HTTPS block blobs, bypasses SMB WAN latency completely, and requires zero local disk space on Source A. You then restore directly from the URL or download it at high speed on Destination B.
Option 3: Host-to-Host Software Tunnel (Tailscale / WireGuard)
If the network team won't set up a site-to-site VPN, install a lightweight, host-to-host mesh VPN like Tailscale or WireGuard directly on the two VMs.
It takes 5 minutes to set up.
Encrypts the connection securely without exposing SMB (Port 445) publicly.
Significantly improves window sizing and TCP throughput over high-latency links.
TL;DR: Split the backup into 4–8 TO DISK striped files with MAXTRANSFERSIZE = 4194304 to force parallel TCP streams over SMB, or stream directly via BACKUP TO URL over HTTPS.