inconsistencies and repair as needed.
</para>
<para>
If <command>pg_resetwal</command> complains that it cannot determine
valid data for <filename>pg_control</filename>, you can force it to proceed anyway
by specifying the <option>-f</option> (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, <option>-f</option> can still be used, but
the recovered database must be treated with even more suspicion than
usual: an immediate dump and restore is imperative. <emphasis>Do not</emphasis>
execute any data-modifying operations in the database before you dump,
as any such action is likely to make the corruption worse.
</para>
<para>
This utility can only be run by the user who installed the server, because
it requires read/write access to the data directory.
</para>
</refsect1>
<refsect1>
<title>Options</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">datadir</replaceable></term>
<term><option>-D <replaceable class="parameter">datadir</replaceable></option></term>
<term><option>--pgdata=<replaceable class="parameter">datadir</replaceable></option></term>
<listitem>
<para>
Specifies the location of the database directory.
For safety reasons, you must specify the data directory on the command
line. <command>pg_resetwal</command> does not use the environment
variable <envar>PGDATA</envar>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-f</option></term>
<term><option>--force</option></term>
<listitem>
<para>
Force <command>pg_resetwal</command> to proceed even in situations where
it could be dangerous, as explained above. Specifically, this option is
required to proceed if the server had not been cleanly shut down or if
<command>pg_resetwal</command> cannot determine valid data for
<filename>pg_control</filename>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-n</option></term>
<term><option>--dry-run</option></term>
<listitem>
<para>
The <option>-n</option>/<option>--dry-run</option> option instructs
<command>pg_resetwal</command> to print the values reconstructed from
<filename>pg_control</filename> and values about to be changed, and then exit
without modifying anything. This is mainly a debugging tool, but can be
useful as a sanity check before allowing <command>pg_resetwal</command>
to proceed for real.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-V</option></term>
<term><option>--version</option></term>
<listitem><para>Display version information, then exit.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
<listitem><para>Show help, then exit.</para></listitem>
</varlistentry>
</variablelist>
<para>
The following options are only needed when
<command>pg_resetwal</command> is unable to determine appropriate values
by reading <filename>pg_control</filename>. Safe values can be determined as
described below. For values that take numeric arguments, hexadecimal
values can be specified by using the prefix <literal>0x</literal>. Note
that these instructions only apply with the standard block size of 8 kB.
</para>
<variablelist>
<varlistentry>
<term><option>-c <replaceable class="parameter">xid</replaceable>,<replaceable class="parameter">xid</replaceable></option></term>
<term><option>--commit-timestamp-ids=<replaceable