Skip site navigation (1) Skip section navigation (2)

Re: how to replicate a database from one machine to the other?

From: Shane Ambler <pgsql(at)Sheeky(dot)Biz>
To: P Kapat <kap4lin(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: how to replicate a database from one machine to the other?
Date: 2008-06-26 03:10:49
Message-ID: 486308B9.8040503@Sheeky.Biz (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
P Kapat wrote:
> A total novice here!
> Machine A: Kubuntu 8.04 has the required database under user userA
> Machine B: RHEL 5 is the destination machine with userB
> I want to transfer the entire database under userA from machine A to
> user B under machine B. Is that possible?

If the MachineB postgres version is older then you may have problems.

pg_dump machineadb > madb.sql

copy madb.sql across to machineB

psql < madb.sql

This would make a copy of the database named machineadb, if you want 
every db on the server then you can use pg_dumpall

You may need options like -U -h and -W (username/host/prompt for 
password) man psql or man pg_dump for more detail

Feel free to compress the file to reduce transfer times etc.

You can also reduce it to one step -

pg_dump machineadb | psql -h remotename


Shane Ambler
pgSQL (at) Sheeky (dot) Biz

Get Sheeky @ http://Sheeky.Biz

In response to


pgsql-novice by date

Next:From: Shane AmblerDate: 2008-06-26 03:31:11
Subject: Re: editing pg_hba.conf
Previous:From: Devrim GÜNDÜZDate: 2008-06-25 23:49:56
Subject: Re: yum repos problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group