On Thu, Nov 01, 2007 at 08:03:08PM -0700, Craig White wrote:
> *** begin pg_table_dump.scr ***
> #/bin/sh
> #
> # Script to identify tables, backup schema and data separately and
> # then finally, vacuum each table
> #
> DB_NAME=MY_DB
> BACKUP_PATH=/home/backup/postgres/production
> MY_SCHEMA=public
> PG_USER=craig
> #
> psql -U $PG_USER \
> $DB_NAME \
> -c "SELECT tablename FROM pg_tables WHERE \
> schemaname = "\'$MY_SCHEMA\'";" | \
> grep -v 'tablename' | \
> grep -v [\--*] | \
> grep -v rows\) > $BACKUP_PATH/pg_tables
instead of these 3 grep -v, i would suggest to use -qAt switches to
psql:
psql -U $PG_USER -d $DB_NAME -qAt -c "..."
depesz
--
quicksil1er: "postgres is excellent, but like any DB it requires a
highly paid DBA. here's my CV!" :)
http://www.depesz.com/ - blog dla ciebie (i moje CV)