Unix Technical Forum

Who's attached to the database?

This is a discussion on Who's attached to the database? within the pgsql Admins forums, part of the PostgreSQL category; --> try this select pg_cancel_backend(<processid_db>); if the command not work kill the process in os kill -9 proccessid_os --- On ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Admins

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 07-04-2008, 04:38 PM
Lennin Caro
 
Posts: n/a
Default Re: Who's attached to the database?

try this

select pg_cancel_backend(<processid_db>);

if the command not work kill the process in os

kill -9 proccessid_os



--- On Thu, 7/3/08, Carol Walter <walterc@indiana.edu> wrote:

> From: Carol Walter <walterc@indiana.edu>
> Subject: Re: [ADMIN] Who's attached to the database?
> To: "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
> Cc: pgsql-admin@postgresql.org
> Date: Thursday, July 3, 2008, 8:07 PM
> Thanks, guys,
>
> This told me that the user that has it open is the
> interface user
> called db_user. Is there a command to disconnect this
> user?
>
> Carol
>
> On Jul 3, 2008, at 3:53 PM, Kevin Grittner wrote:
>
> >>>> Carol Walter <walterc@indiana.edu>

> wrote:
> >> I'm trying to drop a database and I'm

> getting an error that says that
> >
> >> the database is being accessed by other users. Is

> there a way I can
> >
> >> find out who these users are or if there really is

> a user accessing
> > it?
> >
> > select * from pg_stat_activity where datname =

> 'yourdb';
> >
> > -Kevin

>
>
> --
> Sent via pgsql-admin mailing list
> (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin






--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 07-05-2008, 02:17 AM
Tino Schwarze
 
Posts: n/a
Default Re: Who's attached to the database?

On Fri, Jul 04, 2008 at 06:50:43AM -0700, Lennin Caro wrote:
> try this
>
> select pg_cancel_backend(<processid_db>);
>
> if the command not work kill the process in os
>
> kill -9 proccessid_os


*NO*! Never kill -9 a postgres backend!!! This is like a headshot, no
chance to clean up. You will make your whole pg server shut down!

A simple kill should suffice.

Tino.

--
"What we nourish flourishes." - "Was wir nähren erblüht."

www.craniosacralzentrum.de
www.forteego.de

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:54 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com