Re: Some one deleted pg_database entry how to fix it?

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: pg(at)fastcrypt(dot)com
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Some one deleted pg_database entry how to fix it?
Date: 2004-03-16 20:54:33
Message-ID: 1079470473.27668.108.camel@camel
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Try doing a vacuum full on template1 and restart the database. I've had
to do this before after renaming a database via the system catalogs.

Robert Treat

On Tue, 2004-03-16 at 12:05, Dave Cramer wrote:
> Tom,
>
> Thanks, first of all it wasn't my mess, but someone elses.
>
> Secondly this worked however I was unable to use the same name, some
> remnants of the old database must have remained in pg_database.
>
> I couldn't even reindex it with postgres -O -P
>
> Dave
> On Tue, 2004-03-16 at 11:11, Tom Lane wrote:
> > Dave Cramer <pg(at)fastcrypt(dot)com> writes:
> > > psql dbname can still connect but when I go to the pg_database table the
> > > db is not there as a result I cannot do a pg_dump on it?
> >
> > Hm, it doesn't make a lot of sense that fresh connections would still
> > succeed if the pg_database row is deleted, but ...
> >
> > > I tried forcing an entry into pg_database but it won't allow me to set
> > > the oid ?
> >
> > You don't have to; the DB OID doesn't appear anywhere within the
> > database (except possibly with the database comment, if you have one).
> >
> > So:
> >
> > * Determine the old DB OID, by elimination if necessary.
> >
> > * Create a new database and determine its OID.
> >
> > * Shut down postmaster.
> >
> > * Blow away $PGDATA/base/NEWOID, and rename $PGDATA/base/OLDOID to
> > be $PGDATA/base/NEWOID.
> >
> > * Restart postmaster.
> >
> > * Try to figure out what you did wrong, so you don't do it again...
> >
> > regards, tom lane
> >
> --
> Dave Cramer
> 519 939 0336
> ICQ # 14675561
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend

--
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Gavin Sherry 2004-03-16 22:00:37 Re: Some one deleted pg_database entry how to fix it?
Previous Message Manuel Sugawara 2004-03-16 19:44:51 [Pgsql-ayuda] Spanish list hosting request