Thread

  1. Re: Announcing Postgresql backup script.

    Jim Mercer <jim@reptiles.org> — 2001-06-26T03:24:45Z

    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@linux 26-06-2001]$ /server/pgsql/bin/dropdb -h localhost binary_data
    > DROP DATABASE
    > [postgres@linux 26-06-2001]$ /server/pgsql/bin/createdb -h localhost binary_data
    > CREATE DATABASE
    > [postgres@linux 26-06-2001]$ gunzip 12:00-postgresql_database-binary_data-backup.gz
    > [postgres@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@reptiles.org         +1 416 410-5633 ]
    [ Now with more and longer words for your reading enjoyment. ]