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.

asked Apr 8, 2020 at 20:48
1
  • Without the commit log and the global tablespace, it will take an expert to extract anything. Commented Apr 9, 2020 at 6:59

1 Answer 1

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.

answered Apr 8, 2020 at 21:35
1
  • Thanks! I 've updated the question with some background info. Commented Apr 8, 2020 at 21:40

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.