Cross-platform database backup utility for SQL Server and PostgreSQL, built on .NET 10. Runs on Windows and Linux (cron/systemd).
- Scheduled backups of one or more databases
- ZIP compression after each backup
- Automatic deletion of backups older than N days
- Optional FTP mirror upload
- Single-instance lock (prevents overlapping runs)
- .NET 10 runtime
- SQL Server: reachable instance;
BACKUP DATABASEpath must be valid on the SQL Server host (local or remote) - PostgreSQL:
pg_dumpinPATH(Linux:postgresql-clientpackage; Windows: PostgreSQL installbinfolder)
Edit appsettings.json next to the executable.
Each entry in ConnectionStrings is a full connection string with Database (or Initial Catalog) set to the database to back up. Use separate entries for different servers or credentials.
{
"DatabaseProvider": "SqlServer",
"ConnectionStrings": [
"Server=localhost;Database=shop;User Id=sa;Password=YourPassword;TrustServerCertificate=True",
"Server=localhost;Database=frontend;User Id=sa;Password=YourPassword;TrustServerCertificate=True",
"Server=remote;Database=accounting;User Id=sa;Password=YourPassword;TrustServerCertificate=True"
],
"BackupDir": "C:\\DB_Backups",
"DeletionDays": 10
}On Linux, use SQL authentication (Integrated Security is Windows-specific) and a path the SQL Server process can write, for example /var/opt/mssql/backup when SQL Server runs locally.
{
"DatabaseProvider": "PostgreSQL",
"ConnectionStrings": [
"Host=localhost;Port=5432;Username=postgres;Password=secret;Database=shop",
"Host=localhost;Port=5432;Username=postgres;Password=secret;Database=frontend"
],
"BackupDir": "/var/db_backups",
"DeletionDays": 10,
"PgDumpPath": "pg_dump"
}pg_dump writes the dump file on the machine where this tool runs (unlike SQL Server BACKUP TO DISK, which uses the server filesystem).
{
"FtpServer": "ftp.example.com",
"FtpLogin": "user",
"FtpPassword": "password",
"FtpUploadDir": "/backups"
}dotnet build -c Release
dotnet run -c Release --project SimpleDBBackupPublished self-contained example for Linux x64:
dotnet publish SimpleDBBackup -c Release -r linux-x64 --self-containedWindows: Task Scheduler — run SimpleDBBackup.exe on your schedule.
Linux (cron, daily at 2:00):
0 2 * * * /usr/local/bin/SimpleDBBackup >> /var/log/simpledbbackup.log 2>&1Use a dedicated backup directory only for this tool; files older than DeletionDays are removed from that folder.
- SQL Server: restore from extracted
.bakvia SSMS orRESTORE DATABASE - PostgreSQL:
pg_restore -d dbname backup.dump(custom format frompg_dump -Fc)