copy databases from two differend backups to one cluster

From: Joseph Kennedy <joseph(dot)kennedy(dot)486(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: copy databases from two differend backups to one cluster
Date: 2022-11-18 12:33:39
Message-ID: CACEKkuNQ0HLAnE5YARDnetvujxJc84PdpMaiQqLqzp1rpffGHw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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:

base/

1

125859

14042

14043

2315410

2321461

2321462

2321463

Database OID (and directory name) we can find by :

SELECT oid from pg_database where datname = 'database name';

Steps:

create empty databases on destination server (database oid they will be
probably different then on source databases)

stop Postgresql

cleanup destination directories eg. 2315410, 2321461, 2321462, 2321463

copy eg. content from pg_bassebackup01 base/(some OID) to 2315410 and
2321461

copy eg. content from pg_bassebackup02 base/(some OID) to 2321462 and
2321463

start postgresql

Is it a good or very bad idea ?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-11-18 14:31:47 Re: RES: session_user different from current_user after normal login
Previous Message Thomas Kellerer 2022-11-18 10:11:25 Re: Calculating average block write time