OnCallReady

Commands

pg_dumpall - extract a PostgreSQL database cluster into a script file

pg_dumpall [OPTION]...

Options you will use

-g, --globals-only
dump only global objects, no databases.
-r, --roles-only
dump only roles, no databases or tablespaces.
-t, --tablespaces-only
dump only tablespaces, no databases or roles.
-f, --file=FILENAME
output file name.
-c, --clean
clean (drop) databases before recreating.
--no-role-passwords
do not dump passwords for roles.
-h, --host=HOSTNAME
database server host or socket directory (default: the Unix socket in /var/run/postgresql). A value starting with / is a socket directory; anything else is TCP.
-p, --port=PORT
database server port (default 5432).
-U, --username=USERNAME
database user name (default: your OS user name).
-w, --no-password
never prompt for a password (fail instead: what scripts want).
-W, --password
force a password prompt (normally automatic).

Examples

$ pg_dumpall --globals-only > globals.sql

roles and tablespaces, the part pg_dump misses

Gotchas

Taught in

Try pg_dumpall in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.