From: | Scott Marlowe <smarlowe(at)g2switchworks(dot)com> |
---|---|
To: | filippo <filippo2991(at)virgilio(dot)it> |
Cc: | pgsql general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: backup database by cloning itself |
Date: | 2007-02-14 18:14:13 |
Message-ID: | 1171476853.3565.54.camel@state.g2switchworks.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Tue, 2007-02-13 at 07:54, filippo wrote:
> Hello,
>
> my database is not very big so I want to adopt this backup strategy:
>
> I want to clone my database every 1 hour to another
> database 'currenttime_mydatabase' in order to have 24 backup a day,
> overwriting the yesterday backups by today-same-time backups.
>
> This is good for me because I have all the backups readily available
> to be read by my program (opening the backup read only). This is a
> very important for my needs.
>
> I'm writing a script run by cron each hour to do accomplish the backup
> task.
>
> My target is to have the backup operation not affecting the users, so
> I want to be able to copy a database even if the database is used by
> someone.
>
> Can I use
> CREATE DATABASE my_backup_database TEMPLATE current_database?
>
> Is there a better way to get what I need?
Create database ain't gonna work, cause it needs a database with no
users connected. You could do:
dropdb hour_13;
createdb hour_13
pg_dump masterdb | psql hour_13
with the number after hour being a var you set every hour when you run
it.
From | Date | Subject | |
---|---|---|---|
Next Message | Alexander Elgert | 2007-02-14 18:14:34 | massive memory allocation until machine crashes |
Previous Message | Rajarshi Guha | 2007-02-14 17:48:30 | Re: suggestions on improving a query |