Re: shell script to SQL statement: `pg_dump | psql -U` - Mailing list pgsql-general

From MargaretGillon@chromalloy.com
Subject Re: shell script to SQL statement: `pg_dump | psql -U`
Date
Msg-id OF37557CF6.1AC0B5EA-ON882572A7.005BF275-882572A7.006059A9@CHROMALLOY.COM
Whole thread Raw
Responses Re: shell script to SQL statement: `pg_dump | psql -U`  ("filippo" <filippo2991@virgilio.it>)
List pgsql-general

> Date: 21 Mar 2007 00:29:33 -0700
> From: "filippo" <filippo2991@virgilio.it>
> To: pgsql-general@postgresql.org
> Subject: Re: shell script to SQL statement: `pg_dump | psql -U`
> Message-ID: <1174462173.105601.197370@b75g2000hsg.googlegroups.com>
>
> On 20 Mar, 16:47, t...@sss.pgh.pa.us (Tom Lane) wrote:
> > "filippo" <filippo2...@virgilio.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

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: multi-row check constraints?
Next
From: Peter
Date:
Subject: Async triggers