LinuxCommandLibrary
GitHub F-Droid Google Play Store

pg_restore

restores PostgreSQL databases from archives created by pg_dump

TLDR

Restore from custom format
$ pg_restore -d [database] [backup.dump]
copy
Restore specific table
$ pg_restore -d [database] -t [tablename] [backup.dump]
copy
List contents of backup
$ pg_restore -l [backup.dump]
copy
Restore with parallelism
$ pg_restore -d [database] -j [4] [backup.dump]
copy
Clean before restore
$ 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)

Copied to clipboard
Kai

AltStyle によって変換されたページ (->オリジナル) /