Re: Cannot drop database that is in use (NOT)

From: Gary Stainburn <gary(dot)stainburn(at)ringways(dot)co(dot)uk>
To: Jie Liang <jliang(at)ipinc(dot)com>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Cannot drop database that is in use (NOT)
Date: 2001-07-03 15:04:01
Message-ID: 01070316040102.03765@gary.ringways.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Monday 02 July 2001 7:46 pm, Jie Liang wrote:
> what's in your script??
>

[revcom(at)curly revcom]$ more bin/recreate
#!/bin/bash

dropdb revcom
createdb revcom
psql <schema.sql

Doing 'apactrl graceful' did the trick, but a way where I don't need to gain
access to the web server would be nice.

Gary
>
> Jie LIANG
>
> St. Bernard Software
>
> 10350 Science Center Drive
> Suite 100, San Diego, CA 92121
> Office:(858)320-4873
>
> jliang(at)ipinc(dot)com
> www.stbernard.com
> www.ipinc.com
>
> On Mon, 2 Jul 2001, Gary Stainburn wrote:
> > Hi all,
> >
> > I'm developing a database and have a small shell script that drops the
> > database, creates it, and then feeds psql to create the tables etc.
> >
> > I've tried to run it and get the following error:
> > [revcom(at)curly revcom]$ recreate
> > ERROR: DROP DATABASE: Database "revcom" is being accessed by other users
> > dropdb: database removal failed
> > ERROR: CREATE DATABASE: database "revcom" already exists
> > createdb: database creation failed
> > ERROR: Relation 'teams_tid_seq' already exists
> > ERROR: Relation 'members_mid_seq' already exists
> > blah blah....
> >
> > I know that there is nobody using the database, so I can only assume it
> > is some left-over garbage from my first every php script (as I don't know
> > how to close the link openned by pg_pconnect).
> >
> > How do I close any pending connections and reset the usage count so that
> > I can drop the database?
> >
> > --
> > Gary Stainburn
> >
> > This email does not contain private or confidential material as it
> > may be snooped on by interested government parties for unknown
> > and undisclosed purposes - Regulation of Investigatory Powers Act, 2000
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster

--
Gary Stainburn

This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2001-07-03 16:18:46 Re: Problems running postgres on XFS+LVM on Linux
Previous Message Oleg Bartunov 2001-07-03 14:04:01 Re: Word Indexing