Search Postgresql Archives

Re: Automating Backup & Restore

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan de Visser wrote:
On Wednesday 24 October 2007 10:39:23 smiley2211 wrote:

Does someone have a script that backups a database from one server and restores it to another server??? I am NEW to Postgresql so I am starting from scratch...


$ pg_dump -h server1 database | psql -h server2

jan


Further to this, Shane Ambler posted this response just yesterday in
response to a similar question:

If you want to copy your database to a development machine occasionally, then if they have the same hardware and postgres version then you should be able to copy the data files across while the production server is stopped without problems. Some differences between CPU and postgres version can stop this from working.

You could also do the dump/restore directly from one machine to another if they are on the same network without having the dump file to transfer across and import which will give similar results.

eg. instead of - pg_dumpall > mybackupfile psql -h my.other.machine.address < mybackupfile

you can -

pg_dumpall | psql -h my.other.machine.address

If you have different cpu's (one Intel and one AMD64) or different postgres versions then you will have to do the dump/restore even if it is sent straight from one to another.

See this thread:
http://archives.postgresql.org/pgsql-general/2007-10/msg01178.php

brian

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org/

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux