X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 543B2D1B4E1 for ; Fri, 7 Nov 2003 14:05:15 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 14557-09 for ; Fri, 7 Nov 2003 10:04:47 -0400 (AST) Received: from smtp2.uh.cu (smtp2.uh.cu [200.55.139.213]) by svr1.postgresql.org (Postfix) with ESMTP id 0D3E1D1B507 for ; Fri, 7 Nov 2003 10:04:30 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.uh.cu (Postfix) with ESMTP id D6C3334DDF; Fri, 7 Nov 2003 08:07:56 -0500 (CST) Received: from comuh.uh.cu (cisco2621.uh.cu [200.55.139.210]) by smtp2.uh.cu (Postfix) with ESMTP id ABEAB34929; Fri, 7 Nov 2003 08:07:56 -0500 (CST) Received: from uh.cu (nilo.uh.cu [192.168.100.37]) by comuh.uh.cu (Postfix) with ESMTP id DA81632CAB; Fri, 7 Nov 2003 08:07:53 -0500 (CST) Message-ID: <3FAB9B69.5010905@uh.cu> Date: Fri, 07 Nov 2003 08:17:29 -0500 From: =?ISO-8859-1?Q?Freddy_Exp=F3sito_Moreno?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Oli Sennhauser Cc: pgsql-admin@postgresql.org Subject: Re: close connection References: <3FAB2504.2080100@uh.cu> <3FAB59FB.8060604@bluewin.ch> In-Reply-To: <3FAB59FB.8060604@bluewin.ch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by AMaViS snapshot-20020300 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/119 X-Sequence-Number: 11107 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@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 >