From: | Palle Girgensohn <girgen(at)partitur(dot)se> |
---|---|
To: | Vikrant Rathore <vikrant(at)chemquick(dot)com> |
Cc: | pgsql-admin(at)postgreSQL(dot)org |
Subject: | Re: [ADMIN] Mail For database backup and restore |
Date: | 1998-10-20 00:53:15 |
Message-ID: | 362BDEFB.17CFB5C1@partitur.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
Vikrant Rathore wrote:
>
> I would like to have a help that how can i take the backup and restore the
> database of postgres on a daily basis.
> Vikrant Rathore
>
> Neuronet
> neuronet(at)chemquick(dot)com
Do you mean that you want to restore the database on a daily basis? Why?
Here's a script to save a backup of every last seven days. Run it from
cron every night or so. Don't forget to mkdir /usr/local/pgsql/backups.
#!/bin/sh
#Must be run as user pgsql
#
# run from daily.local as
# if [ -f /etc/daily.pgsql ]; then
# echo "Working on PostgreSQL"
# su -l pgsql -c daily.pgsql
# fi
echo "Backing up..."
/usr/local/pgsql/bin/pg_dumpall \
| gzip > /usr/local/pgsql/backups/pgdumpall_`date "+%Y%m%d"`.gz
echo "Vacuuming..."
for db in /usr/local/pgsql/data/base/*
do
echo ""
echo `basename $db`
/usr/local/pgsql/bin/psql -c vacuum `basename $db`
done
echo "Removing old backups..."
find /usr/local/pgsql/backups -mtime +7 -exec rm -f {} \;
From | Date | Subject | |
---|---|---|---|
Next Message | pete collins | 1998-10-20 12:16:18 | newbie question |
Previous Message | Gilley, Charles H. | 1998-10-19 22:22:10 | 6.3.2 built, installed and running on Solaris 2.5.1.... recap |