Re: shell script to SQL statement: `pg_dump | psql -U`

From: MargaretGillon(at)chromalloy(dot)com
To: pgsql-general(at)postgresql(dot)org
Cc: filippo" <filippo2991(at)virgilio(dot)it/(at)CHROMALLOY(dot)COM
Subject: Re: shell script to SQL statement: `pg_dump | psql -U`
Date: 2007-03-23 17:32:28
Message-ID: OF37557CF6.1AC0B5EA-ON882572A7.005BF275-882572A7.006059A9@CHROMALLOY.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Date: 21 Mar 2007 00:29:33 -0700
> From: "filippo" <filippo2991(at)virgilio(dot)it>
> To: pgsql-general(at)postgresql(dot)org
> Subject: Re: shell script to SQL statement: `pg_dump | psql -U`
> Message-ID: <1174462173(dot)105601(dot)197370(at)b75g2000hsg(dot)googlegroups(dot)com>
>
> On 20 Mar, 16:47, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> > "filippo" <filippo2(dot)(dot)(dot)(at)virgilio(dot)it> writes:
> > > The problem with the current implementation is that sometime pd_dump
> > > and psql ask for password but I want to create the database copy
> > > without any user typing (it is a cron script).
> >
> > Create a ~/.pgpass file for the user that runs the cron job.
>
> thanks Tom and Richard, actually it works now. However I wonder if
> there is a SQL way, I'm partially in a Windows enviroment and I don't
> trust very much the microsoft security.
>
> Thanks and regards,
>
> Filippo

You may already know some of this so I'm sorry if it's a repeat. This is a
work around not a solution from inside Postgresql.

Create a Dos/Windows batch file. Ends with extension .bat. Like a cron
file it contains commands that will be executed. Go into a text editor
(notepad or wordpad) and make a file called whatever you want ending with
the extension .bat, for example PGBackup.bat Make sure that when you save
the file you save it as a type Text Document. Put the PG command into the
file and save the .bat file in the directory that you are running the
command from manually. Go into the Windows Scheduler on the SQLServer and
schedule a time for the .bat file to run. The scheduler can be accessed
from the control panel or the Help file. You must have administrator
rights to create a scheduled job.

One issue, if the command has problems and doesn't complete it may popup a
dialogue box and wait for a response. It would be wise to check your
server the first few days to make sure there are no dialogue boxes waiting
for you.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
Margaret Gillon, IS Dept., Chromalloy Los Angeles, ext. 297

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-03-23 17:58:55 Re: Async triggers
Previous Message Peter 2007-03-23 17:30:17 Async triggers