Issue
I need to recover a deleted production-tier Heroku Postgres database
Resolution
You're able to recover a production-tier database for up to 10 days after it has been deprovisioned.
To do so:
- Get the old database URL for the resource, e.g. from
heroku releases:info --app <old app>
. - Create a new database with
heroku addons:create heroku-postgresql:<plan> --app <recovery-app> --fork <old-database-url>
. recovery-app can be any Heroku app you own, which is useful if an entire app was deleted but you still have the DATABASE_URL for the deleted database. - Wait for the database to become available with
heroku pg:wait --app <recovery-app>
.
If this doesn't work for some reason, you may be able to restore a PGBackup even if the database was recently deleted. If the app is not deleted, you can check if there is any backups that can be used for the recovery (heroku pg:backups -a APP_NAME
).