Free tools / pg_dump command builder

pg_dump command builder

Pick a format and where the backup goes, and copy the pg_dump command together with the pg_restore or psql command that loads its output. The pg_dump, pg_restore and psql lines for each format and compression setting were run against PostgreSQL 18 and restored to the same row count.

Backup

pg_dump --format=custom "$DATABASE_URL" --file=app.dump

Restore into an empty database

pg_restore --exit-on-error --single-transaction --dbname "$TARGET_URL" app.dump

Why these defaults

Use a pg_dump at least as new as the server, and restore into the same major version or a newer one. To check a dump you already have, use the backup file checker. For the bucket side, with a lock that stops anyone deleting the file, follow How to back up PostgreSQL to S3 with pg_dump.

SafeGrd runs this for you: it backs up on a schedule, encrypts and locks each backup, and restores it to count every row (PostgreSQL backup).

Run your first Fire Drill More free tools