Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNmeu-0002Sh-6o for pgsql-general@arkaria.postgresql.org; Thu, 01 Oct 2020 00:41:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNmet-0002MU-5S for pgsql-general@arkaria.postgresql.org; Thu, 01 Oct 2020 00:41:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNmes-0002MN-Tw for pgsql-general@lists.postgresql.org; Thu, 01 Oct 2020 00:41:18 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kNmeq-00080M-AE for pgsql-general@postgresql.org; Thu, 01 Oct 2020 00:41:17 +0000 Received: by mail-ot1-x329.google.com with SMTP id m12so3762973otr.0 for ; Wed, 30 Sep 2020 17:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=KhXngaIOVJy1j/ugjBrggT0tAjYUFc7Ch/mGfLVc4qg=; b=CK6881sIwo62mt7PWuN2amXB0G0hNisUT3kJ7wD5en6CdjdRTrt0pkTb4sIzVy7sok A9/a3xPMQl3GplO1rh8KhUl/SLRZeExpXAe2Ehx2wZ1LWGH9Sa5mi9tl9mpmZrcSuBra GMvdwy+/WjGS1giY08UTgL7AaIPGvzDYsOOoV90iO/jrb22pTjFvohxiE/Ge3bwx+PDN U4fS9Q9mE4lbWOqgXNW0rEXoYF/k4vzxsnTgaU1t8Jjy86K58xgjcf5w4c4QSU72PvV6 yOaz8p3NNFnWqXdVxxSlI84wfvJZMNbXhBRYihgsWO7VXFS1xgM/nKv7DcOKryH5EmmE Hlug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=KhXngaIOVJy1j/ugjBrggT0tAjYUFc7Ch/mGfLVc4qg=; b=Csf1VIfnlDxWObhqKBhK1xs9sUUWVaGKqyMjWP4XJfEt0GQXCBWw+3/N+AIBloAnwW ddZAatENqOun7t61FZxUjDSRgrUSb5LuD4/u96DnS+c2v8OUukM9xJGFcVS5vf/9RXXb LnlthIthmzRP7Sas/s/IRIOvnGSlu7G9cMNQJR8KXlbk6jsDh0/mdqMyuoY2fsbLP+hL y6XmvHFXSIbMtxgpxU32Z4p3GWjqT3R7LNTLeiKx8ezPX2P/zBZoH/DgEaS3oPUgol0J 2hzSsQUq/KFkAqbUQ6uLPonyp9rcdvYbYiRdoCwrgGD+x2eJQQWmwfnM4ly7860pF9dO DmPw== X-Gm-Message-State: AOAM533CoYGsidOPAI6feYcv2dx8l+91NAz8N4RZpfZ2FtvmFs4Vpf86 QrDr/E2op74JeNgMxBJAtxQ= X-Google-Smtp-Source: ABdhPJwFvnNcFU9zn0HH4B5ca8soDEv0zaE843SIdO5x0JRciihNSsancuYbLCEJG9bN04jK2WFeFA== X-Received: by 2002:a05:6830:22d7:: with SMTP id q23mr3241167otc.322.1601512875357; Wed, 30 Sep 2020 17:41:15 -0700 (PDT) Received: from ?IPv6:2601:681:5500:dde0:69e1:3550:e942:beee? ([2601:681:5500:dde0:69e1:3550:e942:beee]) by smtp.gmail.com with ESMTPSA id 92sm791972ota.38.2020.09.30.17.41.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 30 Sep 2020 17:41:14 -0700 (PDT) Content-Type: multipart/alternative; boundary=Apple-Mail-422C6F89-4BD8-41F7-A18D-AE1B1D306F7E Content-Transfer-Encoding: 7bit From: Rob Sargent Mime-Version: 1.0 (1.0) Subject: Re: Restoring a database problem Date: Wed, 30 Sep 2020 18:41:13 -0600 Message-Id: References: <20201001001100.GC26860@momjian.us> Cc: Glen Eustace , pgsql-general@postgresql.org In-Reply-To: <20201001001100.GC26860@momjian.us> To: Bruce Momjian X-Mailer: iPhone Mail (17H35) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail-422C6F89-4BD8-41F7-A18D-AE1B1D306F7E Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > On Sep 30, 2020, at 6:11 PM, Bruce Momjian wrote: >=20 > =EF=BB=BFOn Thu, Oct 1, 2020 at 01:00:21PM +1300, Glen Eustace wrote: >> I have had to do this so rarely and it has almost always been in a bit of= a >> panic so may well be missing something really obvious. >>=20 >> What I want to know is how to quiese a database to that I can restore it.= >>=20 >> I need to close all existing connections and the prevent people/processes= from >> connecting again until the restore has completed. >>=20 >> Currently I have been logging into a bunch of servers and stopping variou= s >> daemons, then on the database server killing processes until the database= is >> apparently idle then dropping the database and doing the restore. Then >> restarting the daemons etc. I am sure I am not doing this the right way s= o >> advice gratefully received. >=20 > I would modify pg_hba.conf to block access temporarily. >=20 > --=20 > Bruce Momjian https://momjian.us > EnterpriseDB https://enterprisedb.com >=20 > The usefulness of a cup is in its emptiness, Bruce Lee >=20 https://www.google.com/url?sa=3Dt&source=3Dweb&cd=3D&ved=3D2ahUKEwiB56D1k5Ls= AhXBAp0JHQkYA3MQFjAAegQIBxAB&url=3Dhttps%3A%2F%2Fstackoverflow.com%2Fquestio= ns%2F35319597%2Fhow-to-stop-kill-a-query-in-postgresql&usg=3DAOvVaw0NOCdUxbK= HpDTqHulgubqC >=20 --Apple-Mail-422C6F89-4BD8-41F7-A18D-AE1B1D306F7E Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable


On Sep 30, 2020, at 6:11 PM, Bruce Momjian &l= t;bruce@momjian.us> wrote:

=EF=BB=BFOn Thu, Oct  1, 2020 at 01:00:21P= M +1300, Glen Eustace wrote:
I hav= e had to do this so rarely and it has almost always been in a bit of a
panic so may well be missi= ng something really obvious.

What I want t= o know is how to quiese a database to that I can restore it.

I need to close all existing connections and the prevent p= eople/processes from
= connecting again until the restore has completed.

Currently I have been logging into a bunch of servers and stopping v= arious
daemons, then o= n the database server killing processes until the database is
apparently idle then dropping the d= atabase and doing the restore. Then
restarting the daemons etc. I am sure I am not doing this the r= ight way so
advice gr= atefully received.

I would mod= ify pg_hba.conf to block access temporarily.

--
 Bruce Momjian  <bruce@momjian.us> &n= bsp;      https://momjian.us
&= nbsp;EnterpriseDB          &nbs= p;            &n= bsp;     https://enterprisedb.com
<= /span>
 The usefulness of a cup is in its emptiness, Bruce Le= e

https://www.google.com/url?sa=3Dt&source=3Dweb&cd=3D= &ved=3D2ahUKEwiB56D1k5LsAhXBAp0JHQkYA3MQFjAAegQIBxAB&url=3Dhttps%3A%= 2F%2Fstackoverflow.com%2Fquestions%2F35319597%2Fhow-to-stop-kill-a-query-in-= postgresql&usg=3DAOvVaw0NOCdUxbKHpDTqHulgubqC



<= /body>= --Apple-Mail-422C6F89-4BD8-41F7-A18D-AE1B1D306F7E--