Skip to content

Instantly share code, notes, and snippets.

@eriknaslund
Last active November 26, 2017 08:02
Show Gist options
  • Select an option

  • Save eriknaslund/464eb34da222eaaeb29e66aac338cd8e to your computer and use it in GitHub Desktop.

Select an option

Save eriknaslund/464eb34da222eaaeb29e66aac338cd8e to your computer and use it in GitHub Desktop.
PG dump and restore
# Dump the database schema to the file schema.sql
pg_dump -h $SRC_SERVER_IP -d $DB_NAME -U $DB_USER -f dump.sql -W -s -v
# Restore the database schema into an empty database
psql -h $DST_SERVER_IP -d $DB_NAME -U $DB_USER -f dump.sql -W
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment