1999-12-04 05:53:22 +01:00
|
|
|
<!--
|
2009-02-26 17:02:39 +01:00
|
|
|
$PostgreSQL: pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.35 2009/02/26 16:02:37 petere Exp $
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
1999-12-04 05:53:22 +01:00
|
|
|
-->
|
|
|
|
|
|
|
|
<refentry id="APP-DROPDB">
|
|
|
|
<refmeta>
|
2000-11-12 00:01:45 +01:00
|
|
|
<refentrytitle id="APP-DROPDB-TITLE"><application>dropdb</application></refentrytitle>
|
|
|
|
<manvolnum>1</manvolnum>
|
1999-12-04 05:53:22 +01:00
|
|
|
<refmiscinfo>Application</refmiscinfo>
|
|
|
|
</refmeta>
|
2000-11-12 00:01:45 +01:00
|
|
|
|
1999-12-04 05:53:22 +01:00
|
|
|
<refnamediv>
|
2000-11-12 00:01:45 +01:00
|
|
|
<refname>dropdb</refname>
|
2001-09-03 14:57:50 +02:00
|
|
|
<refpurpose>remove a <productname>PostgreSQL</productname> database</refpurpose>
|
1999-12-04 05:53:22 +01:00
|
|
|
</refnamediv>
|
2000-11-12 00:01:45 +01:00
|
|
|
|
2003-08-31 19:32:24 +02:00
|
|
|
<indexterm zone="app-dropdb">
|
|
|
|
<primary>dropdb</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
1999-12-04 05:53:22 +01:00
|
|
|
<refsynopsisdiv>
|
2000-11-12 00:01:45 +01:00
|
|
|
<cmdsynopsis>
|
|
|
|
<command>dropdb</command>
|
2003-03-24 15:32:51 +01:00
|
|
|
<arg rep="repeat"><replaceable>option</replaceable></arg>
|
2000-11-12 00:01:45 +01:00
|
|
|
<arg choice="plain"><replaceable>dbname</replaceable></arg>
|
|
|
|
</cmdsynopsis>
|
2002-07-28 17:22:21 +02:00
|
|
|
</refsynopsisdiv>
|
1999-12-04 05:53:22 +01:00
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<application>dropdb</application> destroys an existing
|
|
|
|
<productname>PostgreSQL</productname> database.
|
|
|
|
The user who executes this command must be a database
|
|
|
|
superuser or the owner of the database.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2003-03-18 23:19:47 +01:00
|
|
|
<application>dropdb</application> is a wrapper around the
|
|
|
|
<acronym>SQL</acronym> command <xref linkend="SQL-DROPDATABASE"
|
2003-09-12 02:12:47 +02:00
|
|
|
endterm="SQL-DROPDATABASE-title">.
|
|
|
|
There is no effective difference between dropping databases via
|
|
|
|
this utility and via other methods for accessing the server.
|
2002-07-28 17:22:21 +02:00
|
|
|
</para>
|
2003-09-12 02:12:47 +02:00
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
2002-10-12 01:03:48 +02:00
|
|
|
<title>Options</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<application>dropdb</> accepts the following command-line arguments:
|
1999-12-04 05:53:22 +01:00
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><replaceable class="parameter">dbname</replaceable></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Specifies the name of the database to be removed.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-e</></term>
|
|
|
|
<term><option>--echo</></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2003-03-24 15:32:51 +01:00
|
|
|
Echo the commands that <application>dropdb</application> generates
|
2007-02-22 00:21:12 +01:00
|
|
|
and sends to the server.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-i</></term>
|
|
|
|
<term><option>--interactive</></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2002-10-12 01:03:48 +02:00
|
|
|
Issues a verification prompt before doing anything destructive.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
1999-12-04 05:53:22 +01:00
|
|
|
|
2002-10-12 01:03:48 +02:00
|
|
|
<para>
|
2003-09-12 02:12:47 +02:00
|
|
|
<application>dropdb</application> also accepts the following
|
2002-10-12 01:03:48 +02:00
|
|
|
command-line arguments for connection parameters:
|
|
|
|
|
|
|
|
<variablelist>
|
1999-12-04 05:53:22 +01:00
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-h <replaceable class="parameter">host</replaceable></></term>
|
|
|
|
<term><option>--host <replaceable class="parameter">host</replaceable></></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Specifies the host name of the machine on which the
|
|
|
|
server
|
|
|
|
is running. If the value begins with a slash, it is used
|
|
|
|
as the directory for the Unix domain socket.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-p <replaceable class="parameter">port</replaceable></></term>
|
|
|
|
<term><option>--port <replaceable class="parameter">port</replaceable></></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-02-22 00:21:12 +01:00
|
|
|
Specifies the TCP port or local Unix domain socket file
|
|
|
|
extension on which the server
|
|
|
|
is listening for connections.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-U <replaceable class="parameter">username</replaceable></></term>
|
|
|
|
<term><option>--username <replaceable class="parameter">username</replaceable></></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-12-11 20:57:32 +01:00
|
|
|
User name to connect as.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2009-02-26 17:02:39 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-w</></term>
|
|
|
|
<term><option>--no-password</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Never issue a password prompt. If the server requires
|
|
|
|
password authentication and a password is not available by
|
|
|
|
other means such as a <filename>.pgpass</filename> file, the
|
|
|
|
connection attempt will fail. This option can be useful in
|
|
|
|
batch jobs and scripts where no user is present to enter a
|
|
|
|
password.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
1999-12-04 05:53:22 +01:00
|
|
|
<varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
<term><option>-W</></term>
|
|
|
|
<term><option>--password</></term>
|
1999-12-04 05:53:22 +01:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-12-11 20:57:32 +01:00
|
|
|
Force <application>dropdb</application> to prompt for a
|
|
|
|
password before connecting to a database.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
This option is never essential, since
|
|
|
|
<application>dropdb</application> will automatically prompt
|
|
|
|
for a password if the server demands password authentication.
|
|
|
|
However, <application>dropdb</application> will waste a
|
|
|
|
connection attempt finding out that the server wants a password.
|
|
|
|
In some cases it is worth typing <option>-W</> to avoid the extra
|
|
|
|
connection attempt.
|
1999-12-04 05:53:22 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-10-12 01:03:48 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
2002-07-28 17:22:21 +02:00
|
|
|
</refsect1>
|
1999-12-04 05:53:22 +01:00
|
|
|
|
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Environment</title>
|
1999-12-04 05:53:22 +01:00
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><envar>PGHOST</envar></term>
|
|
|
|
<term><envar>PGPORT</envar></term>
|
|
|
|
<term><envar>PGUSER</envar></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Default connection parameters
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-02-20 19:10:59 +01:00
|
|
|
|
|
|
|
<para>
|
|
|
|
This utility, like most other <productname>PostgreSQL</> utilities,
|
2007-03-26 19:23:37 +02:00
|
|
|
also uses the environment variables supported by <application>libpq</>
|
|
|
|
(see <xref linkend="libpq-envars">).
|
2007-02-20 19:10:59 +01:00
|
|
|
</para>
|
|
|
|
|
1999-12-04 05:53:22 +01:00
|
|
|
</refsect1>
|
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
|
2003-09-13 01:04:46 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Diagnostics</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
In case of difficulty, see <xref linkend="SQL-DROPDATABASE"
|
|
|
|
endterm="sql-dropdatabase-title"> and <xref linkend="APP-PSQL"> for
|
|
|
|
discussions of potential problems and error messages.
|
|
|
|
The database server must be running at the
|
|
|
|
targeted host. Also, any default connection settings and environment
|
|
|
|
variables used by the <application>libpq</application> front-end
|
|
|
|
library will apply.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
2002-07-28 17:22:21 +02:00
|
|
|
<title>Examples</title>
|
2000-11-12 00:01:45 +01:00
|
|
|
|
|
|
|
<para>
|
|
|
|
To destroy the database <literal>demo</literal> on the default
|
|
|
|
database server:
|
|
|
|
<screen>
|
|
|
|
<prompt>$ </prompt><userinput>dropdb demo</userinput>
|
|
|
|
</screen>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
To destroy the database <literal>demo</literal> using the
|
2002-01-20 23:19:57 +01:00
|
|
|
server on host <literal>eden</literal>, port 5000, with verification and a peek
|
2003-03-24 15:32:51 +01:00
|
|
|
at the underlying command:
|
2000-11-12 00:01:45 +01:00
|
|
|
<screen>
|
|
|
|
<prompt>$ </prompt><userinput>dropdb -p 5000 -h eden -i -e demo</userinput>
|
|
|
|
<computeroutput>Database "demo" will be permanently deleted.
|
|
|
|
Are you sure? (y/n) </computeroutput><userinput>y</userinput>
|
2007-06-21 12:43:09 +02:00
|
|
|
<computeroutput>DROP DATABASE demo;</computeroutput>
|
2000-11-12 00:01:45 +01:00
|
|
|
</screen>
|
|
|
|
</para>
|
1999-12-04 05:53:22 +01:00
|
|
|
</refsect1>
|
2002-07-28 17:22:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
|
|
|
<member><xref linkend="app-createdb"></member>
|
|
|
|
<member><xref linkend="sql-dropdatabase" endterm="sql-dropdatabase-title"></member>
|
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
1999-12-04 05:53:22 +01:00
|
|
|
</refentry>
|