Thread: The right direction for backups?
Hi there, I need to implement a routine backup procedure for PostgreSQL 6.5 under RedHat 6. I would like to save and restore a databasecomplete with all its elements (tables, indexes, etc), all user privileges and group information. Can someone please point me in the right direction? Any help is much appreciated. Thanks in advance, J. Alvarez. __________________________________________________________________ Make A Buck Or Two @ TheMail.com - Free Internet Email Sign-up today at http://www.themail.com/ref.htm?ref=908313
I use the following Perl script: (it utilizes pg_dump instead of pg_dumpall)- you may need to change the directory info based on your install.
Hope it helps...
James Hall
======================================
--------start code---------------
#!/bin/sh
PSQL=/usr/bin/psql
DUMP=/usr/bin/pg_dump
PREFIX=`date +%j`
BACKUP_DIR=/data/pgsql/data
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 finished ..."
done
echo Backup finished ...
-------end code-------------------
> -----Original Message-----
> From: jeam@themail.com [mailto:jeam@themail.com]
> Sent: Wednesday, July 12, 2000 4:05 PM
> To: pgsql-general@postgresql.org
> Subject: [GENERAL] The right direction for backups?
>
>
>
> Hi there,
>
> I need to implement a routine backup procedure for PostgreSQL
> 6.5 under RedHat 6. I would like to save and restore a
> database complete with all its elements (tables, indexes,
> etc), all user privileges and group information.
>
> Can someone please point me in the right direction?
> Any help is much appreciated.
>
> Thanks in advance,
>
> J. Alvarez.
> __________________________________________________________________
> Make A Buck Or Two @ TheMail.com - Free Internet Email
> Sign-up today at http://www.themail.com/ref.htm?ref=908313
>
>
>
Let's say I have a table t1 with two fields, x and y. How do I write an sql statement like: select x if y>1 else 0 from t1; For every record in which y is > 1, you get x back. Otherwise, you get 0 returned. Thanks, ---------------------------------------------------------------- Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer ----------------------------------------------------------------
On Wed, Jul 12, 2000 at 05:33:09PM -0500, Travis Bauer wrote: > > Let's say I have a table t1 with two fields, x and y. How do I write an > sql statement like: > > select x if y>1 else 0 from t1; SELECT CASE WHEN y>1 THEN x ELSE 0 END FROM t1; From page 33 of Bruce's book, at: http://www.postgresql.org/docs/aw_pgsql_book/node52.html Ross -- Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu> NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
Thanks, Now that you mention it, I even remember reading it in the book! ---------------------------------------------------------------- Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer ---------------------------------------------------------------- On Wed, 12 Jul 2000, Ross J. Reedstrom wrote: > > SELECT CASE WHEN y>1 THEN x ELSE 0 END FROM t1; > > >From page 33 of Bruce's book, at: