Re: How to validate restore of backup?

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Vince McMahon <sippingonesandzeros(at)gmail(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: How to validate restore of backup?
Date: 2024-08-22 15:36:32
Message-ID: cd28b9d6-60ba-4d16-a1a2-8985e6a00a11@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 8/22/24 04:06, Vince McMahon wrote:
> Hi,
>
> I have some questions When doing pg_restore of backup of a database to a
> NEW server.

How large a backup?

>
> Is there a way to ensure the data integrity is in tact, and user ID and
> access works liked how it was in the old server?

As to user access, write tests that cover that and run on the new cluster.

Data is trickier and if that is possible to a degree of certainty is
going to depend on answer to the first question above.

>
> How to properly handle the materialized views when backing up and restoring?

create materialized view prj_mv(p_item_no, year) as select p_item_no,
year from projection with data;

pg_dump -d production -U postgres -h localhost -t projection -t prj_mv
-f prj.sql

In prj.sql:

CREATE MATERIALIZED VIEW public.prj_mv AS
SELECT p_item_no,
year
FROM public.projection
WITH NO DATA;

COPY public.projection ( ...

[...]

REFRESH MATERIALIZED VIEW public.prj_mv;

It is done for you.

>
> Thanks.

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Justin Giacobbi 2024-08-22 18:13:19 On exclusion constraints and validity dates
Previous Message Ron Johnson 2024-08-22 14:38:07 Re: How to validate restore of backup?