Обсуждение: PostgreSQL won't start

Поиск
Список
Период
Сортировка

PostgreSQL won't start

От
Laura Horsky
Дата:
I have a PostgreSQL server that was restarted. When it was brought back online, PostgreSQL fails to start with:

....LOG:  database system was interrupted; last known up at ....

....LOG:  unexpected pageaddr 2F/8D000000 in log file 47, segment 159, offset 0

....LOG:  invalid primary checkpoint record

....LOG:  invalid secondary checkpoint record

....PANIC:  could not locate a valid checkpoint record

....LOG:  startup process (PID 20879) was terminated by signal 6: Aborted....LOG:  aborting startup due to startup process failure


I have pg_dumps that were taken prior to failure that I can restore to if I can get PostgreSQL running again.

How can I fix PostgreSQL? I have seen pg_resetxlog but there are so many warnings, I want to make sure that this is the tool to use.

Thanks.
Laura

Re: PostgreSQL won't start

От
Kevin Grittner
Дата:
Laura Horsky <lhorsky@gwoslabs.com> wrote:

> I have a PostgreSQL server that was restarted. When it was
> brought back online,

That is pretty vague.  Exactly how was it restarted?  How was it
brought back online?  Was it really just that, or was this a
restore from backup or a copy on a new machine?

Exactly what version of PostgreSQL is this?

> PostgreSQL fails to start with:
>
> ....LOG:  database system was interrupted; last known up at ....

You didn't get a clean shutdown of the database server, so
something was done that was not optimal.  We can't give very
detailed advice without knowing what.  By the way, seeing
timestamps for the startup and the "last known up at" times would
provide at least some clue what might have happened.

> I have pg_dumps that were taken prior to failure that I can
> restore to if I can get PostgreSQL running again.

That's good.  If you wrangle what you have into starting you should
hang onto those dumps for a while (maybe a few months) after you
are running again.  You may need to fish some data out of them if
you later see corruption or missing data.

> How can I fix PostgreSQL? I have seen pg_resetxlog but there are
> so many warnings, I want to make sure that this is the tool to
> use.

First thing is to make a filesystem-level copy of the $PGDATA
directory tree, in case your recovery attempts make things worse.
pg_resetxlog may well allow the database to start, but you should
heed the warnings about pg_dump and restore of the result to
eliminate hidden corruption, and review after that to look for
damaged or missing data.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company