Re: backup database by cloning itself

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: backup database by cloning itself
Date: 2007-02-14 07:33:34
Message-ID: 45D2BB4E.8000306@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/13/07 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.

There's almost definitely a better way to do what you want to do.

What benefit are you trying to obtain by creating 720 almost
identical databases per month?

> 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?

Have you tried pg_dump?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFF0rtOS9HxQb37XmcRAtUxAKDWLK7x3uDGxwni47Y+o1yJsHXOzACg4XYu
ik9TtDFb6DJ+uZllXxahSMs=
=zcis
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Chris 2007-02-14 07:34:40 Re: Problem with 'tr' command
Previous Message Chris 2007-02-14 07:33:27 Re: Proper escaping for char(3) string, or PHP at fault, or me at fault?