pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oli Sennhauser <oli.sennhauser@bluewin.ch>
To: Freddy Expósito Moreno <fredo@uh.cu>
To: pgsql-admin@postgresql.org
Subject: Re: close connection
Date: Fri, 07 Nov 2003 09:38:19 +0100
Message-ID: <3FAB59FB.8060604@bluewin.ch> (raw)
In-Reply-To: <3FAB2504.2080100@uh.cu>
References: <3FAB2504.2080100@uh.cu>

Freddy Expósito Moreno wrote:

> I need to close all connections from one database and keep all 
> connection from the other databases in my postgresql server.
>
> Can some body help me?

Hello Freddy

This could be a solution, but probably not a good/the best one:

1.) Mark out the database in pg_hba.conf, e.g.

# TYPE  DATABASE    USER        IP-ADDRESS        IP-MASK           METHOD
local   T740A       all                                             reject
local   all         all                                             trust

2.) Reload the cluster

pg_ctl reload -D $PG_DATA

or

pg_reload CLUSTER1   # with pg_env

Now no more new connections are possible

3.) Kill all processes which are related to your db

postgres@master:/u00/app/pgsql - rdbms740/template0> ps -fu postgres | 
grep T740A
postgres 28375 27864  1 09:16 pts/1    00:00:00 postgres: postgres T740A 
[local] idle

ps -fu postgres | grep T740A | grep -v grep | cut -d" " -f2 | \
while read pid ; do
  kill ${pid} 2>/dev/null
done

Regards Oli

-------------------------------------------------------

Oli Sennhauser
Database-Engineer (Oracle & PostgreSQL)
Rebenweg 6
CH - 8610 Uster / Switzerland

Phone (+41) 1 940 24 82 or Mobile (+41) 79 450 49 14
e-Mail oli.sennhauser@bluewin.ch
Website http://mypage.bluewin.ch/shinguz/PostgreSQL/

Secure (signed/encrypted) e-Mail with a Free Personal SwissSign ID: http://www.swisssign.ch

Import the SwissSign Root Certificate: http://swisssign.net/cgi-bin/trust/import

Attachments:

  smime.p7s (application/x-pkcs7-signature, 3.4K) download

view thread (4+ messages)  latest in thread

Message-ID: <3FAB59FB.8060604@bluewin.ch>
Permalink:  ../3FAB59FB.8060604@bluewin.ch/
Also on:    postgresql.org/message-id/3FAB59FB.8060604@bluewin.ch

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: oli.sennhauser@bluewin.ch, fredo@uh.cu
  Subject: Re: close connection
  In-Reply-To: <3FAB59FB.8060604@bluewin.ch>
  References: <3FAB2504.2080100@uh.cu> <3FAB59FB.8060604@bluewin.ch>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox