Re: Announcing Postgresql backup script.

Lists: pgsql-hackers
From: Grant <grant(at)conprojan(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Announcing Postgresql backup script.
Date: 2001-06-26 01:47:24
Message-ID: Pine.LNX.4.21.0106261146400.15896-100000@webster.conprojan.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

I have written a simple bourne shell script which performs all backup
functions, but no restore at this point. I personally find it's very
good and keeps each daily backup (gzipped) in it's own dated directory
under the parent directory being the current month. It's available at:

http://database.sourceforge.net

I am open to suggestions and if anyone would like to critique the code to
make it simpler or more powerful then by all means go ahead.

Thanks.


From: Jim Mercer <jim(at)reptiles(dot)org>
To: Grant <grant(at)conprojan(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Announcing Postgresql backup script.
Date: 2001-06-26 02:22:28
Message-ID: 20010625222228.C1599@reptiles.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jun 26, 2001 at 11:47:24AM +1000, Grant wrote:
> I have written a simple bourne shell script which performs all backup
> functions, but no restore at this point.

ah, isn't that like building a really fast car with no brakes?

--
[ Jim Mercer jim(at)reptiles(dot)org +1 416 410-5633 ]
[ Now with more and longer words for your reading enjoyment. ]


From: Grant <grant(at)conprojan(dot)com(dot)au>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Announcing Postgresql backup script.
Date: 2001-06-26 03:04:41
Message-ID: Pine.LNX.4.21.0106261258330.16256-100000@webster.conprojan.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> > I have written a simple bourne shell script which performs all backup
> > functions, but no restore at this point.
>
> ah, isn't that like building a really fast car with no brakes?

This car has brakes, but they're not so easy to use just yet.

Volunteering? :)

To restore just do the following:

[postgres(at)linux 26-06-2001]$ /server/pgsql/bin/dropdb -h localhost binary_data
DROP DATABASE
[postgres(at)linux 26-06-2001]$ /server/pgsql/bin/createdb -h localhost binary_data
CREATE DATABASE
[postgres(at)linux 26-06-2001]$ gunzip 12:00-postgresql_database-binary_data-backup.gz
[postgres(at)linux 26-06-2001]$ psql -h localhost binary_data < 12:00-postgresql_database-binary_data-backup
You are now connected as new user postgres.
CREATE...

etc etc.


From: Jim Mercer <jim(at)reptiles(dot)org>
To: Grant <grant(at)conprojan(dot)com(dot)au>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Announcing Postgresql backup script.
Date: 2001-06-26 03:24:45
Message-ID: 20010625232445.G1599@reptiles.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Jun 26, 2001 at 01:04:41PM +1000, Grant wrote:
> > > I have written a simple bourne shell script which performs all backup
> > > functions, but no restore at this point.
> >
> > ah, isn't that like building a really fast car with no brakes?
>
> This car has brakes, but they're not so easy to use just yet.

i'm glad you caught the humour intended. i forgot the 8^)

> Volunteering? :)

not at this point.

> To restore just do the following:
>
> [postgres(at)linux 26-06-2001]$ /server/pgsql/bin/dropdb -h localhost binary_data
> DROP DATABASE
> [postgres(at)linux 26-06-2001]$ /server/pgsql/bin/createdb -h localhost binary_data
> CREATE DATABASE
> [postgres(at)linux 26-06-2001]$ gunzip 12:00-postgresql_database-binary_data-backup.gz
> [postgres(at)linux 26-06-2001]$ psql -h localhost binary_data < 12:00-postgresql_database-binary_data-backup
> You are now connected as new user postgres.
> CREATE...

i haven't looked at the scripts (and probably should before commenting further)
but, alas, a few beers makes me bold.

this looks alot like what i would do with:

backup:

pg_dump dbname | gzip > /backup/`date +%Y-%m-%d`.gz

restore:

dropdb dbname
createdb dbname
zcat /some/YYYY-MM-DD.gz | psql -q dbname

--
[ Jim Mercer jim(at)reptiles(dot)org +1 416 410-5633 ]
[ Now with more and longer words for your reading enjoyment. ]