pg_restore

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

Install

All systems
curl cmd.cat/pg_restore.sh
Debian Debian
apt-get install postgresql-client-9.1
Ubuntu
apt-get install postgresql-client-9.3
Alpine
apk add postgresql
Arch Arch Linux
pacman -S postgresql-old-upgrade
image/svg+xml Kali Linux
apt-get install postgresql-client-11
CentOS
yum install postgresql
Fedora
dnf install postgresql
OS X
brew install postgresql
Raspbian
apt-get install postgresql-client-9.5
Docker
docker run cmd.cat/pg_restore pg_restore powered by Commando

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

  • Restore an archive into an existing database:
    pg_restore -d db_name archive_file.dump
  • Same as above, customize username:
    pg_restore -U username -d db_name archive_file.dump
  • Same as above, customize host and port:
    pg_restore -h host -p port -d db_name archive_file.dump
  • Clean database objects before creating them:
    pg_restore --clean -d db_name archive_file.dump
  • Use multiple jobs to do the restoring:
    pg_restore -j 2 -d db_name archive_file.dump

© tl;dr; authors and contributors