1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>dropdb</title>
<link rel="stylesheet" href="stylesheet.css" type="text/css">
<link rev="made" href="pgsql-docs@postgresql.org">
<meta name="generator" content="DocBook XSL Stylesheets V1.70.0">
<link rel="start" href="index.html" title="PostgreSQL 8.1.4 Documentation">
<link rel="up" href="reference-client.html" title="PostgreSQL Client Applications">
<link rel="prev" href="app-createuser.html" title="createuser">
<link rel="next" href="app-droplang.html" title="droplang">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" lang="en">
<a name="app-dropdb"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>Name</h2>
<p>dropdb — remove a <span class="productname">PostgreSQL</span> database</p>
</div>
<a name="id793854"></a><div class="refsynopsisdiv">
<h2>Synopsis</h2>
<div class="cmdsynopsis"><p><code class="command">dropdb</code> [<em class="replaceable"><code>option</code></em>...] <em class="replaceable"><code>dbname</code></em> </p></div>
</div>
<div class="refsect1" lang="en">
<a name="id793890"></a><h2>Description</h2>
<p> <span class="application">dropdb</span> destroys an existing
<span class="productname">PostgreSQL</span> database.
The user who executes this command must be a database
superuser or the owner of the database.
</p>
<p> <span class="application">dropdb</span> is a wrapper around the
<acronym class="acronym">SQL</acronym> command <a href="sql-dropdatabase.html">DROP DATABASE</a>.
There is no effective difference between dropping databases via
this utility and via other methods for accessing the server.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id793939"></a><h2>Options</h2>
<p> <span class="application">dropdb</span> accepts the following command-line arguments:
</p>
<div class="variablelist"><dl>
<dt><span class="term"><em class="replaceable"><code>dbname</code></em></span></dt>
<dd><p> Specifies the name of the database to be removed.
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-e</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--echo</code></span>
</dt>
<dd><p> Echo the commands that <span class="application">dropdb</span> generates
and sends to the server.
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-i</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--interactive</code></span>
</dt>
<dd><p> Issues a verification prompt before doing anything destructive.
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-q</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--quiet</code></span>
</dt>
<dd><p> Do not display a response.
</p></dd>
</dl></div>
<p>
</p>
<p> <span class="application">dropdb</span> also accepts the following
command-line arguments for connection parameters:
</p>
<div class="variablelist"><dl>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-h <em class="replaceable"><code>host</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--host <em class="replaceable"><code>host</code></em></code></span>
</dt>
<dd><p> 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.
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-p <em class="replaceable"><code>port</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--port <em class="replaceable"><code>port</code></em></code></span>
</dt>
<dd><p> Specifies the TCP port or local Unix domain socket file
extension on which the server
is listening for connections.
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-U <em class="replaceable"><code>username</code></em></code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--username <em class="replaceable"><code>username</code></em></code></span>
</dt>
<dd><p> User name to connect as
</p></dd>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="option">-W</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="option">--password</code></span>
</dt>
<dd><p> Force password prompt.
</p></dd>
</dl></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id794115"></a><h2>Environment</h2>
<div class="variablelist"><dl>
<dt>
<span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="envar">PGHOST</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span xmlns="http://www.w3.org/TR/xhtml1/transitional" class="term"><code xmlns="" class="envar">PGPORT</code></span><br xmlns="http://www.w3.org/TR/xhtml1/transitional"></br><span class="term"><code class="envar">PGUSER</code></span>
</dt>
<dd><p> Default connection parameters
</p></dd>
</dl></div>
</div>
<div class="refsect1" lang="en">
<a name="id794138"></a><h2>Diagnostics</h2>
<p> In case of difficulty, see <a href="sql-dropdatabase.html">DROP DATABASE</a> and <a href="app-psql.html" title="psql"><span class="refentrytitle"><a name="app-psql-title"></a><span class="application">psql</span></span></a> 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 <span class="application">libpq</span> front-end
library will apply.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id794172"></a><h2>Examples</h2>
<p> To destroy the database <code class="literal">demo</code> on the default
database server:
</p>
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>dropdb demo</code></strong>
<code class="computeroutput">DROP DATABASE</code></pre>
<p>
</p>
<p> To destroy the database <code class="literal">demo</code> using the
server on host <code class="literal">eden</code>, port 5000, with verification and a peek
at the underlying command:
</p>
<pre class="screen"><code class="prompt">$ </code><strong class="userinput"><code>dropdb -p 5000 -h eden -i -e demo</code></strong>
<code class="computeroutput">Database "demo" will be permanently deleted.
Are you sure? (y/n) </code><strong class="userinput"><code>y</code></strong>
<code class="computeroutput">DROP DATABASE "demo"
DROP DATABASE</code></pre>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id794259"></a><h2>See Also</h2>
<span class="simplelist"><a href="app-createdb.html" title="createdb"><span class="refentrytitle"><a name="app-createdb-title"></a><span class="application">createdb</span></span></a>, <a href="sql-dropdatabase.html">DROP DATABASE</a>, Environment Variables (<a href="libpq-envars.html" title="28.11.Environment Variables">Section28.11, “Environment Variables”</a>)</span>
</div>
</div></body>
</html>
|