从原始物理文件恢复postgreSQL数据库 [英] Recover postgreSQL databases from raw physical files

查看:320
本文介绍了从原始物理文件恢复postgreSQL数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下问题,我需要知道是否有解决方法。

I have the following problem and I need to know if there´s a way to fix it.

我有一个客户端足够便宜,拒绝购买备份计划他的postgreSQL数据库在运行他的公司的主要系统,并且我认为它会发生一些天,一些操作系统文件在停电期间崩溃,并且操作系统需要重新安装。

I have a client who was cheap enough to decline buying a backup plan for his postgreSQL databases on the main system that runs his company and as I thought it would happen some day, some OS files crashed during a blackout and the OS needs to be reinstalled.

此客户端没有数据库的任何备份,但我设法保存PostgreSQL主目录。我读到数据库以某种方式存储在postgres主文件夹的数据目录中。

This client didn't have any backups of the databases but I managed to save the PostgreSQL main directory. I read that the databases are stored somehow inside the data directory of the postgres main folder.

我的问题是:有没有办法从数据文件夹中恢复数据库?我在一个Windows环境(XP服务包2)与PostgreSQL 8.2工作,我需要重新安装PostgreSQL在一个新的服务器。我需要在新环境中重新创建数据库,并以某种方式将旧文件附加到新的数据库实例。我知道这是可能的SQL Server,因为引擎存储数据库的方式,但我没有在postgres的线索。

My question is: Is there any way to recover the databases from the data folder only? I am working in a windows environment (XP service pack 2) with PostgreSQL 8.2 and I need to reinstall PostgreSQL in a new server. I would need to recreate the databases in the new environment and somehow attach the old files to the new database instances. I know that's possible in SQL Server because of the way that engine stores the databases but I have no clue in postgres.

任何想法?

推荐答案

如果你有整个数据文件夹,你有你需要的一切(只要架构是一样)。只需尝试恢复它在另一台机器上擦除这一个,以防万一你没有复制的东西。

If you have the whole data folder, you have everything you need (as long as architecture is the same). Just try restoring it on another machine before wiping this one out, in case you didn't copy something.

只需将数据目录保存到磁盘。启动Postgres时,设置参数告诉数据目录所在的位置(请参阅: wiki.postgresql.org < a>)。或删除全新安装的原始数据目录,并将副本放在其位置。

Just save the data directory to disk. When launching Postgres, set the parameter telling it where the data directory is (see: wiki.postgresql.org). Or remove original data directory of the fresh installation and place the copy in its place.

这篇关于从原始物理文件恢复postgreSQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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