pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
how do i kill user sessions?
6+ messages / 5 participants
[nested] [flat]

* how do i kill user sessions?
@ 2005-05-11 20:08 Ing. Jhon Carrillo <jdigital@cantv.net>
  2005-05-11 20:26 ` Re: how do i kill user sessions? Scott Marlowe <smarlowe@g2switchworks.com>
  2005-05-13 13:26 ` Re: how do i kill user sessions? Gourish Singbal <gourish@gmail.com>
  0 siblings, 2 replies; 6+ messages in thread

From: Ing. Jhon Carrillo @ 2005-05-11 20:08 UTC (permalink / raw)
  To: pgsql-admin

I have a problem  with the users administration. When I want to erase (drop) some databases there's an error: ** database "name_db" is being accessed by other users.**  I want to kill the user sessions conected but i don't know how to do it   (Kill the user sessions).

thanks.

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: how do i kill user sessions?
  2005-05-11 20:08 how do i kill user sessions? Ing. Jhon Carrillo <jdigital@cantv.net>
@ 2005-05-11 20:26 ` Scott Marlowe <smarlowe@g2switchworks.com>
  2005-05-11 22:49   ` Re: how do i kill user sessions? Chris Browne <cbbrowne@acm.org>
  1 sibling, 1 reply; 6+ messages in thread

From: Scott Marlowe @ 2005-05-11 20:26 UTC (permalink / raw)
  To: Ing. Jhon Carrillo <jdigital@cantv.net>; +Cc: pgsql-admin

On Wed, 2005-05-11 at 15:08, Ing. Jhon Carrillo wrote:
> I have a problem  with the users administration. When I want to erase
> (drop) some databases there's an error: ** database "name_db" is being
> accessed by other users.**  I want to kill the user sessions conected
> but i don't know how to do it   (Kill the user sessions).

First, use ps to find the pid of the offending users.  for instance:

ps ax|grep postgres|grep test
18925 pts/1    S      0:00 postgres: postgres test [local] idle

then, as the postgres superuser, kill the backend:

kill 18925



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: how do i kill user sessions?
  2005-05-11 20:08 how do i kill user sessions? Ing. Jhon Carrillo <jdigital@cantv.net>
  2005-05-11 20:26 ` Re: how do i kill user sessions? Scott Marlowe <smarlowe@g2switchworks.com>
@ 2005-05-11 22:49   ` Chris Browne <cbbrowne@acm.org>
  2005-05-12 15:06     ` Re: how do i kill user sessions? Scott Marlowe <smarlowe@g2switchworks.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Chris Browne @ 2005-05-11 22:49 UTC (permalink / raw)
  To: pgsql-admin

smarlowe@g2switchworks.com (Scott Marlowe) writes:

> On Wed, 2005-05-11 at 15:08, Ing. Jhon Carrillo wrote:
>> I have a problem  with the users administration. When I want to erase
>> (drop) some databases there's an error: ** database "name_db" is being
>> accessed by other users.**  I want to kill the user sessions conected
>> but i don't know how to do it   (Kill the user sessions).
>
> First, use ps to find the pid of the offending users.  for instance:
>
> ps ax|grep postgres|grep test
> 18925 pts/1    S      0:00 postgres: postgres test [local] idle
>
> then, as the postgres superuser, kill the backend:
>
> kill 18925

You may want to be careful about what signal you submit.

If you do "kill -9", for instance, that may be a more severe
"thwacking" of the system than you intended.

Hitting it with "kill -2" is usually the right answer; that's SIGINT.

Other signals may cause the database to kill ALL the backends.  
"kill -3", for instance...

"kill -9" will terminate the whole database system, 'with extreme
prejudice,' which will be quite likely to turn out badly :-(.
-- 
(format nil "~S@~S" "cbbrowne" "acm.org")
http://www.ntlug.org/~cbbrowne/sap.html
Rules of the Evil Overlord #78.  "I will not tell my Legions of Terror
"And he must  be taken alive!" The command will be:  ``And try to take
him alive if it is reasonably practical.''"
<http://www.eviloverlord.com/;



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: how do i kill user sessions?
  2005-05-11 20:08 how do i kill user sessions? Ing. Jhon Carrillo <jdigital@cantv.net>
  2005-05-11 20:26 ` Re: how do i kill user sessions? Scott Marlowe <smarlowe@g2switchworks.com>
  2005-05-11 22:49   ` Re: how do i kill user sessions? Chris Browne <cbbrowne@acm.org>
@ 2005-05-12 15:06     ` Scott Marlowe <smarlowe@g2switchworks.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Scott Marlowe @ 2005-05-12 15:06 UTC (permalink / raw)
  To: Chris Browne <cbbrowne@acm.org>; +Cc: pgsql-admin

