LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pg_resetwal

resets write-ahead log and control information

TLDR

Reset WAL (dry run)
$ pg_resetwal -n [data_dir]
copy
Reset WAL
$ pg_resetwal [data_dir]
copy
Force reset
$ pg_resetwal -f [data_dir]
copy

SYNOPSIS

pg_resetwal [options] [-D] datadir

DESCRIPTION

pg_resetwal resets write-ahead log and control information. Last resort recovery when WAL is corrupted. May cause data loss. Server must be stopped.

PARAMETERS

-D, --pgdata dir

Data directory.
-n, --dry-run
Show what would be done.
-f, --force
Force reset.
-e, --epoch epoch
Set next transaction ID epoch.
-x, --next-transaction-id xid
Set next transaction ID.
-o, --next-oid oid
Set next OID.
-m, --multixact-ids mxid,mxid
Set next and oldest multitransaction ID.
-O, --multixact-offset mxoff
Set next multitransaction offset.
-c, --commit-timestamp-ids xid,xid
Set oldest and newest transaction IDs for commit timestamps.
-u, --oldest-transaction-id xid
Set oldest unfrozen transaction ID.
-l, --next-wal-file walfile
Force minimum WAL starting location.
--wal-segsize size
Set WAL segment size in megabytes.

CAVEATS

Use only as a last resort when WAL is corrupted or pg_controldata shows inconsistencies. May cause data loss and transaction integrity issues. The PostgreSQL server must be stopped before running.

SEE ALSO

Copied to clipboard
Kai