commands.sh

pg_restore

all

Restore a PostgreSQL database from an archive file created by pg_dump.

More info →

Options (7)

-d, --dbnameboolean

Restore an archive into an existing database

Example: pg_restore {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}
-U, --usernameboolean

Same as above, customize username

Example: pg_restore {{[-U|--username]}} {{username}} {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}
-h, --hostboolean

Same as above, customize host and port

Example: pg_restore {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}
-p, --portboolean

Same as above, customize host and port

Example: pg_restore {{[-h|--host]}} {{host}} {{[-p|--port]}} {{port}} {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}
-l, --listboolean

List database objects included in the archive

Example: pg_restore {{[-l|--list]}} {{archive_file.dump}}
-c, --cleanboolean

Clean database objects before creating them

Example: pg_restore {{[-c|--clean]}} {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}
-j, --jobsboolean

Use multiple jobs to do the restoring

Example: pg_restore {{[-j|--jobs]}} {{2}} {{[-d|--dbname]}} {{db_name}} {{archive_file.dump}}

Examples (6)

Restore an archive into an existing database

pg_restore [-d|--dbname] db_name archive_file.dump

Same as above, customize username

pg_restore [-U|--username] username [-d|--dbname] db_name archive_file.dump

Same as above, customize host and port

pg_restore [-h|--host] host [-p|--port] port [-d|--dbname] db_name archive_file.dump

List database objects included in the archive

pg_restore [-l|--list] archive_file.dump

Clean database objects before creating them

pg_restore [-c|--clean] [-d|--dbname] db_name archive_file.dump

Use multiple jobs to do the restoring

pg_restore [-j|--jobs] 2 [-d|--dbname] db_name archive_file.dump
made by @shridhargupta | data from tldr-pages