Re: how to use pg_dump and then restored onto development server

From: "Zlatko Matic" <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
To: "Matt Van Mater" <matt(dot)vanmater(at)gmail(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to use pg_dump and then restored onto development server
Date: 2005-07-01 07:55:47
Message-ID: 001801c57e12$880f91c0$b8851dc3@zlatko58zaczpv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

thanks.

----- Original Message -----
From: "Matt Van Mater" <matt(dot)vanmater(at)gmail(dot)com>
To: "Zlatko Matic" <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr>
Cc: <pgsql-general(at)postgresql(dot)org>
Sent: Thursday, June 30, 2005 7:25 PM
Subject: Re: [GENERAL] how to use pg_dump and then restored onto development
server

On 6/29/05, Douglas McNaught <doug(at)mcnaught(dot)org> wrote:
> "Zlatko Matic" <zlatko(dot)matic1(at)sb(dot)t-com(dot)hr> writes:
>
> > OK..i get it. It works...
> > My additional question is: how to incorporate timestamp in dumped file
> > name ?
> > Let's say, if we have script: pg_dump -f D:\MYDB_BCP -Fc -c -x -h
> > localhost -U postgres MYDB,
> > so that output file is named something like MYDB_BCP_2005-29-01, for
> > example. Is that possible?
>
> I'm sure it's possible, but I'm not an expert on Windows batch command
> language. There are some good references for that stuff on the
> web--check them out.
>

To get the date in a format that should work for you in win2000 and
winxp, open a command prompt and type the following command:
FOR /F "tokens=2-4 delims=/ " %f IN ('date /t') DO (echo %h-%g-%f)

To get the same date format inside a .bat batch script, replace each %
sign with two % signs, like this:
FOR /F "tokens=2-4 delims=/ " %%f IN ('date /t') DO (echo %%h-%%g-%%f)

You can run a similar command to get the current timestamp as well.
For more information on how to do this, and to better understand the
commands above, open a command prompt and type "for /?"... you will
see a help screen on the FOR construct in the windows command shell.

enjoy:)

Matt

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Zlatko Matić 2005-07-01 07:56:16 Re: PostgreSQL, WIndows, regular backup
Previous Message Russ Brown 2005-07-01 06:48:55 Re: COnsidering a move away from Postgres