<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.6 1999/12/07 22:41:41 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.7 1999/12/18 08:34:49 momjian Exp $
Postgres documentation
-->
<date>1999-12-04</date>
</refsynopsisdivinfo>
<synopsis>
-vacuumdb [ <replaceable class="parameter">connection options</replaceable> ] [ --analyze | -z ] [ --verbose | -v ]
+vacuumdb [ <replaceable class="parameter">connection options</replaceable> ] [ --analyze | -z ] [ --alldb | -a ] [ --verbose | -v ]
[ --table '<replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [,...] ) ]' ] [ [-d] <replaceable class="parameter">dbname</replaceable> ]
</synopsis>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>-a, --alldb</term>
+ <listitem>
+ <para>
+ Vacuum all databases.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>-v, --verbose</term>
<listitem>
#
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.4 1999/12/16 20:10:02 momjian Exp $
+# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/vacuumdb,v 1.5 1999/12/18 08:34:50 momjian Exp $
#
#-------------------------------------------------------------------------
--host=*)
PSQLOPT="$PSQLOPT -h "`echo $1 | sed 's/^--host=//'`
;;
+ --alldb|-a)
+ dbname="`psql $PASSWDOPT $AUTHOPT $PGHOSTOPT $PGPORTOPT -q -t -A -d template1 -c 'SELECT datname FROM pg_database'`";;
--port|-p)
PSQLOPT="$PSQLOPT -p $2"
shift;;
echo " -W, --password "
echo " -d DBNAME, --database=DBNAME "
echo " -z, --analyze "
+ echo " -a, --alldb "
echo " -t TABLE[(columns)], --table=TABLE[(columns)]"
echo " -v, --verbose "
echo " -e, --echo "
exit 1
fi
-psql $PSQLOPT -d "$dbname" -c "VACUUM $verbose$analyze$table"
+for db in $dbname
+do
+ psql $PASSWDOPT -tq $AUTHOPT $PGHOSTOPT $PGPORTOPT -c "vacuum $verbose $analyze $table" $db
+done
-if [ $? -ne 0 ]; then
+if [ $? -ne 0 ]
+then
echo "$CMDNAME: Vacuum failed."
exit 1
fi