Last Updated: February 25, 2016
·
1.924K
· shinn

Backup and Restoring PostgreSQL on Heroku

Use Heroku PG Backups to backup and restore PostgreSQL database

1.Backup a Heroku PostgreSQL database

$ heroku pgbackups:capture

↪ use --expire flag to capture a new backup while automatically deleting the oldest manual backup.

$ heroku pgbackups:capture --expire

2.Downloading a backup

$ heroku pgbackups:url

↪ This will generate a temporary link to download the backup database.

3.Restore a backup

$ heroku pgbackups:restore DATABASE 'link-to-database-here'

↪ Restoring a postgres binary backup using url, don't forget the quotes for the database url.

For more information, read the Heroku PostgreSQL documentation.