Re: Pg backup

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Nikhil Ingale <niks(dot)bgm(at)gmail(dot)com>, pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Pg backup
Date: 2022-10-12 13:36:51
Message-ID: f82cf06b30eb9c727289ce909f3a8f180209dde6.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

In response to

  • Pg backup at 2022-10-12 10:59:08 from Nikhil Ingale

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Ebin Jozer 2022-10-12 13:43:41 Postgresql community edition upgrade
Previous Message Zaid Shabbir 2022-10-12 11:16:04 Re: SSL Implementation