Skip to content

Instantly share code, notes, and snippets.

@salaros
Last active October 17, 2018 15:43
Show Gist options
  • Save salaros/a04736c2c8d65a32239631d96fc62c70 to your computer and use it in GitHub Desktop.
Save salaros/a04736c2c8d65a32239631d96fc62c70 to your computer and use it in GitHub Desktop.
Use pg_restore to restore a binary PostgreSQL dump made by pg_dump
pg_dump -Fc --no-owner --no-privileges --no-tablespaces --clean --schema public --dbname=postgresql://username1:password1@localhost/dbname1 > /tmp/dbname1.bak
pg_restore -Fc --dbname=postgresql://username2:password2@localhost/dbname2 /tmp/dbname1.bak
rm -rfv /tmp/dbname1.bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment