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 1hIHTq-00075M-19 for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2019 18:46:22 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIHTn-0005zo-Id for pgsql-general@arkaria.postgresql.org; Sun, 21 Apr 2019 18:46:19 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIHTl-0005wR-TV for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2019 18:46:19 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hIHTi-0003Ow-34 for pgsql-general@lists.postgresql.org; Sun, 21 Apr 2019 18:46:17 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 6DE0620D2D; Sun, 21 Apr 2019 14:46:11 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 21 Apr 2019 14:46:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=z SA3+btXOKbXLgvKtDoi9UmjPsnTANVrbTEqiYb5pU0=; b=CPVeshqXHyxMRSQcT NtNYsChjhe/1SBm4ATSX2AymMOu6mJ3urW7D2D8jdN9qOCGV3L1A1qCsR2Ejq6OO uOICgGEEGppiBCPCQAE0PvKde+sAJRk+YaRQ0pc2ZH/wDNOFxGvIHVwiw1dqdORo /7robjWJ8o7+JgYEUsss4k8Ji6+lXVG1mJ1+nt/xW15/95YUKTi1sqlF8gXNi19i BFOQqQxTxDCA17rXTlhkozo5I5K+KsHxSRPdI0d+8k4MESndvYLoF1cQNKjSV8M2 hXiVztHPRMHIR3AQ1SZkVyVj/jk1GQce6T4qR+pu5cR2ZfWOHwMucf40OpAFq6Qf 7j8JA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=zSA3+btXOKbXLgvKtDoi9UmjPsnTANVrbTEqiYb5p U0=; b=OxklT165U9zTh8e1bX/EFbMiCLEGWTZVH3AS9OjEd9OaIunim/qCGAVBn mnH4x4tJzK1LApxbSYzCd17MMi6j57ObKqlr1u58TqbuhTOSlUHHsh94qy12Jk3a 7VoU0Jmu23P2CqdcncAI34dmC3BPAzD5iTq2swrUL2bI0bpdnR41d+PCI8IKYst9 1feSI3GCAeFQE/IZKPRGodU8svJ8YRiRFbkclj9EsRT+kOWcJS8QP/PVq+JyYmEM DfFzMSuK1/nCCmoIT+HyoGttfgdkfzE7EPuGFDTmkrqbe0xXAkHt3B+5qja2gNch DSwDHJPGUIoLQMjD+6p09ActyPjMg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduuddrgeeggddutdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefheenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjedurddvuddvrdduhedtrddvtddvnecurfgrrhgrmhepmhgrihhlfhhr ohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsth gvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.4] (unknown [71.212.150.202]) by mail.messagingengine.com (Postfix) with ESMTPA id 9B377E415C; Sun, 21 Apr 2019 14:46:10 -0400 (EDT) Subject: Re: Backup and Restore (pg_dump & pg_restore) To: Daulat Ram , "pgsql-general@lists.postgresql.org" References: From: Adrian Klaver Message-ID: Date: Sun, 21 Apr 2019 11:46:09 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/21/19 9:35 AM, Daulat Ram wrote: > Hello Team, > > We are getting below error while migrating pg_dump from Postgresql 9.6 > to Postgresql 11.2 via pg_restore in docker environment. > > 90d4c9f363c8:~$ pg_restore -d kbcn "/var/lib/kbcn_backup19" > > pg_restore: [archiver (db)] Error while PROCESSING TOC: > > pg_restore: [archiver (db)] Error from TOC entry 3; 2615 2200 SCHEMA > public postgres > > pg_restore: [archiver (db)] could not execute query: ERROR: schema > "public" already exists > > Command was: CREATE SCHEMA public; Expected as the public schema is there by default. It is an informational error, you can ignore it. If you want to not see it and want a clean install on the 11.2 side use: -c --clean Output commands to clean (drop) database objects prior to outputting the commands for creating them. (Unless --if-exists is also specified, restore might generate some harmless error messages, if any objects were not present in the destination database.) This option is only meaningful for the plain-text format. For the archive formats, you can specify the option when you call pg_restore. on pg_restore side(along with --if-exists to remove other harmless error messages). FYI the -W on the pg_dump is redundant as the password will be prompted for without it: -W --password Force pg_dump to prompt for a password before connecting to a database. This option is never essential, since pg_dump will automatically prompt for a password if the server demands password authentication. However, pg_dump will waste a connection attempt finding out that the server wants a password. In some cases it is worth typing -W to avoid the extra connection attempt. > > Script used for pg_dump: > > ------------------------------------- > > pg_dump -h 10.26.33.3 -p 5432 -U postgres -W -F c -v -f > tmp/postgres/backup/backup10/ kbcn_backup19  kbcn >& > tmp/postgres/backup/backup10/ kbcn_backup19.log; echo $? > > tmp/postgres/backup/backup10/_'date+%Y-%m-%d.%H:%M:%S' > > Please advise. > > Regards, > > Daulat > -- Adrian Klaver adrian.klaver@aklaver.com