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

Re: moving postgres data

From: Mo Holkar <pgsql(at)digitalmindgames(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: moving postgres data
Date: 2001-10-31 09:46:46
Message-ID: 5.1.0.14.2.20011031094122.04a02910@pop.ntlworld.com (view raw or flat)
Thread:
Lists: pgsql-novice
At 09:17 31/10/01, you wrote:
>I have data in a postgres database on one server and have to move it to a
>new server that has been set up with a new version of postgres.  The
>database is an exact copy. what is the best way of moving the thing across?
>do i set up the tables on the new box and write scripts to move it across or
>is there another way of doing this?


Easiest way would be to dump the database to a text file:

   % pg_dump yourdatabase > /path/to/dumpfile

copy it to the new server, and read it to an empty database using psql -e:

   % psql -e yourdatabase < /newpath/to/dumpfile

This way all the schema are recreated, and the data loaded into them, 
automatically -- you don't have to set anything up by hand. See the 
documentation on pg_dump for more information.

best,

Mo




Mo Holkar
Digital Mind Games -- log on to take over
mo(dot)holkar(at)digitalmindgames(dot)com
http://www.digitalmindgames.com


pgsql-novice by date

Next:From: Einar KarttunenDate: 2001-10-31 09:51:31
Subject: Re: moving postgres data
Previous:From: Duncan Adams (DNS)Date: 2001-10-31 09:17:01
Subject: moving postgres data

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