Re: Taking database offline

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: ow <oneway_111(at)yahoo(dot)com>
Cc: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>, pgsql-admin(at)postgresql(dot)org
Subject: Re: Taking database offline
Date: 2003-11-13 16:20:00
Message-ID: 200311131620.hADGK0l24065@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

ow wrote:
>
> --- Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> wrote:
> > No, I guess that is the problem. You can use restart, which will kick
> > everyone out, or you can use reload, but that doesn't kick people out of
> > the single database you want.
> >
>
> Restarting the db server triggers the whole chain of events: other dbs are
> affected, app servers will also need to restarted, and that has to be done
> twice (change pg_hba.conf and then reverse). There's got to be a better way.

OK, use reload, then use 'ps' to see the people connected to the
database and send a signal to the backend to for it to exit --- this is
how the postmaster does it.

Signals to use from the 7.4 postgres manual:

<para>
The <command>postmaster</command> uses <literal>SIGTERM</literal>
to tell a <command>postgres</command> process to quit normally and
<literal>SIGQUIT</literal> to terminate without the normal cleanup.
These signals <emphasis>should not</emphasis> be used by users. It is also
unwise to send <literal>SIGKILL</literal> to a <command>postgres</command>
process --- the <command>postmaster</command> will interpret this as
a crash in <command>postgres</command>, and will force all the sibling
<command>postgres</command> processes to quit as part of its standard
crash-recovery procedure.
</para>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message bagley@traderonline.com 2003-11-13 16:36:55 Re: can't connect to PostgreSQL Database using pgAdminII
Previous Message Naomi Walker 2003-11-13 15:54:43 Re: Upgrading to Solaris 9