Re: close connection

From: Freddy Expósito Moreno <fredo(at)uh(dot)cu>
To: Oli Sennhauser <oli(dot)sennhauser(at)bluewin(dot)ch>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: close connection
Date: 2003-11-07 13:17:29
Message-ID: 3FAB9B69.5010905@uh.cu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

This is a good idea if I want to reject the access to this database
every time but in my case I need to close de access to one database
one time and could be any database in any moment. A need a dynamic solution.

Thanks any way Oli

Oli Sennhauser wrote:

> 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(at)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(dot)sennhauser(at)bluewin(dot)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
>

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message alvaro 2003-11-07 13:56:28 Problems creating users
Previous Message Jeff 2003-11-07 13:16:53 Re: read only connection