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 1kNmBe-0001GU-Ri for pgsql-general@arkaria.postgresql.org; Thu, 01 Oct 2020 00:11:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kNmBd-0002mf-QF for pgsql-general@arkaria.postgresql.org; Thu, 01 Oct 2020 00:11:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNmBd-0002mP-Ie for pgsql-general@lists.postgresql.org; Thu, 01 Oct 2020 00:11:05 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kNmBa-0002zB-Vu for pgsql-general@postgresql.org; Thu, 01 Oct 2020 00:11:05 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kNmBY-00076G-SL; Wed, 30 Sep 2020 20:11:00 -0400 Date: Wed, 30 Sep 2020 20:11:00 -0400 From: Bruce Momjian To: Glen Eustace Cc: pgsql-general@postgresql.org Subject: Re: Restoring a database problem Message-ID: <20201001001100.GC26860@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 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. > > What I want to know is how to quiese a database to that I can restore it. > > I need to close all existing connections and the prevent people/processes from > connecting again until the restore has completed. > > Currently I have been logging into a bunch of servers and stopping various > 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 so > advice gratefully received. I would modify pg_hba.conf to block access temporarily. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee