Re: Moving postgresql data to another computer - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Moving postgresql data to another computer
Date
Msg-id AANLkTik8R78K6zKlwsPaXRSazgoKNbtP8jzSdTG2LTos@mail.gmail.com
Whole thread Raw
In response to Moving postgresql data to another computer  ("Donald Catanzaro, PhD" <dgcatanzaro@gmail.com>)
List pgsql-general
On Tue, May 11, 2010 at 2:16 PM, Donald Catanzaro, PhD
<dgcatanzaro@gmail.com> wrote:
> Good Day All,
>
> I am a newbie to PostgreSQL and I recently installed it on my desktop
> (Windows XP) I created a database fine and worked a bunch of queries.  I am
> traveling now and I needed access to my database on my laptop (Windows
> Vista).  So before I left, I installed PosgreSQL on the laptop and then
> copied the data in the PostgreSQL data directory over to my laptop.
> I put the data directory from my desktop in a different place on my laptop
> and now I would like to access the data but I can not seem to figure out how
> to do this.
>
> I naively tried to just replace all the files in the data directory on my
> laptop with the files from the data directory of the desktop

It should work if the source and destination are built the same on the
same architecture.  Better to move the old one out of the way though.

> but when I do
> so, I get the following error:  "could not connect to server: Connection
> refused (0x0000274D/10061) Is the server running on host "127.0.0.1" and
> accepting TCP/IP connections on port 5432? "

This could easily be a configuration issue.  Is there a postgres
process running?  If so is it set to listen on 127.0.0.1 or localhost?

> I figure I have at least two options
> Option 1)  Point PostgreSQL on laptop to the directory that desktop data
> lives in

Worth a try.

> Option 2)  Replace the data directory on the laptop with the data directory
> that came from the desktop.

Either one should work.  But I'm a linux guy.

> While I am travelling now (about a month) I eventually will want to move my
> database BACK to the desktop so a solution that makes that transition simple
> would be ideal.

Copy it back over to a clean dir should do it.  OR pg_dump it and
reload it into a new db on the other machine.  Generally speaking dump
/ restore offers fewer chances to shoot yourself in the foot.

pgsql-general by date:

Previous
From: Christoph Zwerschke
Date:
Subject: Re: Finding rows with text columns beginning with other text columns
Next
From: Scott Marlowe
Date:
Subject: Re: Run Vacuum Through JDBC