On Wed, 2005-05-11 at 17:49, Chris Browne wrote:
> smarlowe@g2switchworks.com (Scott Marlowe) writes:
> 
> > On Wed, 2005-05-11 at 15:08, Ing. Jhon Carrillo wrote:
> >> I have a problem  with the users administration. When I want to erase
> >> (drop) some databases there's an error: ** database "name_db" is being
> >> accessed by other users.**  I want to kill the user sessions conected
> >> but i don't know how to do it   (Kill the user sessions).
> >
> > First, use ps to find the pid of the offending users.  for instance:
> >
> > ps ax|grep postgres|grep test
> > 18925 pts/1    S      0:00 postgres: postgres test [local] idle
> >
> > then, as the postgres superuser, kill the backend:
> >
> > kill 18925
> 
> You may want to be careful about what signal you submit.
> 
> If you do "kill -9", for instance, that may be a more severe
> "thwacking" of the system than you intended.
> 
> Hitting it with "kill -2" is usually the right answer; that's SIGINT.
> 
> Other signals may cause the database to kill ALL the backends.  
> "kill -3", for instance...
> 
> "kill -9" will terminate the whole database system, 'with extreme
> prejudice,' which will be quite likely to turn out badly :-(.

Not exactly.  kill -9 on a single backend will not kill the whole
database but WILL cause all backends to terminate and the database
server to restart, which is rather severe.  

Also note that postgresql is designed to survive a kill -9 on all
signals with aplomb, but a production system is definitely not the place
to be testing it, eh?  :)

Also note that while most signal numbers are the same, it's a good idea
to use the text name assigned, as they are always pretty much the same
across different systems.  Without specifying a specific signal, a TERM
should be sent, which is a 15 on both Solaris and Linux and (I think)
BSD.

So, 'kill -s sigterm pidhere' is pretty much the same as 'kill pidhere'.



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: how do i kill user sessions?
  2005-05-11 20:08 how do i kill user sessions? Ing. Jhon Carrillo <jdigital@cantv.net>
@ 2005-05-13 13:26 ` Gourish Singbal <gourish@gmail.com>
  1 sibling, 0 replies; 6+ messages in thread

From: Gourish Singbal @ 2005-05-13 13:26 UTC (permalink / raw)
  To: Ing. Jhon Carrillo <jdigital@cantv.net>; +Cc: pgsql-admin

you can try.

1) ps -ef | grep "postgres"
    see which users are connectioned and than.
2) pkill -f 'postgres: postgres <databasename>';

its more safer i suppose than kill -9

regards
Gourish

On 5/12/05, Ing. Jhon Carrillo <jdigital@cantv.net> wrote:
> I have a problem  with the users administration. When I want to erase (drop)
> some databases there's an error: ** database "name_db" is being accessed by
> other users.**  I want to kill the user sessions conected but i don't know
> how to do it   (Kill the user sessions).
>  
> thanks.


-- 
Best,
Gourish Singbal



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: how do i kill user sessions?
@ 2005-05-13 14:36 Anjan Dave <adave@vantage.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Anjan Dave @ 2005-05-13 14:36 UTC (permalink / raw)
  To: Gourish Singbal <gourish@gmail.com>; Ing. Jhon Carrillo <jdigital@cantv.net>; +Cc: pgsql-admin

Or, 

Kill -s SIGINT <pid of offending statement>

Thanks,
Anjan

-----Original Message-----
From: Gourish Singbal [mailto:gourish@gmail.com] 
Sent: Friday, May 13, 2005 9:27 AM
To: Ing. Jhon Carrillo
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] how do i kill user sessions?

you can try.

1) ps -ef | grep "postgres"
    see which users are connectioned and than.
2) pkill -f 'postgres: postgres <databasename>';

its more safer i suppose than kill -9

regards
Gourish

On 5/12/05, Ing. Jhon Carrillo <jdigital@cantv.net> wrote:
> I have a problem  with the users administration. When I want to erase
(drop)
> some databases there's an error: ** database "name_db" is being
accessed by
> other users.**  I want to kill the user sessions conected but i don't
know
> how to do it   (Kill the user sessions).
>  
> thanks.


-- 
Best,
Gourish Singbal

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend




^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2005-05-13 14:36 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-05-11 20:08 how do i kill user sessions? Ing. Jhon Carrillo <jdigital@cantv.net>
2005-05-11 20:26 ` Scott Marlowe <smarlowe@g2switchworks.com>
2005-05-11 22:49   ` Chris Browne <cbbrowne@acm.org>
2005-05-12 15:06     ` Scott Marlowe <smarlowe@g2switchworks.com>
2005-05-13 13:26 ` Gourish Singbal <gourish@gmail.com>
2005-05-13 14:36 Re: how do i kill user sessions? Anjan Dave <adave@vantage.com>

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