1

Is it possible to restore a Postgres database when only having access to the table files under $PGDATA/base/<db_oid>? The system catalogs are empty.

Background

Somebody with sudo executed an rm -Rf under /var/lib. Random files where deleted, but not the ones of the database I am interested in. Postgres would not start, even after I restored several files/directories by hand. So I created a new $PGDATA and copied the database files in, hoping that Postgres would automatically read them. Apparently, Postgres relies a lot on its system catalogs to maintain links between what is on disk and what the user sees.

  • Without the commit log and the global tablespace, it will take an expert to extract anything. – Laurenz Albe Apr 9 at 6:59
0

This doesn't sound promising. Do you know how you got into this predicament?

What specific system tables are empty? A good chunk of the system catalogs are located inside $PGDATA/base/<db_oid>

Do you have any recent backups that could be used to splice together whatever it is that you are missing?

Of course the first step it to make a backup of the current state of things, so if you somehow make things even worse you can go back and try again.

| improve this answer | |
  • Thanks! I 've updated the question with some background info. – Georgios Gousios Apr 8 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.