Thread: pg_dump
Hi!
How can I please a directory folder where my backup files will be placed? I am calling pg_dump
C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p 5433 -U postgres -f add.sql --column-inserts -t address my_db
C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p 5433 -U postgres -f phone.sql --column-inserts -t phone my_db
I tried these but did not work.
C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p 5433 -U postgres -f C:\dbbackup13092011\add.sql --column-inserts -t address my_db
C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p 5433 -U postgres -f C:\dbbackup13092011\phone.sql --column-inserts -t phone my_db
C:\dbbackup does not exist yet.
Please advise.
Thanks and Regards,
Rogel
On 09/12/11 7:40 PM, Rogel Nocedo wrote: > > C:\dbbackup does not exist yet. > > Please advise. > make the directory first. you can't write a file to a nonexistent directory. -- john r pierce N 37, W 122 santa cruz ca mid-left coast
On 13/09/2011 03:40, Rogel Nocedo wrote: > Hi! > > How can I please a directory folder where my backup files will be > placed? I am calling pg_dump > > C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p > 5433 -U postgres -f add.sql --column-inserts -t address my_db > > C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p > 5433 -U postgres -f phone.sql --column-inserts -t phone my_db > > I tried these but did not work. > > C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p > 5433 -U postgres -f C:\dbbackup13092011\add.sql --column-inserts -t > address my_db > > C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_dump -i -h localhost -p > 5433 -U postgres -f C:\dbbackup13092011\phone.sql --column-inserts -t > phone my_db > > C:\dbbackup does not exist yet. You need to create the directory first - pg_dump won't create it for you. BTW, if you're running a 64-bit OS (from the paths above), there's a 64-bit Windows version of PG. -- Raymond O'Donnell :: Galway :: Ireland rod@iol.ie
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
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
> 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
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
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
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
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
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
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
problem solved,C:\Program Files\pgadmin\bin>pg_dump -U postgres host -p port -C -f c:\bb\db_1 db_2thento import i used psqlOn 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
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