pg_resetxlog
1
Application
pg_resetxlog
reset write-ahead log file and optionally the pg_controldata file
pg_resetxlog
datadir
Description
pg_resetxlog clears the write-ahead log file and
optionally the pg_controldata> file. This is
used so the server can be started after these files have become corrupted.
(In every reported case, such file corruption has been caused
by faulty hardware.) It is to be used only as a last resort,
when the server will not start due to such corruption.
After running this command, the server may contain index corruption and
partially-committed transactions. You should immediately dump your data
and reload. After reload, check for partially committed transactions
that may have been open at the time of the server crash.
pg_resetxlog can also fix a corrupted
pg_controldata> file using the -f>
flag. Use this option when pg_resetxlog> reports it can't
reconstruct valid data for pg_control.
pg_resetxlog has a few more options for
special purposes. Run the command with no arguments to see them.
This utility can only be run by the user who installed the server because
it requires read/write access to the datadir>.
For safety reasons, you must specify the data directory on the command line.
It does not use the environment variable PGDATA>.
Notes
This command can not be used when the postmaster> is
running.