> > It would be nice for new users; I think it would make it easier
> > for them to actually set out and do it. Many new users are > > of the not-so-knowledgable variety, and shell scripting isn't > > something they want to undertake. > > Can someone modify the vacuumdb shell script to do that? i tried it... it seems to work neko@kredit.sth.sz
This commit is contained in:
parent
fd96e1754c
commit
1c2257648a
@ -1,5 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
$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
|
Postgres documentation
|
||||||
-->
|
-->
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ Postgres documentation
|
|||||||
<date>1999-12-04</date>
|
<date>1999-12-04</date>
|
||||||
</refsynopsisdivinfo>
|
</refsynopsisdivinfo>
|
||||||
<synopsis>
|
<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> ]
|
[ --table '<replaceable class="parameter">table</replaceable> [ ( <replaceable class="parameter">column</replaceable> [,...] ) ]' ] [ [-d] <replaceable class="parameter">dbname</replaceable> ]
|
||||||
</synopsis>
|
</synopsis>
|
||||||
|
|
||||||
@ -56,6 +56,15 @@ vacuumdb [ <replaceable class="parameter">connection options</replaceable> ] [ -
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>-a, --alldb</term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Vacuum all databases.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>-v, --verbose</term>
|
<term>-v, --verbose</term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# 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 $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -39,6 +39,8 @@ do
|
|||||||
--host=*)
|
--host=*)
|
||||||
PSQLOPT="$PSQLOPT -h "`echo $1 | sed 's/^--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)
|
--port|-p)
|
||||||
PSQLOPT="$PSQLOPT -p $2"
|
PSQLOPT="$PSQLOPT -p $2"
|
||||||
shift;;
|
shift;;
|
||||||
@ -119,6 +121,7 @@ if [ "$usage" ]; then
|
|||||||
echo " -W, --password "
|
echo " -W, --password "
|
||||||
echo " -d DBNAME, --database=DBNAME "
|
echo " -d DBNAME, --database=DBNAME "
|
||||||
echo " -z, --analyze "
|
echo " -z, --analyze "
|
||||||
|
echo " -a, --alldb "
|
||||||
echo " -t TABLE[(columns)], --table=TABLE[(columns)]"
|
echo " -t TABLE[(columns)], --table=TABLE[(columns)]"
|
||||||
echo " -v, --verbose "
|
echo " -v, --verbose "
|
||||||
echo " -e, --echo "
|
echo " -e, --echo "
|
||||||
@ -133,9 +136,13 @@ if [ -z "$dbname" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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."
|
echo "$CMDNAME: Vacuum failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user