pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Joseph Kennedy <joseph.kennedy.486@gmail.com>
To: pgsql-general@postgresql.org
Subject: Re: copy databases from two differend backups to one cluster
Date: Fri, 18 Nov 2022 08:18:18 -0800
Message-ID: <b17630cb-537e-55e5-52c7-ebb0f19b011b@aklaver.com> (raw)
In-Reply-To: <CACEKkuNQ0HLAnE5YARDnetvujxJc84PdpMaiQqLqzp1rpffGHw@mail.gmail.com>
References: <CACEKkuNQ0HLAnE5YARDnetvujxJc84PdpMaiQqLqzp1rpffGHw@mail.gmail.com>

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.klaver@aklaver.com






view thread (3+ messages)

Message-ID: <b17630cb-537e-55e5-52c7-ebb0f19b011b@aklaver.com>
Permalink:  ../b17630cb-537e-55e5-52c7-ebb0f19b011b@aklaver.com/
Also on:    postgresql.org/message-id/b17630cb-537e-55e5-52c7-ebb0f19b011b@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, joseph.kennedy.486@gmail.com
  Subject: Re: copy databases from two differend backups to one cluster
  In-Reply-To: <b17630cb-537e-55e5-52c7-ebb0f19b011b@aklaver.com>
  References: <CACEKkuNQ0HLAnE5YARDnetvujxJc84PdpMaiQqLqzp1rpffGHw@mail.gmail.com> <b17630cb-537e-55e5-52c7-ebb0f19b011b@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