SQL >> Database >  >> RDS >> PostgreSQL

Herstel van PANIC: could not locate a valid checkpoint record

De server zoekt naar een checkpoint-record in het transactielog dat afwezig of beschadigd is. Controleer of dat echt het geval is:

# Postgres >= 10 pg_resetwal DATADIR # Postgres < 10 pg_resetxlog DATADIR 

Een beschadigd log geeft iets als:

The database server was not shut down cleanly. Resetting the transaction log might cause data to be lost. If you want to proceed anyway, use -f to force reset.

Je kunt het dan forceren:

# Postgres >= 10 pg_resetwal -f DATADIR # Postgres < 10 pg_resetxlog -f DATADIR 

Dat reset het log, maar kan het cluster in een onbepaalde toestand achterlaten, zoals de documentatie over pg_resetwal uitlegt:

If pg_resetwal complains that it cannot determine valid data for pg_control, you can force it to proceed anyway by specifying the -f (force) option. In this case plausible values will be substituted for the missing data. Most of the fields can be expected to match, but manual assistance might be needed for the next OID, next transaction ID and epoch, next multitransaction ID and offset, and WAL starting location fields. These fields can be set using the options discussed below. If you are not able to determine correct values for all these fields, -f can still be used, but the recovered database must be treated with even more suspicion than usual: an immediate dump and reload is imperative. Do not execute any data-modifying operations in the database before you dump, as any such action is likely to make the corruption worse.

Sluit, voordat je naar -f grijpt, eerst de alledaagse oorzaken uit: een datamap die van de verkeerde plek is aangekoppeld, een verouderde postmaster.pid, of onvoldoende rechten op pg_wal. En maak eerst een kopie op bestandsniveauto van het hele cluster — dit is een hersteloperatie, geen reparatie die je zonder vangnet wilt proberen.

  1. PostgreSQL: could not connect to server: No such file or directory

  2. PostgreSQL: "could not identify column in record data type"

  3. De fout 'could not serialize access' in Postgres begrijpen

  4. Fout teruggeven bij update als record niet bestaat in PostgreSQL