How do I restore three items from a backup made using Heroku PG Backups?

风流意气都作罢 提交于 2019-12-25 03:16:14

问题


I've got a Rails app running on Heroku and installed the free pgbackups addon.

There's three records I'd like to restore from the backup.

According to Heroku docs when you do a restore, it restores the whole database.

How do I restore just these three records?


回答1:


Create a new database, load the pgbackup into it, and then cherry pick what you want out of it.




回答2:


As far as I know Heroku is using what's referred to as the "-Fc" format for everything, which is described in the pg_dump section of the manual as the custom format. That can't be read by anything but pg_restore, so you're limited to what it knows how to do. You can get pg_restore to only process a single table, which can speed things up if your database is big and you only care about a few records in one table. But there's no way to only get a few records restored out of there; you'll have to restore the entire table they're in and then dump them back out.



来源:https://stackoverflow.com/questions/8536300/how-do-i-restore-three-items-from-a-backup-made-using-heroku-pg-backups

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!