Restore Postgresql database from table files Is it possible to restore a Postgres database when only having access to the table files under $PGDATA/base/&lt;db_oid&gt;? 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.
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/&lt;db_oid&gt;

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.