Backup, copy, and restore SharePoint SQL databases across SQL Server instances — designed for two common scenarios:
- SharePoint Server 2016 / 2019 → Subscription Edition migrations.
- PROD → PRE-PROD content refreshes.
SPSDBMove is a single PowerShell script that orchestrates the three phases
end-to-end (or any phase individually):
- Backup —
BACKUP DATABASE ... WITH COPY_ONLY, COMPRESSION, CHECKSUMon the source instance, written into a per-database folder layout (<root>\<DbName>\FULL\<DbName>_<timestamp>.bak). - Copy — parallel file copy of the latest
.bakper database from the source share to the destination share. - Restore —
RESTORE DATABASE ... WITH REPLACE, RECOVERYon the destination instance, with automatic logical-to-physical file remapping.
Companion project: luigilink/SPSUpdate.
| Component | Version |
|---|---|
| PowerShell | 7.0 or later (the Copy phase uses ForEach-Object -Parallel) |
SqlServer module |
21.1.18256 or later |
| Source SQL Server | 2016 / 2017 / 2019 / 2022 |
| Destination SQL Server | 2019 / 2022 (SharePoint SE compatible) |
| Account rights | dbcreator + BACKUP DATABASE on source; dbcreator on destination; read/write on both backup shares |
Install the SQL module once:
Install-Module -Name SqlServer -Scope CurrentUser -ForceSPSDBMove is configuration-driven: the job (instances, backup roots,
database list, tuning) lives in a small JSON file; the CLI takes only the
config path, the phase to run, and a couple of runtime flags.
-
Copy the sample config and edit it for your environment:
Copy-Item .\scripts\SPSDBMove.sample.json .\scripts\my-refresh.json notepad .\scripts\my-refresh.json
-
Run the full pipeline (backup → copy → restore):
.\scripts\SPSDBMove.ps1 -ConfigPath .\scripts\my-refresh.json
.\scripts\SPSDBMove.ps1 -ConfigPath .\scripts\my-refresh.json -Action Backup
.\scripts\SPSDBMove.ps1 -ConfigPath .\scripts\my-refresh.json -Action Copy
.\scripts\SPSDBMove.ps1 -ConfigPath .\scripts\my-refresh.json -Action Restore| Parameter | Purpose |
|---|---|
-ConfigPath (alias -Path) |
Required. Path to the JSON job file. |
-Action |
All (default), Backup, Copy, or Restore. |
-SqlCredential |
Optional [pscredential] for SQL auth. Kept on the CLI so secrets stay out of the JSON. |
-SkipExisting |
Copy phase only: skip files already at the destination with the same size. |
-WhatIf / -Confirm |
Standard PowerShell, honored by every destructive operation. |
Everything else (SourceInstance, DestinationInstance, SourceBackupRoot,
DestinationBackupRoot, DataFileDirectory, LogFileDirectory,
ThrottleLimit, OverwriteDestinationDb,
Databases, ExcludeDatabases) belongs in
the JSON file. See scripts/SPSDBMove.sample.json
and Configuration.
SPSDBMove honours -WhatIf for every destructive operation:
.\scripts\SPSDBMove.ps1 -ConfigPath .\scripts\my-refresh.json -WhatIfFull documentation lives in the wiki:
See CONTRIBUTING.md. Bug reports and feature requests use the issue templates.
See CHANGELOG.md and the latest release notes.
MIT © 2026 Jean-Cyril Drouhin.