pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Andrus <kobruleht2@hot.ee>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to transfer databases form one server to other
Date: Mon, 27 Jan 2020 12:47:52 -0800
Message-ID: <3877abba-8863-0e41-d368-adc2e648c240@aklaver.com> (raw)
In-Reply-To: <F6ED65CDABB64AFCAAD0932CC9CF481B@dell2>
References: <157139E4A01D436A859FB6612AE6BBD7@dell2>
	<1102fee1-eebe-dbe2-63a2-2120380bb2f8@aklaver.com>
	<111D51B7C5C64419810F09C229E1D917@dell2>
	<23417975-69b8-e273-2a58-c65beb16decf@aklaver.com>
	<F6ED65CDABB64AFCAAD0932CC9CF481B@dell2>

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





view thread (13+ messages)  latest in thread

Message-ID: <3877abba-8863-0e41-d368-adc2e648c240@aklaver.com>
Permalink:  ../3877abba-8863-0e41-d368-adc2e648c240@aklaver.com/
Also on:    postgresql.org/message-id/3877abba-8863-0e41-d368-adc2e648c240@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, kobruleht2@hot.ee
  Subject: Re: How to transfer databases form one server to other
  In-Reply-To: <3877abba-8863-0e41-d368-adc2e648c240@aklaver.com>
  References: <157139E4A01D436A859FB6612AE6BBD7@dell2> <1102fee1-eebe-dbe2-63a2-2120380bb2f8@aklaver.com> <111D51B7C5C64419810F09C229E1D917@dell2> <23417975-69b8-e273-2a58-c65beb16decf@aklaver.com> <F6ED65CDABB64AFCAAD0932CC9CF481B@dell2> <3877abba-8863-0e41-d368-adc2e648c240@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox