Re: pg_dump/psql: Select a server and automate password

From: Adrian Klaver <aklaver(at)comcast(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: Radcon Entec <radconentec(at)yahoo(dot)com>
Subject: Re: pg_dump/psql: Select a server and automate password
Date: 2009-04-08 14:12:29
Message-ID: 200904080712.29678.aklaver@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wednesday 08 April 2009 6:51:44 am Radcon Entec wrote:
> Greetings!
>
> On my computer, I have a copy of a customer's database for which a full
> backup file would be about 300 megabytes long.  There are several history
> tables that are not needed for day-to-day operation of our system.  I came
> up with a DOS batch file that consists of a sequence of pg_dump commands. 
> The first dumps the database's schema, and all the rest dump the required
> tables into individual files.  A companion batch file issues psql
> repeatedly to recreate the database and the tables. 
>
> On my computer, the batch files work fine.  I run them and they happily
> call pg_dump or psql as many times as they need to, and I don't need to do
> anything. 
>
> I just uploaded the batch files to our customer's machine, and a couple of
> questions occured to me.  First, pg_dump asks me for a password every time
> it is invoked.  That doesn't happen on my computer.  What is likely to be
> set up differently on my computer so that I don't need a password?

See pgpass
http://www.postgresql.org/docs/8.3/interactive/libpq-pgpass.html

>
> Second, I see no way to select a server in pg_dump or psql.  I am connected
> to a computer that was set up for my use specifically for testing.  In
> PGAdmin on that machine, I have a server talking to localhost and a server
> talking to the machine that hosts the production database.  I would like to
> run my batch file on the testing machine, but how do I tell pg_dump to use
> the server that talks to the production machine?

Use the -p switch to point pg_dump at the appropriate server.
http://www.postgresql.org/docs/8.3/interactive/app-pgdump.html

>
> Thank you very much!
>
> RobR

--
Adrian Klaver
aklaver(at)comcast(dot)net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2009-04-08 14:23:53 Re: Now I am back, next thing. Final PGS tuning.
Previous Message Jennifer Trey 2009-04-08 14:01:10 Now I am back, next thing. Final PGS tuning.