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

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:

  1. Identify the release during which the database status is marked as DETACH. Use the version of the release prior to this in step 2.
  2. Get the old database URL for the resource by running heroku releases:info <releaseversion> --app <APP_NAME>. 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>.

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>).

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