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
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>19.5.Destroying a Database</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="managing-databases.html" title="Chapter19.Managing Databases">
<link rel="prev" href="manage-ag-config.html" title="19.4.Database Configuration">
<link rel="next" href="manage-ag-tablespaces.html" title="19.6.Tablespaces">
<link rel="copyright" href="ln-legalnotice.html" title="Legal Notice">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="sect1" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="manage-ag-dropdb"></a>19.5.Destroying a Database</h2></div></div></div>
<p> Databases are destroyed with the command
<a href="sql-dropdatabase.html">DROP DATABASE</a>:<a name="id659776"></a>
</p>
<pre class="synopsis">DROP DATABASE <em class="replaceable"><code>name</code></em>;</pre>
<p>
Only the owner of the database, or
a superuser, can drop a database. Dropping a database removes all objects
that were
contained within the database. The destruction of a database cannot
be undone.
</p>
<p> You cannot execute the <code class="command">DROP DATABASE</code> command
while connected to the victim database. You can, however, be
connected to any other database, including the <code class="literal">template1</code>
database.
<code class="literal">template1</code> would be the only option for dropping the last user database of a
given cluster.
</p>
<p> For convenience, there is also a shell program to drop
databases, <a href="app-dropdb.html" title="dropdb"><span class="refentrytitle"><a name="app-dropdb-title"></a><span class="application">dropdb</span></span></a>:<a name="id659835"></a>
</p>
<pre class="synopsis">dropdb <em class="replaceable"><code>dbname</code></em></pre>
<p>
(Unlike <code class="command">createdb</code>, it is not the default action to drop
the database with the current user name.)
</p>
</div></body>
</html>
|