Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2010
    Posts
    2

    Unanswered: Recovering DB from copied folder?

    Hi there, I'm not an expert when it comes to stuff like this, so please bear with me at times.

    Anyways, I recently had to format my system partition and didnt backup my DB, but instead made a mirrored copy when just backing up all files.
    Now I've spent quite some time trying to recover my old DB from these raw files. I was using 8.3 so I made sure to get that version and encountered various errors.
    I tried to

    • just install a fresh version, delete the /data folder and replace it with the old one resulting in the service being unable to start at all.


    • install the fresh version into a directory containng the old /data folder, got an error message saying the data folder already existing was from an older version and initdb could not be performed, I installed anyway and wasnt able to start service again.


    • install a fresh version, redirect it to the old /data by both altering the postgresql.config and changing the -D value in regedigt, resulting in the service being unable to start, again.


    So, is there something I'm doing terribly wrong? If it is in fact impossible to recover my DB like this, is there any way to actually get a backup-file without the service running just from the files itself?

    Any help is greatly appreciated!

  2. #2
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by tozzy View Post
    Anyways, I recently had to format my system partition and didnt backup my DB, but instead made a mirrored copy when just backing up all files.
    That will only work, if Postgres was not running when you took the backup.
    If Postgres was running, then I guess you are out of luck.

    just install a fresh version, delete the /data folder and replace it with the old one resulting in the service being unable to start at all.
    That should work (did it myself already), but only if Postgres was not running when you took the backup.

    You also need to make sure the Postgres operating user account has write access to that directory. If you copied the directory using a different user, then most probably the permissions are screwed up.

  3. #3
    Join Date
    Apr 2010
    Posts
    2
    Thanks for the reply.

    I'm 99% sure postgres was indeed running at that time, meh .
    I edited the user settings for that directory specifically, so yeah, postgres had the same level of access as in a fresh installation.

    Is there any chance to extract valuable information from the files?

  4. #4
    Join Date
    Nov 2003
    Posts
    2,935
    Provided Answers: 12
    Quote Originally Posted by tozzy View Post
    Is there any chance to extract valuable information from the files?
    No, I don't think so.

    The files that you copied are incomplete and inconsistent, so I doubt there is a way to recover from the broken backup.

  5. #5
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    I agree that the data may not be recoverable. However, to be sure, you may want to ask this question on the PostgreSQL Mailing Lists.
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •