Re: User Backend Sessions

From: "Carl Olivier" <carl(at)zero-one(dot)co(dot)za>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: User Backend Sessions
Date: 2003-03-07 12:14:50
Message-ID: BCEKIKAMLDKFEKBNELFKEEMNCGAA.carl@zero-one.co.za
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

OK, so let me ask this question a different way...

If you needed to DROP a database via JDBC (or other interface) where there
could POTENTIALLY be active sessions (backends) on the specified databases,
as well as OTHER databases active on the server where the specified database
(i.e. you cannot shot the db (PSql) server down)...

HOW would YOU do it??

PLEASE help! So stuck!!

;(

Thanks,

Carl
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org]On Behalf Of Carl Olivier
Sent: 07 March 2003 01:18 PM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] User Backend Sessions
Importance: High

Greetings.

OK, I am having a problem, and it is driving me mad!

I want to kill off active sessions for a specific database.

Now, I have installed PSQL with PL/PERL support and have created a
function that allows PSQL to run shell commands.

So, from here I can use Sql to get a list of the procpids for backends
active for a specific database.

now, kill -9 is obviously NOT the best idea to use (i.e. to manually and
brute force-like kill the postmaster processes for the backends identified).

What other methods are there for me to use?

After the backends have been killed, I wish to call the DROP DATABASE
dbname command via SQL - which does not work unless no sessions are active
for the DB.

Can anyone assist me here? Is there a "clean" way to kill of the
connections, even if I need to wait for them to finish their tasks then shut
down, so that I can safely call DROP DATABASE?!

Please help!

Thanks in advance,

Carl

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2003-03-07 13:10:58 Re: My contract has been renewed
Previous Message Cristian Custodio 2003-03-07 12:04:17 coerce_type: no conversion function from "unknown type" to text