Обсуждение: Migrating database (7.1.3 - 7.2.1)

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

Migrating database (7.1.3 - 7.2.1)

От
"Johnson, Shaunn"
Дата:
Howdy:  
 
 Running PostgreSQL 7.1.3 on RedHat Linux 2.4.7-10.  
 
I'm gearing up to build a new database with PostgreSQL
7.2.1 on the same OS / platform.  As I am running low on
disk space, I'm interested  hearing some tips / tricks when
migrating to a new version.
 
My initial plan is this:
 
* Stop the database
* pg_dump the entire database
* Build new version of PostgreSQL, but point it to a new location
--( I think all I have to do is move the pgsql directory to pgsql_old ? )
* create testdb
* pg_restore old db to new db
 
One question is, how do I determine the difference
between the old version and the new version when
I do a pg_restore? Or, is this even an issue?  Doesn't
seem like it should care when I create the new version ...
 
Is there another way to upgrade the current version?
(Currently, I'm looking at the documentation on how to
build the database from scratch, but haven't seen anything
on how to just upgrade the current version).
 
Thanks in advance!
 
-X

Re: Migrating database (7.1.3 - 7.2.1)

От
Andrew Sullivan
Дата:
On Thu, Jul 25, 2002 at 01:32:17PM -0400, Johnson, Shaunn wrote:
>
> * Stop the database
> * pg_dump the entire database

You can't do this.  You can only do pg_dump while postgres is
running.

If you have enough disk space to double your use, then you don't have
to save the pg_dump file: you could run two back ends (one on port
5432, the other on, say, 5234) and just do

    pg_dump -p 5432 [your 7.1 db] | psql -p 5234 [your 7.2 db]

That _should_ work (it's worked so far for me).

If that won't work for you, pipe your pg_dump output through gzip.
Then, stop the database, tar up the data directory (using your
compressor of choice, if you like), and download that to another
location for safekeeping.  Check it twice to make sure it works!  Now
(here's the scary bit) delete the old tree, create a new tree, and
run the pg_dump output file back into the new (7.2) tree.  This way,
if something terrible happens, you can just re-upload your tarball,
untar it in place, and start up like you never tried the upgrade.

A

--
----
Andrew Sullivan                               87 Mowat Avenue
Liberty RMS                           Toronto, Ontario Canada
<andrew@libertyrms.info>                              M6K 3E3
                                         +1 416 646 3304 x110