HiveBrain v1.2.0
Get Started
← Back to all entries
principlesqlMinor

Dealing with corruption: file-level backup vs. pg_basebackup

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
filewithleveldealingpg_basebackupcorruptionbackup

Problem

The wiki on corruption recommends immediately taking a file-level backup of your database by stopping the postmaster and using tar, but I was under the impression that using pg_basebackup was a better option. Is there any reason I shouldn't use pg_basebackup?

Solution

pg_basebackup and other methods like pg_dump might not actually finish due to the corruption, and you really need that backup in that case. Being independent of PostgreSQL and its tools, tar is not as likely to run into those issues.

In the case of corruption, that backup will be an invaluable insurance policy when you try to recover your data or do forensics, so playing it safe is always the best way to go.

Context

StackExchange Database Administrators Q#116215, answer score: 5

Revisions (0)

No revisions yet.