Re: force drop of database others are accessing

From: Andrew Sullivan <ajs(at)crankycanuck(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: force drop of database others are accessing
Date: 2004-01-24 00:41:11
Message-ID: 20040124004111.GA13227@phlogiston.dyndns.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Jan 24, 2004 at 12:18:06AM +0000, Lee Harr wrote:
> Every once in a while my automated script fails because
> some other system which should have disconnected
> failed to unhook. The old data and old connection are
> not important to me. The new run needs to go through.

You can look for people connected and kick them out with kill -2 on
their pid. The trick is to start your own script (which probably
isn't "failing" exactly, but blocking, right?), and then (since
you've locked the relevant objects that way, such that nobody else
can get in) use the shell to kill -2 other connections. Evil and
possibly dangerous, but you said you didn't care about the old data.

A

--
Andrew Sullivan | ajs(at)crankycanuck(dot)ca
I remember when computers were frustrating because they *did* exactly what
you told them to. That actually seems sort of quaint now.
--J.D. Baldwin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-01-24 01:02:24 Re: [GENERAL] Recursive optimization of IN subqueries
Previous Message Lee Harr 2004-01-24 00:18:06 force drop of database others are accessing