Can I recover a deprovisioned production-tier Heroku Postgres database?

Issue

I need to recover a deleted production-tier Heroku Postgres database

Resolution

If you've deprovisioned your database and want it restored, we may be able to restore it within the stated continuous protection rollback period.

To do so:

  1. Identify the release of your app when the database was detached. Use heroku releases --app <APP_NAME> and find the release reflecting the DETACH event of the database you deleted. Use the version of the release prior to this one in step 2.
  2. Get the old database URL for the deleted database from the config vars of that release. To do so, run heroku releases:info <releaseversion> --app <APP_NAME> and copy the database URL for the database. This URL will be used in step 3.
  3. Create a new database with heroku addons:create heroku-postgresql:<plan> --app <APP_NAME> --fork <old-database-url>.
  4. Wait for the database to become available with heroku pg:wait --app <APP_NAME>.

As an alternative recovery method, you can also check if your app still keeps any Heroku PGBackups from your deleted database to restore it. Use heroku pg:backups --app <APP_NAME> to check the existing PGBackups associated to your app.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support