Thread: Data directory copies...

Data directory copies...

From
Steve Tucknott
Date:
PostGreSQL 7.4.5 RedHat 8

I saw the recent thread re problems when copying databases across machines.

If I have two 'servers' - both RedHat 8, both running PostgreSQL 7.4.5, is is valid (if the postmaster is down on both servers) to simply copy the PGDATA directory from one 'server' to a different (previously emptied) location on the second 'server'? It seems to fire up ok and work 'at first glance' - but I don't want to create any long term problems
.


Regards,

Steve Tucknott

ReTSol Ltd

DDI: 01903 828769

Re: Data directory copies...

From
Tom Lane
Date:
Steve Tucknott <steve@retsol.co.uk> writes:
> If I have two 'servers' - both RedHat 8, both running PostgreSQL 7.4.5,
> is is valid (if the postmaster is down on both servers) to simply copy
> the PGDATA directory from one 'server' to a different (previously
> emptied) location on the second 'server'?

Yes, if the servers are compiled identically on both machines.  (If they
were compiled with different options, the second server should refuse to
start on the copied data directory, so you don't need to be too afraid
of getting burnt.  But you do need to be sure the two machines are of
the same architecture --- don't try this between, say, i386 and PPC, nor
even between 32- and 64-bit models on a 64-bit machine.)

You must copy the whole PGDATA directory tree, of course.

            regards, tom lane