commands.sh

pg_dumpall

all

Extract a PostgreSQL database cluster into a script file or other archive file.

More info →

Options (5)

-U, --usernameboolean

Dump all databases using a specific username

Example: pg_dumpall {{[-U|--username]}} {{username}} > {{path/to/file.sql}}
-h, --hostboolean

Same as above, customize host and port

Example: pg_dumpall {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} > {{output_file.sql}}
-p, --portboolean

Same as above, customize host and port

Example: pg_dumpall {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} > {{output_file.sql}}
-a, --data-onlyboolean

Dump only database data into an SQL-script file

Example: pg_dumpall {{[-a|--data-only]}} > {{path/to/file.sql}}
-s, --schema-onlyboolean

Dump only schema (data definitions) into an SQL-script file

Example: pg_dumpall {{[-s|--schema-only]}} > {{output_file.sql}}

Examples (5)

Dump all databases

pg_dumpall > path/to/file.sql

Dump all databases using a specific username

pg_dumpall [-U|--username] username > path/to/file.sql

Same as above, customize host and port

pg_dumpall [-h|--host] host [-p|--port] port > output_file.sql

Dump only database data into an SQL-script file

pg_dumpall [-a|--data-only] > path/to/file.sql

Dump only schema (data definitions) into an SQL-script file

pg_dumpall [-s|--schema-only] > output_file.sql
made by @shridhargupta | data from tldr-pages