how to restore postgresql DB without backup

Timur Sadykov picture Timur Sadykov · May 9, 2010 · Viewed 8.9k times · Source

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?

Answer

leonbloy picture leonbloy · May 10, 2010

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).

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

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