Thread: Backup of postgres

Backup of postgres

From
Przemyslaw Bak
Date:
Hi all,

I have following script to backup database:
--------- cut ----------
#!/bin/sh

PSQL=/usr/local/pgsql/bin/psql
DUMP=/usr/local/pgsql/bin/pg_dump
PREFIX=`date +%j`
BACKUP_DIR=/usr/local/pgsql/data/base/.BACKUP

Databases=`$PSQL -tq -d template1 -c "select datname from pg_database"`
renice 20 $$

echo Backup started ...
for db in `echo $Databases`
do

  echo "time: `date +%H%M%S` - Backup of $db in progress ..."
  $DUMP -D $db > /$BACKUP_DIR/$PREFIX.$db
  echo "time: `date +%H%M%S` - Backup of $db finnished ..."
done
echo Backup finnished ...
--------- cut ----------

Crontab runs it every night (4:00am - nobody is working on the machine).
But every run I have following message:

---------- cut -------------
From: Cron Daemon <root@shire.st3.makro.com.pl>
To: postgres@shire.st3.makro.com.pl
Subject: Cron <postgres@shire> /usr/local/pgsql/store3/Backup.sh

3986: old priority 0, new priority 20
Backup started ...
time: 040001 - Backup of template1 in progress ...
time: 040004 - Backup of template1 finnished ...
time: 040004 - Backup of mzo in progress ...
time: 040010 - Backup of mzo finnished ...
time: 040010 - Backup of store3 in progress ...
/usr/local/pgsql/store3/Backup.sh: line 19:  4002 Segmentation fault      $DUMP -D $db >/$BACKUP_DIR/$PREFIX.$db
time: 042021 - Backup of store3 finnished ...
Backup finnished ...
---------- cut -------------

What's wrong with this script ?
It is running on Linux 2.0.33, Pentium 200, 64MB.
Please help - we save in postgres huge number of data.

przemol


Re: [ADMIN] Backup of postgres

From
Marc Howard Zuckman
Date:
On Wed, 19 Aug 1998, Przemyslaw Bak wrote:

> Hi all,
>
> I have following script to backup database:
> --------- cut ----------
> #!/bin/sh
>
> PSQL=/usr/local/pgsql/bin/psql
> DUMP=/usr/local/pgsql/bin/pg_dump
> PREFIX=`date +%j`
> BACKUP_DIR=/usr/local/pgsql/data/base/.BACKUP
>
> Databases=`$PSQL -tq -d template1 -c "select datname from pg_database"`
> renice 20 $$
>
> echo Backup started ...
> for db in `echo $Databases`
> do
>
>   echo "time: `date +%H%M%S` - Backup of $db in progress ..."
>   $DUMP -D $db > /$BACKUP_DIR/$PREFIX.$db
>   echo "time: `date +%H%M%S` - Backup of $db finnished ..."
> done
> echo Backup finnished ...
> --------- cut ----------
>
> Crontab runs it every night (4:00am - nobody is working on the machine).
> But every run I have following message:
>
> ---------- cut -------------
> From: Cron Daemon <root@shire.st3.makro.com.pl>
> To: postgres@shire.st3.makro.com.pl
> Subject: Cron <postgres@shire> /usr/local/pgsql/store3/Backup.sh
>
> 3986: old priority 0, new priority 20
> Backup started ...
> time: 040001 - Backup of template1 in progress ...
> time: 040004 - Backup of template1 finnished ...
> time: 040004 - Backup of mzo in progress ...
> time: 040010 - Backup of mzo finnished ...
> time: 040010 - Backup of store3 in progress ...
> /usr/local/pgsql/store3/Backup.sh: line 19:  4002 Segmentation fault      $DUMP -D $db >/$BACKUP_DIR/$PREFIX.$db
> time: 042021 - Backup of store3 finnished ...
> Backup finnished ...
> ---------- cut -------------
>
> What's wrong with this script ?
> It is running on Linux 2.0.33, Pentium 200, 64MB.
> Please help - we save in postgres huge number of data.
>
> przemol
>
>
What version of postgresql are you running?  I can't recall whether
it was in 6.2 or 6.1 (I think 6.2), but one of those versions
contained a pg_dump that would seg fault on some databases.

Marc Zuckman
marc@fallon.classyad.com

_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
_     Visit The Home and Condo MarketPlace              _
_          http://www.ClassyAd.com                  _
_                                  _
_  FREE basic property listings/advertisements and searches.  _
_                                  _
_  Try our premium, yet inexpensive services for a real          _
_   selling or buying edge!                      _
_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_


Re: [ADMIN] Backup of postgres

From
Przemyslaw Bak
Date:
On Wed, 19 Aug 1998, Marc Howard Zuckman wrote:
>
> On Wed, 19 Aug 1998, Przemyslaw Bak wrote:
>
> > Hi all,
> >
> > I have following script to backup database:
> > --------- cut ----------
> > #!/bin/sh
> >
> > PSQL=/usr/local/pgsql/bin/psql
> > DUMP=/usr/local/pgsql/bin/pg_dump
> > PREFIX=`date +%j`
> > BACKUP_DIR=/usr/local/pgsql/data/base/.BACKUP
> >
> > Databases=`$PSQL -tq -d template1 -c "select datname from pg_database"`
> > renice 20 $$
> >
> > echo Backup started ...
> > for db in `echo $Databases`
> > do
> >
> >   echo "time: `date +%H%M%S` - Backup of $db in progress ..."
> >   $DUMP -D $db > /$BACKUP_DIR/$PREFIX.$db
> >   echo "time: `date +%H%M%S` - Backup of $db finnished ..."
> > done
> > echo Backup finnished ...
> > --------- cut ----------
> >
> > Crontab runs it every night (4:00am - nobody is working on the machine).
> > But every run I have following message:
> >
> > ---------- cut -------------
> > From: Cron Daemon <root@shire.st3.makro.com.pl>
> > To: postgres@shire.st3.makro.com.pl
> > Subject: Cron <postgres@shire> /usr/local/pgsql/store3/Backup.sh
> >
> > 3986: old priority 0, new priority 20
> > Backup started ...
> > time: 040001 - Backup of template1 in progress ...
> > time: 040004 - Backup of template1 finnished ...
> > time: 040004 - Backup of mzo in progress ...
> > time: 040010 - Backup of mzo finnished ...
> > time: 040010 - Backup of store3 in progress ...
> > /usr/local/pgsql/store3/Backup.sh: line 19:  4002 Segmentation fault      $DUMP -D $db >/$BACKUP_DIR/$PREFIX.$db
> > time: 042021 - Backup of store3 finnished ...
> > Backup finnished ...
> > ---------- cut -------------
> >
> > What's wrong with this script ?
> > It is running on Linux 2.0.33, Pentium 200, 64MB.
> > Please help - we save in postgres huge number of data.
> >
> > przemol
> >
> >
> What version of postgresql are you running?  I can't recall whether
> it was in 6.2 or 6.1 (I think 6.2), but one of those versions
> contained a pg_dump that would seg fault on some databases.

Postgres 6.3.2. I compiled it from sources.

przemol