pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Daniel Browning <db@kavod.com>
To: pgsql-admin@postgresql.org
Cc: Daniel Browning <db@kavod.com>
Subject: Backup when the database is missing all of the pg_* tables
Date: Thu, 5 May 2005 11:17:54 -0700
Message-ID: <20050505181754.GA9167@kavod.com> (raw)

How can I backup a database (for restoration) when it is missing all of the
pg_* tables?  

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@postgresql.org/msg11191.html

Unfortunately, I didn't notice the problem until after the database had new
data added to it.  I need to backup the database and recreate it with initdb,
but pg_dump doesn't work:

relation "pg_user" does not exist

I tried "--data-only --no-owner --no-privileges" to no avail.  I can still do
'\d <table>' and 'COPY <table> to ...', which is enough to get the information
needed for a minimal dump, so it's theoretically possible.

If there isn't a way to do this already, I'm going to build the schema from a
backup, and then write a script that will COPY each table, then COPY them back
after the initdb.

Thanks,
-- 
Daniel Browning <db@kavod.com> - Kavod Technologies.  Random Fortune:
Consider well the proportions of things.  It is better to be a young June-bug
than an old bird of paradise.
		-- Mark Twain, "Pudd'nhead Wilson's Calendar"



view thread (2+ messages)  latest in thread

Message-ID: <20050505181754.GA9167@kavod.com>
Permalink:  ../20050505181754.GA9167@kavod.com/
Also on:    postgresql.org/message-id/20050505181754.GA9167@kavod.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: db@kavod.com
  Subject: Re: Backup when the database is missing all of the pg_* tables
  In-Reply-To: <20050505181754.GA9167@kavod.com>
  References: <20050505181754.GA9167@kavod.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox