有办法检查使用pg_dump的postgres备份(或恢复的数据库)的完整性吗?

时间:2022-09-28 22:47:33

Hi i have a pretty big database running on Postgres 9.3. I backup it up using pg_dump with compression. I am worried that these backups may be corrupted or that i won't be able to restore it properly (using pg_restore), or that restored database is could be corrupted. The database I backup is in constant use so it's pretty hard (if not impossible) to check if restored database is working correctly by comparing rows (and to be honest i don't think that such test would give a result that's meaningful). Is there any way to check integrity of dump file or a restored database ? I read that postgres 9.3 supports checksumming db files, but i don't see how that would help my case.

我有一个很大的数据库运行在Postgres 9.3上。我使用带压缩的pg_dump进行备份。我担心这些备份可能被损坏,或者无法正确地恢复它(使用pg_restore),或者恢复的数据库可能被损坏。数据库I备份一直在使用,因此通过比较行来检查还原的数据库是否正常工作(说实话,我认为这样的测试不会产生有意义的结果)非常困难(如果不是不可能的话)。是否有办法检查转储文件或恢复的数据库的完整性?我读到postgres 9.3支持checksumming db文件,但是我不知道这对我的情况有什么帮助。

1 个解决方案

#1


2  

Corruption is usually in the form of bad data that won't restore (character set weirdness and the like). I think the best you can do is automatically restore to a test db. If that process succeeds, you are likely ok.

损坏通常以无法恢复的坏数据的形式出现(字符集怪异等等)。我认为最好的方法是自动恢复到测试db。如果这个过程成功了,你很可能还好。

#1


2  

Corruption is usually in the form of bad data that won't restore (character set weirdness and the like). I think the best you can do is automatically restore to a test db. If that process succeeds, you are likely ok.

损坏通常以无法恢复的坏数据的形式出现(字符集怪异等等)。我认为最好的方法是自动恢复到测试db。如果这个过程成功了,你很可能还好。