<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 'http://www.w3.org/TR/html4/loose.dtd"'> <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Deleting a tablespace</title><link rel="stylesheet" type="text/css" href="openacs.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.0"><link rel="home" href="index.html" title="OpenACS Core Documentation"><link rel="up" href="database-management.html" title="Chapter 7. Database Management"><link rel="previous" href="remote-postgres.html" title="Running a PostgreSQL database on another server"><link rel="next" href="install-next-nightly-vacuum.html" title="Vacuum Postgres nightly"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><a href="http://openacs.org"><img src="/doc/images/alex.jpg" style="border:0" alt="Alex logo"></a><table width="100%" summary="Navigation header" border="0"><tr><td width="20%" align="left"><a accesskey="p" href="remote-postgres.html">Prev</a> </td><th width="60%" align="center">Chapter 7. Database Management</th><td width="20%" align="right"> <a accesskey="n" href="install-next-nightly-vacuum.html">Next</a></td></tr></table><hr></div><div class="sect1" title="Deleting a tablespace"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="install-openacs-delete-tablespace"></a>Deleting a tablespace</h2></div></div></div><p>Skip down for instructions on <a class="xref" href="install-openacs-delete-tablespace.html#install-openacs-delete-postgres-tablespace" title="Deleting a PostgreSQL tablespace">Deleting a PostgreSQL tablespace</a>. </p><div class="sect2" title="Deleting an Oracle tablespace"><div class="titlepage"><div><div><h3 class="title"><a name="install-openacs-delete-oracle-tablespace"></a>Deleting an Oracle tablespace</h3></div></div></div><p> Should it become necessary to rebuild a tablespace from scratch, you can use the <code class="computeroutput">drop user</code> command in SVRMGRL with the <code class="computeroutput">cascade</code> option. This command will drop the user and every database object the user owns.</p><pre class="programlisting">SVRMGR> <strong class="userinput"><code>drop user <span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span> cascade;</code></strong></pre><p> If this does not work because svrmgrl "cannot drop a user that is currently connected", make sure to kill the AOLserver using this user. If it still does not work, do:</p><pre class="programlisting">SVRMGR> <strong class="userinput"><code>select username, sid, serial# from v$session where lower(username)='<span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span>';</code></strong></pre><p>and then</p><pre class="programlisting">SVRMGR> <strong class="userinput"><code>alter system kill session '<span class="replaceable"><span class="replaceable">sid, serial#</span></span>';</code></strong></pre><p> where <span class="emphasis"><em>sid</em></span> and <span class="emphasis"><em>serial#</em></span> are replaced with the corresponding values for the open session.</p><p><span class="strong"><strong>Use with caution!</strong></span></p><p> If you feel the need to delete <span class="emphasis"><em>everything</em></span> related to the service, you can also issue the following:</p><pre class="programlisting">SVRMGR> <strong class="userinput"><code>drop tablespace <span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span> including contents cascade constraints;</code></strong></pre></div><div class="sect2" title="Deleting a PostgreSQL tablespace"><div class="titlepage"><div><div><h3 class="title"><a name="install-openacs-delete-postgres-tablespace"></a>Deleting a PostgreSQL tablespace</h3></div></div></div><p> Dropping a PostgreSQL tablespace is easy. You have to stop any AOLserver instances that are using the database that you wish to drop. If you're using daemontools, this is simple, just use the 'down' flag (-d). If you're using inittab, you have to comment out your server in <code class="computeroutput">/etc/inittab</code>, reread the inittab with <code class="computeroutput">/sbin/init q</code>, and then <code class="computeroutput">restart-aolserver <span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span></code>.</p><p>Then, to drop the db, just do:</p><pre class="programlisting"> [$OPENACS_SERVICE_NAME ~]$ <strong class="userinput"><code>dropdb <span class="replaceable"><span class="replaceable">$OPENACS_SERVICE_NAME</span></span></code></strong> DROP DATABASE</pre></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="remote-postgres.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="install-next-nightly-vacuum.html">Next</a></td></tr><tr><td width="40%" align="left">Running a PostgreSQL database on another server </td><td width="20%" align="center"><a accesskey="u" href="database-management.html">Up</a></td><td width="40%" align="right"> Vacuum Postgres nightly</td></tr></table><hr><address><a href="mailto:docs@openacs.org">docs@openacs.org</a></address></div><a name="comments"></a><center><a href="http://openacs.org/doc/current/install-openacs-delete-tablespace.html#comments">View comments on this page at openacs.org</a></center></body></html>