Re: Backup when the database is missing all of the pg_* tables

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Daniel Browning <db(at)kavod(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Backup when the database is missing all of the pg_* tables
Date: 2005-05-07 04:40:00
Message-ID: 28999.1115440800@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Daniel Browning <db(at)kavod(dot)com> writes:
> I've been bitten by the "SELinux silently ruins initdb" bug as reported by Tom
> Lane: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=149237 and another
> user: http://www.mail-archive.com/pgsql-bugs(at)postgresql(dot)org/msg11191.html

While I have not tried to get out of that situation myself, I think it
should be doable. The basic point is that the SELinux bug^H^H^Hsecurity
policy prevented certain parts of the initdb script from taking effect;
in particular those that created system views such as pg_user. So what
you gotta do is execute those CREATE VIEW commands by hand as superuser,
and then pg_dump should work. I think.

The parts of initdb that were foiled are the parts that look like
postgres <<EOF
... SQL script here ...
EOF
I suspect that not all these parts absolutely have to be redone to get
to a state where pg_dump will work, but it might be easiest to just
do 'em all.

Note that you should "SET search_path = pg_catalog" in order to
duplicate the state that is set up by the parameters the initdb script
passes to postgres.

If you are feeling like this might take a bit of experimentation to get
right, I quite agree. I *strongly* recommend that you shut down the
postmaster and then make a tarball backup of /var/lib/pgsql/data before
you start trying any of this stuff. Then you can go back to the backup
as needed till you get it right.

Good luck! Please keep notes and post here with details if it works
(or not). You're probably not the only one in this fix.

regards, tom lane

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Eisentraut 2005-05-07 10:43:34 Re: ERROR: relation "mytable" does not exist
Previous Message Nikhil Parva 2005-05-07 04:18:37 Unsusbscribe