Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: W S <ws3reg(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?
Date: 2008-04-10 19:37:29
Message-ID: 47FE6C79.1040603@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

W S wrote:
> Greetings,
>
> I was asked this question, and I wasn't sure if it is possible:
>
>
> do you know of a way to stop just one database (not delete/drop) on
> our PostgreSQL 8.1 server?

One possible way:

You can update its pg_database record, setting datallowconn to 'f' to
disable new connections to the DB, then boot off all existing users of
it by killing their backends. A discussion about this appeared here
recently, and a search of the archives for `datallowconn' should find it.

> And, while I know how to shut down postmaster, and/or put in rules to
> pg_hba.conf to limit access to a certain database, is there any way to
> freeze or stop just one database and not others? I'm attempting to
> RTFM it, but so far I've had no luck.

I haven't checked whether pg_hba.conf rules are reloaded, but `pg_ctl
reload' can re-read some settings without a postmaster restart. So you
might be able to disallow access in pg_hba then reload.

I'd be curious to know if that works and if/how it affects existing
connections - though I can always test it myself.

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Roberts, Jon 2008-04-10 19:46:36 pgcrypto and dblink
Previous Message Erik Jones 2008-04-10 19:28:52 Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?