pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
restoring a single database from a pg_dumpall dump file
2+ messages / 2 participants
[nested] [flat]

* restoring a single database from a pg_dumpall dump file
@ 2022-01-04 08:30  Matthias Apitz <guru@unixarea.de>
  0 siblings, 1 reply; 2+ messages in thread

From: Matthias Apitz @ 2022-01-04 08:30 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello,

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?

Thanks in advance

	matthias
-- 
Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: restoring a single database from a pg_dumpall dump file
@ 2022-01-04 15:01  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Matthias Apitz <guru@unixarea.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2022-01-04 15:01 UTC (permalink / raw)
  To: Matthias Apitz <guru@unixarea.de>; +Cc: pgsql-general@lists.postgresql.org

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





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2022-01-04 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-01-04 08:30 restoring a single database from a pg_dumpall dump file Matthias Apitz <guru@unixarea.de>
2022-01-04 15:01 ` Tom Lane <tgl@sss.pgh.pa.us>

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