From: | Holger Jakobs <holger(at)jakobs(dot)com> |
---|---|
To: | pgsql-admin(at)lists(dot)postgresql(dot)org |
Subject: | Re: pg_dump / pgrestore question - cannot restore a single schema |
Date: | 2020-03-24 00:55:32 |
Message-ID: | 1226ea80-e760-54ff-47e3-c2a0c90cf1e0@jakobs.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-admin |
You could also extract the commands for creating the schema contained in
the dump using the following commands:
schemaname=whatever_your_schemaname_is
pg_restore -l /tmp/dump | grep "SCHEMA - $schemaname" >
/tmp/objects_to_re-create
pg_restore -L /tmp/objects_to_re-create -f - /tmp/my_custom_dump | psql
and then
pg_restore -n "$schemaname" /tmp//tmp/my_custom_dump | psql
in order to re-create the contents of the schema.
Regards,
Holger
Am 24.03.20 um 01:40 schrieb David G. Johnston:
> On Mon, Mar 23, 2020 at 4:47 PM S.Bob <sbob(at)quadratum-braccas(dot)com
> <mailto:sbob(at)quadratum-braccas(dot)com>> wrote:
>
> However if I try to restore only one of the schemas it does not
> work, seems like it does not create the schema first:
>
> Since you have to know the schema name anyway in order to restore that
> schema only just go ahead an create the schema before performing the
> restore. It seems that since a schema is not "in itself" it doesn't
> get restored. Doesn't seem like a problem.
>
> David J.
>
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2020-03-24 05:26:06 | Re: PG12 autovac issues |
Previous Message | David G. Johnston | 2020-03-24 00:40:09 | Re: pg_dump / pgrestore question - cannot restore a single schema |