pg_restore
restores PostgreSQL databases from archives created by pg_dump
TLDR
Restore from custom format
$ pg_restore -d [database] [backup.dump]
Restore specific tablecopy
$ pg_restore -d [database] -t [tablename] [backup.dump]
List contents of backupcopy
$ pg_restore -l [backup.dump]
Restore with parallelismcopy
$ pg_restore -d [database] -j [4] [backup.dump]
Clean before restorecopy
$ pg_restore -d [database] -c [backup.dump]
copy
SYNOPSIS
pg_restore [options] [file]
DESCRIPTION
pg_restore restores PostgreSQL databases from archives created by pg_dump in custom, directory, or tar format. It cannot restore plain SQL dumps (use psql for those).The tool can selectively restore objects using a table-of-contents file, run multiple parallel jobs (directory format only), and optionally create the target database before restoring.
PARAMETERS
-d, --dbname name
Database to restore to.-t, --table name
Restore specific table.-n, --schema name
Restore specific schema.-j, --jobs num
Parallel jobs.-c, --clean
Drop objects before creating.-C, --create
Create the database.-l, --list
List archive contents.-L file
Use table of contents file.
CAVEATS
Cannot restore plain SQL dumps. Parallel restore requires directory format. May need superuser for some objects.
HISTORY
pgrestore is part of **PostgreSQL**, complementing pgdump for custom format backup restoration.
SEE ALSO
pg_dump(1), pg_dumpall(1), psql(1)