dropdb.sgml 6.1 KB
Newer Older
1
<!--
2
$Header: /cvsroot/pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.25 2003/09/12 23:04:46 tgl Exp $
3
PostgreSQL documentation
4 5 6 7
-->

<refentry id="APP-DROPDB">
 <refmeta>
8 9
  <refentrytitle id="APP-DROPDB-TITLE"><application>dropdb</application></refentrytitle>
  <manvolnum>1</manvolnum>
10 11
  <refmiscinfo>Application</refmiscinfo>
 </refmeta>
12

13
 <refnamediv>
14
  <refname>dropdb</refname>
15
  <refpurpose>remove a <productname>PostgreSQL</productname> database</refpurpose>
16
 </refnamediv>
17

P
Peter Eisentraut 已提交
18 19 20 21
 <indexterm zone="app-dropdb">
  <primary>dropdb</primary>
 </indexterm>

22
 <refsynopsisdiv>
23 24
  <cmdsynopsis>
   <command>dropdb</command>
25
   <arg rep="repeat"><replaceable>option</replaceable></arg>
26 27
   <arg choice="plain"><replaceable>dbname</replaceable></arg>
  </cmdsynopsis>
28
 </refsynopsisdiv>
29

30 31 32 33 34 35 36 37 38 39 40 41

 <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>
42 43
   <application>dropdb</application> is a wrapper around the
   <acronym>SQL</acronym> command <xref linkend="SQL-DROPDATABASE"
T
Tom Lane 已提交
44 45 46
   endterm="SQL-DROPDATABASE-title">.
   There is no effective difference between dropping databases via
   this utility and via other methods for accessing the server.
47
  </para>
T
Tom Lane 已提交
48

49 50 51 52
 </refsect1>


 <refsect1>
P
Peter Eisentraut 已提交
53 54 55 56
  <title>Options</title>

  <para>
   <application>dropdb</> accepts the following command-line arguments:
57 58 59

    <variablelist>
     <varlistentry>
P
Peter Eisentraut 已提交
60
      <term><replaceable class="parameter">dbname</replaceable></term>
61 62
      <listitem>
       <para>
63
	Specifies the name of the database to be removed.
64 65 66 67 68
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
69 70
      <term><option>-e</></term>
      <term><option>--echo</></term>
71 72
      <listitem>
       <para>
73
        Echo the commands that <application>dropdb</application> generates
P
Peter Eisentraut 已提交
74
	and sends to the server.
75 76 77 78 79
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
80 81
      <term><option>-i</></term>
      <term><option>--interactive</></term>
82 83
      <listitem>
       <para>
P
Peter Eisentraut 已提交
84
       Issues a verification prompt before doing anything destructive.
85 86 87 88 89
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
90 91
      <term><option>-q</></term>
      <term><option>--quiet</></term>
92 93
      <listitem>
       <para>
P
Peter Eisentraut 已提交
94
        Do not display a response.
95 96 97
       </para>
      </listitem>
     </varlistentry>
P
Peter Eisentraut 已提交
98 99
    </variablelist>
  </para>
100

P
Peter Eisentraut 已提交
101
  <para>
T
Tom Lane 已提交
102
   <application>dropdb</application> also accepts the following
P
Peter Eisentraut 已提交
103 104 105
   command-line arguments for connection parameters:

   <variablelist>
106
     <varlistentry>
P
Peter Eisentraut 已提交
107 108
      <term><option>-h <replaceable class="parameter">host</replaceable></></term>
      <term><option>--host <replaceable class="parameter">host</replaceable></></term>
109 110
      <listitem>
       <para>
P
Peter Eisentraut 已提交
111 112
	Specifies the host name of the machine on which the 
	server
113
	is running.  If the value begins with a slash, it is used 
P
Peter Eisentraut 已提交
114
	as the directory for the Unix domain socket.
115 116 117 118 119
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
120 121
      <term><option>-p <replaceable class="parameter">port</replaceable></></term>
      <term><option>--port <replaceable class="parameter">port</replaceable></></term>
122 123
      <listitem>
       <para>
124
	Specifies the TCP port or local Unix domain socket file 
P
Peter Eisentraut 已提交
125 126
	extension on which the server
	is listening for connections.
127 128 129 130 131
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
132 133
      <term><option>-U <replaceable class="parameter">username</replaceable></></term>
      <term><option>--username <replaceable class="parameter">username</replaceable></></term>
134 135
      <listitem>
       <para>
P
Peter Eisentraut 已提交
136
        User name to connect as
137 138 139 140 141
       </para>
      </listitem>
     </varlistentry>

     <varlistentry>
P
Peter Eisentraut 已提交
142 143
      <term><option>-W</></term>
      <term><option>--password</></term>
144 145
      <listitem>
       <para>
P
Peter Eisentraut 已提交
146
        Force password prompt.
147 148 149
       </para>
      </listitem>
     </varlistentry>
P
Peter Eisentraut 已提交
150 151
   </variablelist>
  </para>
152
 </refsect1>
153 154


155 156
 <refsect1>
  <title>Environment</title>
157

158 159 160 161 162 163 164 165 166 167 168 169 170
  <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>
171 172
 </refsect1>

173

174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190
 <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>
191
  <title>Examples</title>
192 193 194 195 196 197 198 199 200 201 202 203

   <para>
    To destroy the database <literal>demo</literal> on the default
    database server:
<screen>
<prompt>$ </prompt><userinput>dropdb demo</userinput>
<computeroutput>DROP DATABASE</computeroutput>
</screen>
   </para>

   <para>
    To destroy the database <literal>demo</literal> using the
P
Peter Eisentraut 已提交
204
    server on host <literal>eden</literal>, port 5000, with verification and a peek
205
    at the underlying command:
206 207 208 209 210 211 212 213
<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>
<computeroutput>DROP DATABASE "demo"
DROP DATABASE</computeroutput>
</screen>
   </para>
214
 </refsect1>
215 216 217 218 219 220 221 222 223 224 225


 <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>

226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->