如何在不备份的情况下还原PostgreSQL数据库 [英] how to restore postgresql DB without backup

查看:98
本文介绍了如何在不备份的情况下还原PostgreSQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

忘记进行备份。现在,我的数据库和新系统的硬盘驱动器都带有空的postgres。我可以以某种方式还原数据库吗?通过文件等的简单副本?

Forgot to make a backup. Now I have harddrive with databases and new system with empty postgres. Can I somehow restore databases? by simple copy of files etc?

推荐答案

如果您拥有旧Postgresql的完整 data 目录系统(如果它是相同版本,或者只是版本号不同),您可以尝试将其放置在新的postgresql安装中的 data 目录中。 (当然,在执行此操作之前,请先停止postgres服务器。)

If you have the full data directory of your old postgresql system (and if it was the same version, or differing only in a revision number) you can just try to put it in place of your data directory in your new postgresql installation. (Of course, stop postgres server before doing this).

升级 PostgreSQL,无需进行备份还原。

It's basically the same procedure used when upgrading postgresql, when there is no need to do backup-restore.

编辑:正如评论中指出的那样,我不仅假定相同(或几乎相同)的版本,而且假定相同的体系结构(32-64位,Linux-Windows等)

As pointed out in the comments, I assume not only same (or almost same) version, but same architecture (32 - 64 bits , Linux - Windows, etc)

这篇关于如何在不备份的情况下还原PostgreSQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