pg_dumpall > all.sql

Category: Databases & SQL

pg_dumpall > all.sql

Back up all databases plus cluster-wide settings

Dumps roles, tablespaces, and every database into one plain-SQL file, so it is the complete cluster backup. Restore with psql -f all.sql, and restore roles before databases. Related: pg_dump for a single database.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.