Обсуждение: Moving a database

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

Moving a database

От
Richard Bortolucci
Дата:
Hi,

What are the correct steps to move an database and from an server running postgreslq 7.4.2 to another running 8.0.3?

--
Richard Bortolucci

Re: Moving a database

От
Jeff Frost
Дата:
If they are both up and running and reachable, then you likely just want to do
something as simple as:

pg_dumpall -h <old host> | psql -h <new host> template1

That's assuming you want to move all the DBs on the first server to the
second.

NOTE: pg_dumpall cannot dump large objects.  If you have these, you'll have to
use another method of migration.

Another good method if you want to limit downtime and have primary keys on
all your tables is to setup slony on both nodes, let the subscription get up
to date and then change roles and bring down the old server.

On Wed, 14 Dec 2005, Richard Bortolucci wrote:

> Hi,
>
> What are the correct steps to move an database and from an server running
> postgreslq 7.4.2 to another running 8.0.3?
>
> --
> Richard Bortolucci
>

--
Jeff Frost, Owner     <jeff@frostconsultingllc.com>
Frost Consulting, LLC     http://www.frostconsultingllc.com/
Phone: 650-780-7908    FAX: 650-649-1954

Re: Moving a database

От
Christopher Browne
Дата:
> What are the correct steps to move an database and from an server
> running postgreslq 7.4.2 to another running 8.0.3?

I'll assume there are two hosts:
 - db7, running 7.4.2, on port 5432, and
 - db8, running 8.0.3 on port 5432.

The simplest method would be thus:

- Stop the applications accessing db7

- On db8, run the command:
   pg_dumpall -h db7 -p 5432 | psql -h localhost -p 5432 template1

That is likely to provide the most nearly "perfect fidelity" copy of
the database on db8.

You may discover that this takes longer than you want it to.

If that proves to be the case, you can shorten the cutover time by
using a replication system such as Slony-I to copy data from the one
host to the other.  That definitely involves more "moving parts" and
more complexity.  But it could turn an 8 hour outage into a 2 minute
one...

You should certainly do test runs of whatever approach you try so as
to minimize the number of surprises.
--
output = reverse("moc.liamg" "@" "enworbbc")
http://linuxdatabases.info/info/slony.html
"...Yet terrible as Unix addiction  is, there are worse fates. If Unix
is the heroin of operating systems, then VMS is barbiturate addiction,
the Mac is MDMA, and MS-DOS is sniffing glue. (Windows is filling your
sinuses  with  lucite and  letting  it set.)   You  owe  the Oracle  a
twelve-step program."  --The Usenet Oracle