DESTROYDB(UNIX)
NAME
destroydb - destroy an existing database
SYNOPSIS
destroydb [-i] [-a system] [-h host] [-p port] [dbname]
DESCRIPTION
Destroydb destroys an existing database. To execute this
command, the user must be the database administrator, or
DBA, for this database. The program runs silently; no
confirmation message will be displayed. After the
database is destroyed, a Unix shell prompt will reappear.
Destroydb is a shell script that invokes psql. Hence, a
postmaster process must be running on the database server
host before destroydb is executed. In addition, the PGOP-
TION and PGREALM environment variables will be passed on
to psql and processed as described in psql(1).
The optional argument dbname specifies the name of the
database to be destroyed. All references to the database
are removed, including the directory containing this
database and its associated files. Dbname defaults to the
value of the USER environment variable.
Destroydb understands the following command-line options:
-i Prompts before destroying a database (interactive).
-a system
Specifies an authentication system system (see pgin-
tro(1)) to use in connecting to the postmaster pro-
cess. This option no longer has any effect.
-h host
Specifies the hostname of the machine on which the
postmaster is running. Defaults to using local Unix
domain sockets.
-p port
Specifies the TCP/IP port or local Unix domain socket
file extension on which the postmaster is listening
for connections. Defaults to 5432, or the value of
the PGPORT environment variable (if set).
EXAMPLES
# destroy the demo database
destroydb demo
# destroy the demo database using the postmaster on host eden, port 5000.
destroydb -p 5000 -h eden demo
FILES
$PGDATA/base/dbname
The location of the files corresponding to the
database dbname.
SEE ALSO
destroydb(l) createdb(1) initdb(1) psql(1). postmas-
ter(1).
DIAGNOSTICS
Error: Failed to connect to backend (host=xxx, port=xxx)
Destroydb could not attach to the postmaster process
on the specified host and port. If you see this mes-
sage, ensure that the postmaster is running on the
proper host and that you have specified the proper
port. If your site uses an authentication system,
ensure that you have obtained the required authenti-
cation credentials.
user "username" is not in "pg_user"
You do not have a valid entry in the relation
"pg_user" and cannot do anything with Postgres at
all; contact your Postgres site administrator.
user "username" is not allowed to create/destroy databases
You do not have permission to destroy databases; con-
tact your Postgres site administrator.
database "dbname" does not exist
The database to be removed does not have an entry in
the "pg_database" class.
database "dbname" is not owned by you
You are not DBA for the specified database.
database destroy failed on dbname
An internal error occurred in psql or the backend
server. Contact your Postgres site administrator to
ensure that ensure that the files and database
entries associated with the database are completely
removed.