Re: Transfer db from one port to another

From: "Charles Clavadetscher" <clavadetscher(at)swisspug(dot)org>
To: "'Killian Driscoll'" <killiandriscoll(at)gmail(dot)com>, "'John R Pierce'" <pierce(at)hogranch(dot)com>
Cc: "'pgsql-general'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Transfer db from one port to another
Date: 2015-12-23 10:30:33
Message-ID: 024001d13d6c$fb56ff40$f204fdc0$@swisspug.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of Killian Driscoll
Sent: Mittwoch, 23. Dezember 2015 11:26
To: John R Pierce <pierce(at)hogranch(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: [GENERAL] Transfer db from one port to another

On 23 December 2015 at 11:19, Killian Driscoll <killiandriscoll(at)gmail(dot)com <mailto:killiandriscoll(at)gmail(dot)com> > wrote:

On 23 December 2015 at 11:07, John R Pierce <pierce(at)hogranch(dot)com <mailto:pierce(at)hogranch(dot)com> > wrote:

On 12/23/2015 1:40 AM, Killian Driscoll wrote:

Try it with plain pg_dump.

pg_dump -h localhost -p 5432 -Fc <dbname> > dump.sql

pg_restore -h localhost -p 5532 dump.sql

I tried this, but nothing appears to happen when entering the commands. Attached is a screenshot of the shell window - what am I doing wrong?

those are system shell commands, not psql sql commands. catch-22, in the windows environment, postgresql's command tools probably aren't in the path, so to execute the above commands try this...

start -> run -> CMD <enter>

(or, click on an 'Command Prompt' shortcut).

C:\Users\YourName> path "c:\Program Files\PostgreSQL\9.4\bin";%path%
C:\Users\YourName> pg_dump -Fc -p 5432 <dbname> | pg_restore -p 5532

Thanks. When I do this I get an error: could not find a "pg_dump" to execute - I've used the path "C:\Program Files\PostgreSQL\9.3\bin";%path% which appears to be correct

Sorry, forgot to add: once I get the warning that the Pg_dump can't be found there is then a password prompt; I tried the db password and the pc password but both fail:

Password:
pg_dump: [archiver (db)] connection to database "irll_project" failed: FATAL: p
assword authentication failed for user "killian"

Do you have a user killian in the database? If not you can either create it or use pg_dump with the –U switch to set it to the existing user (and with privileges on the database of course).

pg_restore: [archiver] input file is too short (read 0, expected 5)

if your postgres is installed somewhere else, replace "c:\Program Files\PostgreSQL\9.4\bin" in the PATH command with its actual location \bin ....

--
john r pierce, recycling bits in santa cruz

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2015-12-23 10:36:44 Re: Transfer db from one port to another
Previous Message John R Pierce 2015-12-23 10:30:09 Re: Transfer db from one port to another