pg_dump

Started by Ramesh Tover 11 years ago12 messagesgeneral
Jump to latest
#1Ramesh T
rameshparnanditech@gmail.com

hi,
i need to export a file the database
postgres
pg_dump -U postgres -C -Fp -f c:/backup/db2.dump db_1;

where i can run pg_dump
please send me details

i want to export db_1 to db2
i got an error below

postgres=# pg_dump -U postgres -C -Fp -f c:/backup/db_2.dump
db_1;
ERROR: syntax error at or near "pg_dump"
LINE 1: pg_dump -U postgres -C -Fp -f c:/backup/db_2du...

i'm using putty to connect host
how to bash to c:\..?

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Ramesh T (#1)
Re: pg_dump

On 12/16/2014 07:29 AM, Ramesh T wrote:

hi,
i need to export a file the database
postgres
pg_dump -U postgres -C -Fp -f c:/backup/db2.dump db_1;

where i can run pg_dump
please send me details

i want to export db_1 to db2
i got an error below

postgres=# pg_dump -U postgres -C -Fp -f c:/backup/db_2.dump
db_1;
ERROR: syntax error at or near "pg_dump"
LINE 1: pg_dump -U postgres -C -Fp -f c:/backup/db_2du...

Are you trying this from inside psql?

If so pg_dump is a command line program and needs to be from the shell
terminal not inside psql.

i'm using putty to connect host
how to bash to c:\..?

That would depend on where your Postgres server is relative to the c:\
drive.

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Ramesh T (#1)
Re: pg_dump

On 12/16/2014 07:52 AM, Ramesh T wrote:
CCing list.

1.
-bash-4.1$ pg_dump -C -Fp -f C:\backup\db_1.dump db_2

how to export and where i can save export file

Per my previous post:

That would depend on where your Postgres server is relative to the c:\
drive.

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Karsten Hilbert
Karsten.Hilbert@gmx.net
In reply to: Adrian Klaver (#3)
Re: pg_dump

On 12/16/2014 07:52 AM, Ramesh T wrote:

1. -bash-4.1$ pg_dump -C -Fp -f C:\backup\db_1.dump db_2

I doubt that you'll have much success pg_dumping to a Windows path when
running from within a UNIX shell ?

I didn't see the beginning of this thread -- are you running bash under
Windows by way of Cygwin or some such ?

Karsten

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#5Ramesh T
rameshparnanditech@gmail.com
In reply to: Adrian Klaver (#3)
Re: pg_dump

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

On Tue, Dec 16, 2014 at 9:25 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

Show quoted text

On 12/16/2014 07:52 AM, Ramesh T wrote:
CCing list.

1.

-bash-4.1$ pg_dump -C -Fp -f C:\backup\db_1.dump db_2

how to export and where i can save export file

Per my previous post:

That would depend on where your Postgres server is relative to the c:\
drive.

--
Adrian Klaver
adrian.klaver@aklaver.com

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Ramesh T (#5)
Re: pg_dump

On 12/16/2014 08:17 AM, Ramesh T wrote:

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

Previously you where using PuTTY to log in to the machine with the
Postgres server, so I assume it is not running on the Windows machine.
If that is the case doing the above is bound to fail. What the error is
telling you is that pg_dump cannot find a Postgres instance listening
where you told it to go. Bottom line is you need to be more accurate in
what you are doing.

So:

1) Back to my first post; "That would depend on where your Postgres
server is relative to the c\ drive."

What machine is the Postgres server located on?

What machine are you trying to connect from?

Everything you posted relates to the above. These questions need to be
answered before we can go any further.

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#7Ramesh T
rameshparnanditech@gmail.com
In reply to: Adrian Klaver (#6)
Re: pg_dump

I'm installed pgadmin 3 on windows I'm trying to connect server.the server
is on Linux.now I'm trying pgdump from windows from using putty connected
to Linux Postgres server..also last mail I sent trying from windows local
c:\... :)
On Wednesday, December 17, 2014, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

Show quoted text

On 12/16/2014 08:17 AM, Ramesh T wrote:

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

Previously you where using PuTTY to log in to the machine with the
Postgres server, so I assume it is not running on the Windows machine. If
that is the case doing the above is bound to fail. What the error is
telling you is that pg_dump cannot find a Postgres instance listening where
you told it to go. Bottom line is you need to be more accurate in what you
are doing.

So:

1) Back to my first post; "That would depend on where your Postgres server
is relative to the c\ drive."

What machine is the Postgres server located on?

What machine are you trying to connect from?

Everything you posted relates to the above. These questions need to be
answered before we can go any further.

--
Adrian Klaver
adrian.klaver@aklaver.com

#8Ramesh T
rameshparnanditech@gmail.com
In reply to: Ramesh T (#7)
Re: pg_dump

Please let me know what happend inside ..?

On Wednesday, December 17, 2014, Ramesh T <rameshparnanditech@gmail.com>
wrote:

Show quoted text

I'm installed pgadmin 3 on windows I'm trying to connect server.the server
is on Linux.now I'm trying pgdump from windows from using putty connected
to Linux Postgres server..also last mail I sent trying from windows local
c:\... :)
On Wednesday, December 17, 2014, Adrian Klaver <adrian.klaver@aklaver.com
<javascript:_e(%7B%7D,'cvml','adrian.klaver@aklaver.com');>> wrote:

On 12/16/2014 08:17 AM, Ramesh T wrote:

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

Previously you where using PuTTY to log in to the machine with the
Postgres server, so I assume it is not running on the Windows machine. If
that is the case doing the above is bound to fail. What the error is
telling you is that pg_dump cannot find a Postgres instance listening where
you told it to go. Bottom line is you need to be more accurate in what you
are doing.

So:

1) Back to my first post; "That would depend on where your Postgres
server is relative to the c\ drive."

What machine is the Postgres server located on?

What machine are you trying to connect from?

Everything you posted relates to the above. These questions need to be
answered before we can go any further.

--
Adrian Klaver
adrian.klaver@aklaver.com

#9Ramesh T
rameshparnanditech@gmail.com
In reply to: Ramesh T (#8)
Re: pg_dump

problem solved,

C:\Program Files\pgadmin\bin>pg_dump -U postgres host -p port -C -f
c:\bb\db_1 db_2
then
to import i used psql

On Wed, Dec 17, 2014 at 10:44 AM, Ramesh T <rameshparnanditech@gmail.com>
wrote:

Show quoted text

Please let me know what happend inside ..?

On Wednesday, December 17, 2014, Ramesh T <rameshparnanditech@gmail.com>
wrote:

I'm installed pgadmin 3 on windows I'm trying to connect server.the
server is on Linux.now I'm trying pgdump from windows from using putty
connected to Linux Postgres server..also last mail I sent trying from
windows local c:\... :)
On Wednesday, December 17, 2014, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

On 12/16/2014 08:17 AM, Ramesh T wrote:

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

Previously you where using PuTTY to log in to the machine with the
Postgres server, so I assume it is not running on the Windows machine. If
that is the case doing the above is bound to fail. What the error is
telling you is that pg_dump cannot find a Postgres instance listening where
you told it to go. Bottom line is you need to be more accurate in what you
are doing.

So:

1) Back to my first post; "That would depend on where your Postgres
server is relative to the c\ drive."

What machine is the Postgres server located on?

What machine are you trying to connect from?

Everything you posted relates to the above. These questions need to be
answered before we can go any further.

--
Adrian Klaver
adrian.klaver@aklaver.com

#10Ramesh T
rameshparnanditech@gmail.com
In reply to: Ramesh T (#9)
Re: pg_dump

is their any other method to clone database,other then pgadmin and pgdump..
if is their option pls let me know..

On Wed, Dec 17, 2014 at 4:35 PM, Ramesh T <rameshparnanditech@gmail.com>
wrote:

Show quoted text

problem solved,

C:\Program Files\pgadmin\bin>pg_dump -U postgres host -p port -C -f
c:\bb\db_1 db_2
then
to import i used psql

On Wed, Dec 17, 2014 at 10:44 AM, Ramesh T <rameshparnanditech@gmail.com>
wrote:

Please let me know what happend inside ..?

On Wednesday, December 17, 2014, Ramesh T <rameshparnanditech@gmail.com>
wrote:

I'm installed pgadmin 3 on windows I'm trying to connect server.the
server is on Linux.now I'm trying pgdump from windows from using putty
connected to Linux Postgres server..also last mail I sent trying from
windows local c:\... :)
On Wednesday, December 17, 2014, Adrian Klaver <
adrian.klaver@aklaver.com> wrote:

On 12/16/2014 08:17 AM, Ramesh T wrote:

C:\Program Files\pgAdmin III\1.14>pg_dump -U postgres -p 5432 -C -f
c:\backup\db_2.dump db_1;
pg_dump: [archiver (db)] connection to database "db_1;"

failed: coul
d not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Connection refused (0x0000274D/10061)
Is the server running on host "localhost" (127.0.0.1) and

accepting
TCP/IP connections on port 5432?

is it right excution process ,if it is yes 5432..?

Previously you where using PuTTY to log in to the machine with the
Postgres server, so I assume it is not running on the Windows machine. If
that is the case doing the above is bound to fail. What the error is
telling you is that pg_dump cannot find a Postgres instance listening where
you told it to go. Bottom line is you need to be more accurate in what you
are doing.

So:

1) Back to my first post; "That would depend on where your Postgres
server is relative to the c\ drive."

