Re: Upgrading from 8.0 to 8.1 on Debian

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Assad Jarrahian <jarraa(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Upgrading from 8.0 to 8.1 on Debian
Date: 2005-11-19 03:52:22
Message-ID: 1132372342.7039.17.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 2005-11-18 at 13:49 -0700, Assad Jarrahian wrote:
> Hi All,
> I am a bit stumped. So I have a couple of Postgresql versions on my
> server, namely 8.0 and 8.1 (using Debian package manager). I am trying
> to get 8.1 to be the default database and delete 8.0
>
> I used pg_dump to dump my db's into a file (Question: Where do I dump
> the data of the tables in the db?).

?? The data is included in the dump. Put it anywhere that has room for
it all. In fact, you should use pg_dumpall, otherwise you lose the
user/group information. But in fact you don't need to do this, except
as insurance...

> I tried running pg_upgradecluster as shown below, and I get an error.
>
> jarraa(at)proximity:/etc/postgresql-common$ sudo pg_upgradecluster 8.0 main
> Error: target cluster 8.1/main already exists
>
> I went through /usr/share/doc/postgresql-common/architecture.html and
> am a little lost.
>
> What would be the step by step process in this case? I would like to
> backup the db (plus its data), then point everything to the new
> Postgresql version and get all my db's on to that.

...pg_upgradecluster is the way to go.

First, if you have nothing yet in 8.1/main, use pg_dropcluster to get
rid of it:

/etc/init.d/postgresql-8.1 stop
pg_dropcluster 8.1 main

(I do two separate commands, rather than use --stop-server, for fear
that a typo might destroy the wrong database!)

If you already have data in 8.1, stop its server and rename the cluster
by changing its name:

mv /etc/postgresql/8.1/main /etc/postgresql/8.1/newname

and alter its postgresql.conf to give it an appropriate port - not 5432.

After that:

pg_upgradecluster 8.0 main

will do the job, including renumbering the ports so that 8.1/main is the
default. Check that it is working and then use pg_dropcluster to
destroy the old one.

These commands have to be run as root; postgres does not have sufficient
permissions to modify the configuration files.

--
Oliver Elphick olly(at)lfix(dot)co(dot)uk
Isle of Wight http://www.lfix.co.uk/oliver
GPG: 1024D/A54310EA 92C8 39E7 280E 3631 3F0E 1EC0 5664 7A2F A543 10EA
========================================
Do you want to know God? http://www.lfix.co.uk/knowing_god.html

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ron Mayer 2005-11-19 07:41:35 Re: [ANNOUNCE] Sun supporting PostgreSQL
Previous Message Tom Lane 2005-11-19 03:38:00 Re: Postgres Disconnection problems