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 1n4lKA-00027Q-PN for pgsql-general@arkaria.postgresql.org; Tue, 04 Jan 2022 15:02: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 1n4lK8-0003xl-Rk for pgsql-general@arkaria.postgresql.org; Tue, 04 Jan 2022 15:02:04 +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 1n4lK8-0003xb-HG for pgsql-general@lists.postgresql.org; Tue, 04 Jan 2022 15:02:04 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n4lK3-0006jr-Jz for pgsql-general@lists.postgresql.org; Tue, 04 Jan 2022 15:02:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 204F1u2K4024279; Tue, 4 Jan 2022 10:01:57 -0500 From: Tom Lane To: Matthias Apitz cc: pgsql-general@lists.postgresql.org Subject: Re: restoring a single database from a pg_dumpall dump file In-reply-to: References: Comments: In-reply-to Matthias Apitz message dated "Tue, 04 Jan 2022 09:30:01 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4024277.1641308516.1@sss.pgh.pa.us> Date: Tue, 04 Jan 2022 10:01:56 -0500 Message-ID: <4024278.1641308516@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Matthias Apitz writes: > We're using pg_dumpall (from 14.1) to dump older clusters and > restore them into a new 14.1 cluster. The dump contains some databases > together with roles etc. > Is there some easy way to restore only one database out of this dump > file? No; pg_dumpall's output is just a flat SQL script. You might consider using "pg_dumpall -g" to get just the roles (and tablespaces if any), and then dumping desired databases individually with pg_dump. If all you have is a previously-made dumpall script, you'd have to slice it up with an editor. regards, tom lane