From: Tom Lane <tgl@sss.pgh.pa.us>
To: Matthias Apitz <guru@unixarea.de>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: restoring a single database from a pg_dumpall dump file
Date: Tue, 04 Jan 2022 10:01:56 -0500
Message-ID: <4024278.1641308516@sss.pgh.pa.us> (raw)
In-Reply-To: <YdQFiQrF/2GXgxTI@pureos>
References: <YdQFiQrF/2GXgxTI@pureos>
Matthias Apitz <guru@unixarea.de> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, guru@unixarea.de
Subject: Re: restoring a single database from a pg_dumpall dump file
In-Reply-To: <4024278.1641308516@sss.pgh.pa.us>
References: <YdQFiQrF/2GXgxTI@pureos> <4024278.1641308516@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox