How to back up DigitalOcean Managed PostgreSQL to Windows

DigitalOcean keeps a week of backups inside DigitalOcean. Here's how to keep your own copies on a Windows machine.

Updated October 14, 2026 · 2 min read

Short on time? PostgresBackup does everything on this page from a Windows app: scheduled pg_dump backups, retention and one-click restores. Download it free.

DigitalOcean's managed PostgreSQL clusters are backed up daily and support point-in-time restore within a limited retention window. Restoring always creates a new cluster inside DigitalOcean, and you can't download those backups. For a copy you control, and one that outlives the retention window and the cluster itself, use pg_dump.

Step 1: Find the connection details

In the control panel open Databases → your cluster → Overview → Connection details. Pick Public network and note:

  • Host: like db-postgresql-nyc3-12345-do-user-678-0.b.db.ondigitalocean.com
  • Port: 25060, not 5432. This catches almost everyone.
  • User: doadmin (or a user you created)
  • Database: defaultdb unless you created another
  • SSL mode: require

DigitalOcean also offers a connection pool on port 25061. Don't use it for backups: pools in transaction mode don't work with pg_dump.

Step 2: Add your PC to trusted sources

If the cluster has Trusted sources set (it should), only listed droplets, apps and IP addresses can connect. Under Network Access (or Settings → Trusted sources), add your machine's public IP. New rules can take a minute to apply. Timeouts usually mean this step is missing.

Step 3: Back it up

PowerShell
$env:PGSSLMODE = 'require'
& 'C:\Program Files\PostgreSQL\18\bin\pg_dump.exe' `
    -h db-postgresql-nyc3-12345-do-user-678-0.b.db.ondigitalocean.com -p 25060 -U doadmin `
    -F c -f "D:\Backups\defaultdb-$(Get-Date -Format yyyyMMdd-HHmm).dump" defaultdb

Use client tools at least as new as the cluster's PostgreSQL version (on the cluster's Overview page). require encrypts the connection. For certificate verification, download the cluster's CA certificate from the same panel and use PGSSLMODE=verify-full with PGSSLROOTCERT pointing at the file.

Step 4: Schedule it

Plug these values into the script from the main Windows guide:

PowerShell
$Database  = 'defaultdb'
$PgHost    = 'db-postgresql-nyc3-12345-do-user-678-0.b.db.ondigitalocean.com'
$Port      = 25060
$User      = 'doadmin'
$env:PGSSLMODE = 'require'

with this pgpass.conf line (note the port):

Config
db-postgresql-nyc3-12345-do-user-678-0.b.db.ondigitalocean.com:25060:defaultdb:doadmin:YOUR_PASSWORD

The script generator fills all of this in for you.

Restoring

Into a local database:

PowerShell
& "$bin\createdb.exe" -h localhost -U postgres defaultdb_copy
& "$bin\pg_restore.exe" -h localhost -U postgres -d defaultdb_copy --no-owner --no-privileges D:\Backups\defaultdb-20261014-0200.dump

Back into a DigitalOcean cluster, use the same command with the cluster's host, port 25060 and PGSSLMODE=require. --no-owner makes doadmin (or whoever restores) own the objects. See restoring a .dump file on Windows.

How PostgresBackup handles DigitalOcean

In PostgresBackup, add the cluster with port 25060 and SslMode=Require. Pasting the postgresql://…?sslmode=require URI from the control panel also works. Then create a nightly job. The background service runs it from boot, applies your retention rules, and logs each run, so you can see a failed backup (for example, after your IP changed) in Backup History.

The shortcut

Rather not maintain a backup script?

PostgresBackup is a Windows app that does all of this for you, with nothing to script and nothing to remember.

  • Scheduled pg_dump backups from a background service that starts with Windows
  • Keep the last N files plus hourly, daily, weekly, monthly and yearly copies
  • Restore any backup, or clone a database to another server, in a few clicks
  • PostgreSQL client tools included; standard .dump files, no lock-in
  • No account, no subscription, nothing leaves your machine

Clones, restores and manual backups are free. Scheduled backups are free for 14 days, then $9.99 once (launch price; $24 from January 1).