Re: restoring a single database from a pg_dumpall dump file

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Matthias Apitz <guru(at)unixarea(dot)de>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: restoring a single database from a pg_dumpall dump file
Date: 2022-01-04 15:01:56
Message-ID: 4024278.1641308516@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Matthias Apitz <guru(at)unixarea(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Avi Weinberg 2022-01-04 15:47:55 Refresh ONE publication out of the Two Publications the Subscription has
Previous Message Michael Paquier 2022-01-04 11:52:56 Re: md5 issues Postgres14 on OL7