What machine is the Postgres server located on?

What machine are you trying to connect from?

Everything you posted relates to the above. These questions need to be
answered before we can go any further.

--
Adrian Klaver
adrian.klaver@aklaver.com

#11Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Ramesh T (#10)
Re: pg_dump

On 12/19/2014 01:17 AM, Ramesh T wrote:

is their any other method to clone database,other then pgadmin and pgdump..
if is their option pls let me know..

You will need to be more specific about what you want.

Do you want something like what pg_dump offers, a copy of a database at
a point in time?

Do want a replicated database that exists in close to real time,
concurrently?

Or something else?

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#12Adrian Klaver
adrian.klaver@aklaver.com
In reply to: Ramesh T (#1)
Re: pg_dump

On 12/20/2014 08:23 PM, Ramesh T wrote:

CCing list.

yeah i have following
1 and 2 answers..not something else only those two answers..

Well there is CREATE DATABASE TEMPLATE some_db.

IMPORTANT look at the caveats at bottom of page here:
http://www.postgresql.org/docs/9.3/interactive/sql-createdatabase.html

For replication in the core see here:

http://www.postgresql.org/docs/9.3/interactive/high-availability.html

For other solutions see Table 25-1 here:

http://www.postgresql.org/docs/9.3/interactive/different-replication-solutions.html

On Fri, Dec 19, 2014 at 8:20 PM, Adrian Klaver
<adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>> wrote:

On 12/19/2014 01:17 AM, Ramesh T wrote:

is their any other method to clone database,other then pgadmin
and pgdump..
if is their option pls let me know..

You will need to be more specific about what you want.

Do you want something like what pg_dump offers, a copy of a database
at a point in time?

Do want a replicated database that exists in close to real time,
concurrently?

Or something else?

--
Adrian Klaver
adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>

--
Adrian Klaver
adrian.klaver@aklaver.com

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general