Killing active users

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Killing active users
Date: 2008-08-15 13:43:49
Message-ID: 0836165E8EE50F40A3DD8F0D87137267DE3057@azsmsx421.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

I have a system where I have 2 DBs. The first is available to the users
for general interaction. The second gets reloaded with new data once
per night and is then "renamed" to the active one if/when the reload
went successfully, preserving the old DB as a standby. Here's a
snapshot of that process.

alter database maindb rename to temp;

alter database standby rename to maindb

alter database temp rename to standby

The problem is that sometimes the rename fails because there are active
users on the available DB... DBD::Pg::db do failed: ERROR: database
"maindb" is being accessed by other users . Because the reload takes
place in the wee hours, I feel it's OK to kill any existing user
connections in order to prevent this if I have to.

Q: Is there a way to kill all active users on a DB without having to
reboot the DB?

Q: Or is my problem moot in that there is a way to leave those
connections alone and attached to the now renamed DB?

Thanks in Advance for any help

-dave

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2008-08-15 13:46:00 Re: [Q] DNS(bind) ER model
Previous Message Peter Eisentraut 2008-08-15 13:21:39 Re: table name length restriction