pg_dumpall
all
Extract a PostgreSQL database cluster into a script file or other archive file.
More info →Options (5)
-U, --usernamebooleanDump all databases using a specific username
Example:
pg_dumpall {{[-U|--username]}} {{username}} > {{path/to/file.sql}}-h, --hostbooleanSame as above, customize host and port
Example:
pg_dumpall {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} > {{output_file.sql}}-p, --portbooleanSame as above, customize host and port
Example:
pg_dumpall {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} > {{output_file.sql}}-a, --data-onlybooleanDump only database data into an SQL-script file
Example:
pg_dumpall {{[-a|--data-only]}} > {{path/to/file.sql}}-s, --schema-onlybooleanDump 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.sqlDump all databases using a specific username
pg_dumpall [-U|--username] username > path/to/file.sqlSame as above, customize host and port
pg_dumpall [-h|--host] host [-p|--port] port > output_file.sqlDump only database data into an SQL-script file
pg_dumpall [-a|--data-only] > path/to/file.sqlDump only schema (data definitions) into an SQL-script file
pg_dumpall [-s|--schema-only] > output_file.sqlmade by @shridhargupta | data from tldr-pages