Thursday, January 24, 2013

How to copy postgresql data from heroku production

Steps to get the copy of heroku deployed application database to localhost .

1 step: Create a backup on heroku production
       
           heroku pgbackups:capture --expire

2 step:  Get the latest back up to local by curl method

           curl -o backup.dump `heroku pgbackups:url`
3 step: Restore to localhost database using the followng comand
  
   pg_restore --verbose --clean --no-acl --no-owner -h localhost -d your_database_name  backup.dump