pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Gilbert <dgilbert@velocet.ca>
To: mlaks@bellatlantic.net
Cc: pgsql-admin@postgresql.org
Subject: repair table? database? how ? neccessary?
Date: Wed, 8 Jan 2003 11:18:43 -0500
Message-ID: <15900.20323.674939.988553@canoe.velocet.net> (raw)
In-Reply-To: <200301061721.53120.mlaks@bellatlantic.net>
References: <200301061721.53120.mlaks@bellatlantic.net>

>>>>> "mitchell" == mitchell laks <mlaks@bellatlantic.net> writes:

mitchell> The main issue I had with Access was that as the database
mitchell> got larger, My application began to fail regularly, and I
mitchell> began to need to do "repair" of the database almost on a
mitchell> daily or other daily basis.

mitchell> Is it that Postgresql is just so robust that bad tables
mitchell> can't happen? I am a bit of a newbie, so I don't know
mitchell> exactly what it is that i have been doing with "repair" to
mitchell> repair whatever it was that was broken in msft that may not
mitchell> occur here with Postgresql. Sigh. I need more
mitchell> knowledge. What do I read?

I'll preface this with the fact that I havn't had a postgres failure
in 3-ish years, but I'm still paranoid.  We run a database of 5-ish
million records in the main table ... and probably 20 million records
in all.  Most days see 10k to 100k records change.  I have run
databases with much higher rates of change without problems

That all said, my data is important to me and we dump the database to
a flat file hourly.  We take that data and use cvs to archive each
hours file.  To 'recover' postgres, you drop and re-create the
database and then import the dump file.

Here is my script for dumping the database and archiving it:

(the 'WARNING: $db has 0 length' occurs when you fill your disk)

#! /bin/bash
#
# Backup the velocet database.

if [ "$1" = "-d" ]
then
        debug_mode=1
else
        debug_mode=0
fi

# Where we want to be.
cd /u/dgilbert/dbbak

# Config to run Postgres
PATH=$PATH:/usr/local/bin
PGLIB=/usr/local/pgsql/lib
PGDATA=/usr/local/pgsql/data

for db in sales trsales velocet keystone; do
  pg_dump $db > $db.1 
  test "$debug_mode" -gt 0 && echo backup up $db
  if [ -s $db.1 ]; then
        mv $db.1 $db
  else
        echo "WARNING: $db has 0 length"
  fi

  cvs commit -m "Automatic Database Backup" $db
done




view thread (4+ messages)

Message-ID: <15900.20323.674939.988553@canoe.velocet.net>
Permalink:  ../15900.20323.674939.988553@canoe.velocet.net/
Also on:    postgresql.org/message-id/15900.20323.674939.988553@canoe.velocet.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: dgilbert@velocet.ca, mlaks@bellatlantic.net
  Subject: Re: repair table? database? how ? neccessary?
  In-Reply-To: <15900.20323.674939.988553@canoe.velocet.net>
  References: <200301061721.53120.mlaks@bellatlantic.net> <15900.20323.674939.988553@canoe.velocet.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox