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 1iwBIe-0005XR-MP for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2020 20:48:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iwBId-00063s-65 for pgsql-general@arkaria.postgresql.org; Mon, 27 Jan 2020 20:47:59 +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 1iwBIc-00063l-PJ for pgsql-general@lists.postgresql.org; Mon, 27 Jan 2020 20:47:58 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iwBIZ-0000yI-Lp for pgsql-general@postgresql.org; Mon, 27 Jan 2020 20:47:57 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 34DB521F83; Mon, 27 Jan 2020 15:47:54 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 27 Jan 2020 15:47:54 -0500 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=O qRZbKT9iw9jaiRo2+CSIhy0oOcWLgWbiW496duMAhE=; b=Yf2OHc7NEI7CEOeDB CWSlhmOKLR9MPalTzZPxatt/G2mQxMlBvVwdZkEqHC6sNQrr0cbxWM6qPsiRTL9e T+y0EuQB6wB4xTxdXoDbnD3zslQd1WulTLgDCL+o3EH7djI4eGIEiR6fJdgq9eA4 HVDkgsdMNj13aiECIYklfU4hrIlv6U4WrhwcAl59+J1CgS/nVF4EtlYuBcYppIYG BiN/fF0WJuGnc9lR8V8+duQ+DiGpLlZy8KMlvNaFwgOxJG1G7rUZpIgVV0sKUYKo k63Rh4XF1vr49jhE3IziPwJ3lWknUHm5wtzkX01i0PpigjPCyGOHbw4XuUx/kJEC K6lNA== 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=fm1; bh=OqRZbKT9iw9jaiRo2+CSIhy0oOcWLgWbiW496duMA hE=; b=hfYNqL3uxOWaPr7kXoQORu85PvUnTTmDe3CJpRCq7CrD/cZlqgLJbmUIh O4TxVFKu0F7bNcGozFjuR5XrLi6Fzcu5X2JG70Bu7h71SpKiX1kuTXlCykUCYJC3 s0l9egVJkCkQAi09MfLxcGGim5/ONSDzTeMSIzPRMLfXQ4mkOeo20jWU5o/s/ouH 0ypjdyj3CZirs9T6nfqHNmOKaiBx4QZ8obsiR8QHY/+opDgcBoog7h14MJgSZYgW /pRmGDkSIXzGrDYGb7wanomWt+Pc68uKb3vI1O3Qe45O41spwLSYMin1usXabYIf i1Av+miXqY75oDMzNWMMTY5VwsDaw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrfedvgddufeelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvfhfhffkffgfgggjtgfgsehtje ertddtfehhnecuhfhrohhmpeetughrihgrnhcumfhlrghvvghruceorggurhhirghnrdhk lhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuffhomhgrihhnpehpghgrughmihhnrd horhhgnecukfhppeejuddrvdduvddruddvledrudelfeenucevlhhushhtvghrufhiiigv pedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkh hlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id 4D208306A544; Mon, 27 Jan 2020 15:47:53 -0500 (EST) Subject: Re: How to transfer databases form one server to other To: Andrus , pgsql-general References: <157139E4A01D436A859FB6612AE6BBD7@dell2> <1102fee1-eebe-dbe2-63a2-2120380bb2f8@aklaver.com> <111D51B7C5C64419810F09C229E1D917@dell2> <23417975-69b8-e273-2a58-c65beb16decf@aklaver.com> From: Adrian Klaver Message-ID: <3877abba-8863-0e41-d368-adc2e648c240@aklaver.com> Date: Mon, 27 Jan 2020 12:47:52 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1257; 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 1/26/20 10:56 PM, Andrus wrote: > Hi! > >>> 3. Manually edit role definitions to delete role postgres since it >>> exists >>> in new server. >> No need, it will throw a harmless error message and continue on. > > By my knowledge, pgAdmin executes script in single transaction and rolls it > back on error. > Should psql used or is there some option in pgadmin. There are options on pgAdmin: https://www.pgadmin.org/docs/pgadmin4/4.17/restore_dialog.html See: Single transaction Exit on error Can't remember if you are taking a custom format backup or plain text. If plain text you can use psql. If custom then will need to use pg_restore. > >>> To repeat transfer after testing: >>> >>> 1. Delete restored databases. >>> 2. Delete imported roles in new server >> That will probaly not end well. I'm guessing there are objects that >> have a >> dependency on the the roles. > > If imported databases are dropped before, there will be hopefully no > dependencies. Roles are global, dependencies can be local to a database. The issue is if objects in a restored database depend on roles that no longer exist in the global context. > > Andrus. -- Adrian Klaver adrian.klaver@aklaver.com