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.

INSTALL

sudo dnf install postgresql17
copy
sudo apk add postgresql17
copy
sudo zypper install postgresql17
copy

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

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid