Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtEpz-00023z-WF for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 16:53:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gtEpy-0001XA-JI for pgsql-general@arkaria.postgresql.org; Mon, 11 Feb 2019 16:53:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtEpy-0001Vp-7h for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 16:53:42 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gtEpv-0007LJ-Gt for pgsql-general@lists.postgresql.org; Mon, 11 Feb 2019 16:53:41 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 0162A3100; Mon, 11 Feb 2019 11:53:37 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 11 Feb 2019 11:53:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=0 5DE0jmk3t1hLLHHI1znzTiqciOAtoVnfMH39jb2ADI=; b=VEsO1IvwDOTu4v90o QizkZ4ds19TwQQ/LOH4RqvEnYwKo7a0KzzmqqPMGdjicVdWemfemgKugicfG3wGz 4RnWF6ITUpI0gYMaWpWcQXsuZEIDciWMisbfVhM9OAhPook7QXq/Mm02xnslEtLA SBu9bTlLaC9jhEUt2aZNq/Ftbh3kZXVTLSMnQx1qOiSEt2nc8Gj25vLBw2dJdM3o ihIeit1G2vww5/6K/UghqjmnaFsnArbBlBOtnH8ArXLfIvp64o6PLi2XciVyHd0b 0TySWW9oxqv6Ts3k3VJR0RXELVbDNoJYP4PzRzeIVb2I//u6omdL+dWFWkIRYwFm bmHHA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=05DE0jmk3t1hLLHHI1znzTiqciOAtoVnfMH39jb2A DI=; b=FHFQXEjo/shf36KjPCKdI0bHMz+jlT7s/VdHKadEpaFnfgkSgBAfT4AcU R4UM8vAyl/DpCAxiFiHgQKyz44LYEg40VSlsG8OEbSJ3WMVQLhEZA9qN2SDF21TE BMWNQJ2AZcKBCNLIxO6F24pwix7KJDA/VUyK4C4vrcqABVVMn1cLuMU760gpkxe9 W8UZ9IUTs3kmINQfKzhZP33pTVcB858QwrPg8j1ca/iQVOPK6dxXH6M7hDG3DsCw Kgb2jl8UJW/ZnVeYsdv5KuHGEnB9mOfynYJu1LXXHrw+xiWB3mqKxf5bXlHKfMcK qCLC7wvaOAeyViWgj885d6IBGny4Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrleelgdejiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepuffvfhfhkffffg ggjggtgfesthejredttdefjeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegr ughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmqeenucffohhmrghinhepph hoshhtghhrvghsqhhlrdhorhhgnecukfhppeejuddrvdduvddrudehtddrvddtvdenucfr rghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrh drtghomhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id F26DAE4068; Mon, 11 Feb 2019 11:53:35 -0500 (EST) Subject: Re: Copy entire schema A to a different schema B To: Tiffany Thang , Ron Cc: pgsql-general@lists.postgresql.org References: <9aa9cb06-8bca-910c-5251-d974849dda7c@gmail.com> From: Adrian Klaver Message-ID: <65a629f9-6745-6cec-30d0-87eaf1ffa7bf@aklaver.com> Date: Mon, 11 Feb 2019 08:53:35 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/11/19 8:30 AM, Tiffany Thang wrote: > Thanks Adrian and Ron. Sorry, I was not clear. What I'm trying to > achieve was to dump the schema quickly and be able to restore a single > or subset of objects from the dump. As far as I understand, the only way > of achieving that is to use the custom format and the -j option. Is that > correct? Are there any other alternatives? If you want to use -j then you need to use the -Fd output: https://www.postgresql.org/docs/10/app-pgdump.html "-j njobs --jobs=njobs Run the dump in parallel by dumping njobs tables simultaneously. This option reduces the time of the dump but it also increases the load on the database server. You can only use this option with the directory output format because this is the only output format where multiple processes can write their data at the same time." If you need to grab just a subset of the schema then there are options to do that depending on the object. From above link as examples: "-n schema --schema=schema Dump only schemas matching schema; this selects both the schema itself, and all its contained objects. ..." "-t table --table=table Dump only tables with names matching table. .." > > Thanks. > > Tiff > > On Mon, Feb 11, 2019 at 11:10 AM Ron > wrote: > > On 2/11/19 10:00 AM, Tiffany Thang wrote: > > Hi, > > To copy the source schema A to target schema B in the same > database in > > PG10.3, I use psql to dump schema A and manually removes anything > specific > > to the schema in the text dump file before importing into schema > B. How do > > I achieve the same exporting from Schema A and importing into > schema B > > using pg_dump with the -Fc option? Since the dump file generated is > > binary, I could not make modifications to the file. Is the > procedure the > > same in version 11? > > Why do you need to use "--format=custom" instead of "--format=plain"? > > For example: > $ pg_dump --format=plain --schema-only --schema=A > > > -- > Angular momentum makes the world go 'round. > -- Adrian Klaver adrian.klaver@aklaver.com