Re: best migration solution

From: "Georg H(dot)" <georg-h(at)silentrunner(dot)de>
To: Markus(dot)Zwettler(at)zuerich(dot)ch, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: best migration solution
Date: 2024-04-25 15:08:22
Message-ID: 10fbed51-a2f5-46a4-8382-e47cf32c3b47@silentrunner.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello Markus,

keep it simple. Use a restored backup of the source db or this db itself
and then

Am 25.04.2024 um 09:55 schrieb Zwettler Markus (OIZ):
>
> we have to migrate from hosted PG12 to containerized PG16 on private
> cloud.
>
> some of the installed PG12 extensions are not offered on the
> containerized PG16, eg. PostGIS related extensions like pg_routing and
> ogr_fdw.
>
> some of these extensions are not needed anymore. some of these
> extensions were installed in their own schema.
>
> we also need to change the database names and most role names due to
> external requirements.
>
> I came up with this solution.
>
> dump all roles with pg_dumpall.
>
> edit this dumpfile and
>
> * exclude roles not needed
>
drop roles not needed
>
> * change required role names
>
rename the required roles to their new names

then dump the roles

> dump all required databases with pg_dump
>
> * in plain text
> * exclude all schemas not needed
>
drop all schemas not needed as well as any extension that does not exist
on the target and those that have own schemas (maybe they should not be
installed before the dump is imported)

then take a pg_dump just of the database(s)

> *
>
>
> edit this dump file and
>
> * exclude any "create extension" command for not existing extensions
> * change all required role names on permissions and ownerships
>
> any missings?
> any better solutions?
>
> I wonder whether a plain text dump could lead to conversion problems
> or something similar?
>
when the roles and db-dump are imported, install the missing extensions.

To take the dumps use the binaries of the target version

kind regards and good luck

Georg

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sasmit Utkarsh 2024-04-25 16:46:22 Re: Need some assistance on stored procedures execution using libpq in C
Previous Message Adrian Klaver 2024-04-25 14:56:27 Re: What linux version to install ?