Thread: Move a database from one server to other
Hello, I have to move all the data in my actual server to the new one. I have several databases in postgresql, and I'd like to know the best way to move them. I thoung that maybe copying all the data directory... but I'm not sure, and I don't know where it's stored. I'd apreciate your help. Thank you very much.
> Hello, I have to move all the data in my actual server to the new one. > I have several databases in postgresql, and I'd like to know the best way > to > move them. > I thoung that maybe copying all the data directory... but I'm not sure, > and I > don't know where it's stored. > I'd apreciate your help. > > Thank you very much. Only copy the data directory if both servers are offline and not running and if both servers use the same version of postgres. This method is not recommended AFAIK. It is much much safer to use pg_dump/pg_restore and know that your data is consistent. http://www.postgresql.org/docs/8.2/static/backup-dump.html Nick
Nicholas Barr writes: > It is much much safer to use pg_dump/pg_restore and know that your data is > consistent. > http://www.postgresql.org/docs/8.2/static/backup-dump.html In particular look at the section 23.1.2. Using pg_dumpall That will copy your entire data set including users.
On Jun 25, 2007, at 10:44 , Nicholas Barr wrote: > Only copy the data directory if both servers are offline and not > running > and if both servers use the same version of postgres. ... and have the same architecture. As you note, copying the data directory is *not* the recommended way to do this. Use pg_dump[all] or something like Slony. Michael Glaesemann grzm seespotcode net
In article <24916.62.244.190.66.1182786241.squirrel@www.chuckie.co.uk>, Nicholas Barr <nicky@chuckie.co.uk> wrote: % Only copy the data directory if both servers are offline and not running % and if both servers use the same version of postgres. This method is not % recommended AFAIK. It _is_ recommended for setting up a warm-standby server (it's the only way). I copy database clusters around all the time. If the database is shut down, there's no harm in it and it's usually faster and always simpler than dump/restore. Copying a snapshot of a running system only has a teenly little bit of harm in it and you don't even have to shut down the db. -- Patrick TJ McPhee North York Canada ptjm@interlog.com