Skip to content

Instantly share code, notes, and snippets.

@guisehn
Forked from wrburgess/gist:5528649
Last active June 2, 2021 11:08
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save guisehn/6648c8fdcd1102a22a22 to your computer and use it in GitHub Desktop.
Save guisehn/6648c8fdcd1102a22a22 to your computer and use it in GitHub Desktop.
Backup Heroku Postgres database and restore to local database

Grab new backup

Command: heroku pg:backups capture -a [app_name]

Download

Command: curl -o latest.dump `heroku pg:backups public-url -a [app_name]`

Restore backup dump into local db

Command: pg_restore --verbose --clean --no-acl --no-owner -h localhost -d [db_name] latest.dump

@tedrob
Copy link

tedrob commented May 23, 2018

I changed my local and now I want to restore that file back into my heroku database

@danjohnson3141
Copy link

This was very helpful. Thanks for writing it. +1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment