简体   繁体   中英

Heroku: download and restore database

My heroku rails app has following database settings for production

default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

production:
  <<: *default
  database: db/production.sqlite3

As you can see there is no password in the database. I downloaded the database with the commands

heroku pg:backups:capture    
heroku pg:backups:download

Now I want to restore the database, which command should I run to restore the database?

This is what worked for me

pg_restore -d myapp_development -U rails_dev -C latest.dump

Here, my local development database myapp_development , local database username rails_dev and latest.dump is the backup database file downloaded from server. Command above ask for a password which should be the password associated with user rails_dev.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM