pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Frost <jeff@frostconsultingllc.com>
To: Carol Walter <walterc@indiana.edu>
Cc: pgsql-admin@postgresql.org
Subject: Re: Who's attached to the database?
Date: Thu, 03 Jul 2008 12:55:14 -0700
Message-ID: <486D2EA2.7040805@frostconsultingllc.com> (raw)
In-Reply-To: <9CB3C6A7-9E59-4A40-94BB-C2EE4150EC21@indiana.edu>
References: <9CB3C6A7-9E59-4A40-94BB-C2EE4150EC21@indiana.edu>

Carol Walter 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?
Carol, depending on version and options turned on in the 
postgresql.conf, you probably can have a look in the pg_stat_activity 
system view:

SELECT datname, client_addr FROM pg_stat_activity WHERE datname = '<db 
you're trying to drop>';

Otherwise, you can also have a look at the command line on linux servers 
like this:

ps -ef|grep postgres

or

ps aux | grep postgres

depending what ps variant your system includes.

-- 
Jeff Frost, Owner 	<jeff@frostconsultingllc.com>
Frost Consulting, LLC 	http://www.frostconsultingllc.com/
Phone: 650-780-7908	FAX: 650-649-1954




view thread (12+ messages)  latest in thread

Message-ID: <486D2EA2.7040805@frostconsultingllc.com>
Permalink:  ../486D2EA2.7040805@frostconsultingllc.com/
Also on:    postgresql.org/message-id/486D2EA2.7040805@frostconsultingllc.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jeff@frostconsultingllc.com, walterc@indiana.edu
  Subject: Re: Who's attached to the database?
  In-Reply-To: <486D2EA2.7040805@frostconsultingllc.com>

* 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