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: (view raw, whole thread or download thread mbox)
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.



Mo Holkar
Digital Mind Games -- log on to take over

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-2017 The PostgreSQL Global Development Group