Re: Upgrade db format without older version of PostgreSQL

From: John R Pierce <pierce(at)hogranch(dot)com>
To: Kelly Jones <kelly(dot)terry(dot)jones(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Upgrade db format without older version of PostgreSQL
Date: 2009-09-29 16:42:38
Message-ID: 4AC238FE.8050007@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Kelly Jones wrote:
> I recently upgraded PostgreSQL, and now this happens:
>
> # /etc/init.d/postgresql start
>
> An old version of the database format was found.
> You need to upgrade the data format before using PostgreSQL.
> See /usr/share/doc/postgresql-8.3.8/README.rpm-dist for more information.
>
> Unfortunately, I upgraded due to a hardware failure, and can't
> dump/undump, since I don't have the old PostgreSQL server anymore.
>
> Can I upgrade the data format w/o installing Postgres 7.2 (my
> "data/base/1/PG_VERSION" file says "7.2")?
>
> If not, can Fedora 11's "yum" install Postgres 7.2 (so I can at least
> do a clean install/uninstall and then re-install 8.3.8)?
>

thats going to be pretty painful, actually.

first, make sure you have a backup of the postgres 7.2 data directory
and everything in it.

2nd, find and build 7.2, configuring it to run in a directory like
/home/pg72/ and restore a copy of your old data directory to
/home/pg72/data. make sure all these files are owned by hte postgres
user. edit the postgresql.conf file in that data dir to use a
different port, like 5433 rather than the default 5432. manually start
this 7.2 server like...

# su postgres -c "/home/pg72/bin/pg_ctl start -D /home/pg72/data"

now, clear the postgres 8.3.8 data directory where you tried to restore
your 7.2 $PGDATA, and create a new 8.3 cluster wiht initdb, and start 8.3...

# rm -rf /var/log/pgsql/data/*
# service postgresql initdb
# service postgresql start

now, try this...

# su - postgres
$ pg_dumpall -p 5433 | psql

and this should dump your 7.2 database using the 8.3.8 pg_dumpall tool,
and restore it to the 8.3.8 database.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2009-09-29 16:50:47 Re: Upgrade db format without older version of PostgreSQL
Previous Message Pavel Stehule 2009-09-29 16:30:42 Re: computed values in plpgsql