SQL 在 PostgreSQL 中恢复已删除的记录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20113586/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 23:10:36  来源:igfitidea点击:

Restore deleted records in PostgreSQL

sqldatabasepostgresql

提问by v0ld3m0rt

I accidentally deleted all the records from 3 tables in PostgreSQL. How can i restore the data?

我不小心删除了 PostgreSQL 中 3 个表中的所有记录。我怎样才能恢复数据?

回答by Craig Ringer

This is a similar problem as discussed here:

这是与此处讨论的类似问题:

Can I rollback a transaction I've already committed? (data loss)

我可以回滚我已经提交的事务吗?(数据丢失)

Basically, restore from backup. If you can't, you mightbe able to recover with pg_dirtyread.

基本上,从备份中恢复。如果不能,您可以使用pg_dirtyread.

If you don't have backups, stop the whole server, take a disk image of the drive, and contact a $lots data recovery expert.

如果您没有备份,请停止整个服务器,获取驱动器的磁盘映像,并联系 $lots 数据恢复专家。