Re: Way to shutdown/freeze/stop an individual database without taking postmaster down? - Mailing list pgsql-general

From Craig Ringer
Subject Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?
Date
Msg-id 47FE6C79.1040603@postnewspapers.com.au
Whole thread Raw
In response to Way to shutdown/freeze/stop an individual database without taking postmaster down?  ("W S" <ws3reg@gmail.com>)
Responses Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?  (Erik Jones <erik@myemma.com>)
List 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

pgsql-general by date:

Previous
From: Ben
Date:
Subject: Re: Way to shutdown/freeze/stop an individual database without taking postmaster down?
Next
From: Sam Mason
Date:
Subject: Re: percentile rank query