Re: copy databases from two differend backups to one cluster

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Joseph Kennedy <joseph(dot)kennedy(dot)486(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: copy databases from two differend backups to one cluster
Date: 2022-11-18 16:18:18
Message-ID: b17630cb-537e-55e5-52c7-ebb0f19b011b@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 11/18/22 04:33, Joseph Kennedy wrote:
> I would like to copy databases from two different pg_basebackup backups
> to one lab environment database cluster on another server. Is it possible ?
>
> It's a good idea to do it in that way.
>
> Databases has your oid in pg_basebackup we can find it id in base
> directory for example:

> Is it a good or  very bad idea ?

Bad idea.

For why see:

https://www.postgresql.org/docs/current/storage-file-layout.html

and

https://www.postgresql.org/docs/current/storage-page-layout.html

There is more to a cluster then what is found in a given databases
directory. You can't, at the file(binary) level, just rip a database out
of one cluster and graft it into another.

If you want to do this then the options are:

1) As Ron suggested dump/restore.

2) Setting up logical replication.

>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-11-18 16:24:31 Re: Calculating average block write time
Previous Message Ron 2022-11-18 16:14:38 Re: Calculating average block write time