From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Nikhil Ingale <niks.bgm@gmail.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Pg backup
Date: Wed, 12 Oct 2022 15:36:51 +0200
Message-ID: <f82cf06b30eb9c727289ce909f3a8f180209dde6.camel@cybertec.at> (raw)
In-Reply-To: <CALXkTpyYopVy_P4CS8hY77arWo_XvpNYfZniEKFxoF1zXeCZuQ@mail.gmail.com>
References: <CALXkTpyYopVy_P4CS8hY77arWo_XvpNYfZniEKFxoF1zXeCZuQ@mail.gmail.com>
On Wed, 2022-10-12 at 16:29 +0530, Nikhil Ingale wrote:
> How do I take the backup of all the tables (no table data, no functions and other objects) only from one schema and restore to another schema?
Perform a dump with
pg_dump --schema=yourschema --schema-only dbname
Create a new database, restore the dump into the new database, rename the schema there,
dump the new database and drop it, then import the new dump into the original database.
Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: laurenz.albe@cybertec.at, niks.bgm@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: Pg backup
In-Reply-To: <f82cf06b30eb9c727289ce909f3a8f180209dde6.camel@cybertec.at>
* 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