Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oibux-0005wE-14 for pgsql-admin@arkaria.postgresql.org; Wed, 12 Oct 2022 13:37:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oibuu-0003gp-VI for pgsql-admin@arkaria.postgresql.org; Wed, 12 Oct 2022 13:37:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oibuu-0003gf-H8 for pgsql-admin@lists.postgresql.org; Wed, 12 Oct 2022 13:37:00 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oibun-0006W5-JI for pgsql-admin@lists.postgresql.org; Wed, 12 Oct 2022 13:36:59 +0000 Received: by mail-ej1-x630.google.com with SMTP id 13so38055766ejn.3 for ; Wed, 12 Oct 2022 06:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:from:to:cc:subject:date :message-id:reply-to; bh=VA3VwT8y+8WthM7jGH427/483LbTvJyJvh8M0COfGiQ=; b=8HHp4Bx8nnCso1NwGhadZcdrhG+LrkUM3EiKly6LxlEN/1KLDsXiIzsZzuL/u8Fg+4 UVnPFgQJ7alXx09kW7q9kE5zGbRuwfa/HD3zCvuUZIrmq2nRQ+nDtzbeDfayNZRjXIqz Jp/Xb8jZhwps8HYaF+JAOCE5I9xsSJBPrAw7IJ4+JAjFMTJ6YOdTiX9PFieua5pXQwor NtWiqhLJMqEzF+045z4JPV6EBzvACJ6WYjZDVLArvUDq+10RrgSaZLMBgQYVCybZSwYo /PnEluYr1VeAnBJ7Wg2t/0+74+vUU43svVsGxFveQJF3fojzFznzJIMwxmYv9KglcQz8 0Q8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:date:to:from:subject:message-id:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VA3VwT8y+8WthM7jGH427/483LbTvJyJvh8M0COfGiQ=; b=14gzwu0jsdcCwj3cDUu+DBwagOQtGSblmoHs6ZFJSaSB28FryzqvFo7IDuNFztbt+D k0t47fm4NCJwQATPvJ3jDylEvQqqYLQLKj1J4x+GlnT6ByfKW3F9E4FdpTUumd9y+6vQ i4hc5gOPvnDINFMn4svMZRM/YbU31OcAK3tzNu/0oo9Td8yqrD5f9DU7dOczA1e4eA58 SOK39UIErETtiK/MAB0NmpONY3I9Txi1sJgsSjIAccAKhrr0cYqjvcJJINUiBcKPv4ys Tj26p0RIqwOB3JwxAUF60KI6PNahpLFd6S+Q+vr9weXgMItX0Bm9fckYXA51ypKVmRGa 4m7Q== X-Gm-Message-State: ACrzQf3QwVHbGtD2bkkalyjBZSxdbBBAHCnLIyIBrLxYK3xsfgN9NfBV xNUu7hi974YQeKQINK6a45XlRLwHPPwAAw== X-Google-Smtp-Source: AMsMyM5Em5PXh54QTBA1TcbkZspPwwOTGCUAqIq4BdqiTb44EeyXskK1rbzR42wPhI8Fe0LCYotB+A== X-Received: by 2002:a17:907:3e0f:b0:782:dc11:da99 with SMTP id hp15-20020a1709073e0f00b00782dc11da99mr21969388ejc.499.1665581812608; Wed, 12 Oct 2022 06:36:52 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:4e2c:199f:95ac:ae91:db7e]) by smtp.gmail.com with ESMTPSA id k25-20020a17090632d900b0078175601630sm1259868ejk.79.2022.10.12.06.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Oct 2022 06:36:52 -0700 (PDT) Message-ID: Subject: Re: Pg backup From: Laurenz Albe To: Nikhil Ingale , pgsql-admin@lists.postgresql.org Date: Wed, 12 Oct 2022 15:36:51 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-2.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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