Re: pg_dump / pgrestore question - cannot restore a single schema

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxxxxxxx> 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

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux