If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > PostgreSQL > delete user problem

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-17-11, 23:08
raykar raykar is offline
Registered User
 
Join Date: Jun 2011
Location: Brisbane, Australia
Posts: 4
delete user problem

I have a user set up in a postgresql DB and am trying to delete the user and the db.
When I use dropdb, I get the message "failed to delete, there are 6 sessions still using this DB".

Does any one have any suggestions please?
Reply With Quote
  #2 (permalink)  
Old 06-18-11, 03:00
rski rski is offline
Registered User
 
Join Date: Nov 2006
Posts: 82
Disconnect all sessions first.
Reply With Quote
  #3 (permalink)  
Old 06-18-11, 03:21
raykar raykar is offline
Registered User
 
Join Date: Jun 2011
Location: Brisbane, Australia
Posts: 4
Disconnect all sessions first

Thank you

But how do I disconnect all of the sessions? please.
Reply With Quote
  #4 (permalink)  
Old 06-18-11, 04:00
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
Quote:
Originally Posted by raykar View Post
But how do I disconnect all of the sessions? please.
The clean way is to shut down those applications that are establishing those connections.
You can use the pg_stat_activity view (see http://www.postgresql.org/docs/curre...ing-stats.html) to find out what applications are connecting (and from where).

If you want to do it the hard way, you can use pg_terminate_backend() to kill those sessions.
For details see here: http://www.postgresql.org/docs/curre...N-SIGNAL-TABLE
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On