1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Another big editing pass for consistent content and presentation.

This commit is contained in:
Peter Eisentraut
2003-03-24 14:32:51 +00:00
parent e27334f405
commit d258ba01ec
38 changed files with 1321 additions and 2427 deletions

View File

@@ -1,5 +1,5 @@
<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_resetxlog.sgml,v 1.6 2002/10/02 21:30:13 tgl Exp $
$Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_resetxlog.sgml,v 1.7 2003/03/24 14:32:51 petere Exp $
PostgreSQL documentation
-->
@@ -12,7 +12,7 @@ PostgreSQL documentation
<refnamediv>
<refname>pg_resetxlog</refname>
<refpurpose>reset write-ahead log and pg_control contents</refpurpose>
<refpurpose>reset the write-ahead log and other control information of a <productname>PostgreSQL</productname> database cluster</refpurpose>
</refnamediv>
<refsynopsisdiv>
@@ -30,25 +30,24 @@ PostgreSQL documentation
<refsect1 id="R1-APP-PGRESETXLOG-1">
<title>Description</title>
<para>
<command>pg_resetxlog</command> clears the write-ahead log and
optionally resets some fields in the <filename>pg_control</> file. This
function is sometimes
needed if these files have become corrupted.
It should be used only as a last resort,
when the server will not start due to such corruption.
<command>pg_resetxlog</command> clears the write-ahead log (WAL) and
optionally resets some other control information (stored in the
<filename>pg_control</> file). This function is sometimes needed
if these files have become corrupted. It should be used only as a
last resort, when the server will not start due to such corruption.
</para>
<para>
After running this command, it should be possible to start the server,
but bear in mind that the database may contain inconsistent data due to
partially-committed transactions. You should immediately dump your data,
run <application>initdb</>, and reload. After reload, check for
run <command>initdb</>, and reload. After reload, check for
inconsistencies and repair as needed.
</para>
<para>
This utility can only be run by the user who installed the server, because
it requires read/write access to the <literal>datadir</>.
it requires read/write access to the data directory.
For safety reasons, you must specify the data directory on the command line.
<command>pg_resetxlog</command> does not use the environment variable
<envar>PGDATA</>.
@@ -64,12 +63,12 @@ PostgreSQL documentation
The first three of these can be set using the switches discussed below.
<command>pg_resetxlog</command>'s own environment is the source for its
guess at the locale fields; take care that <envar>LANG</> and so forth
match the environment that <application>initdb</> was run in.
match the environment that <command>initdb</> was run in.
If you are not able to determine correct values for all these fields,
<literal>-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. <emphasis>Do not</>
execute any data-modifying operations in the database before you dump,
usual: an immediate dump and reload is imperative. <emphasis>Do not</>
execute any data-modifying operations in the database before you dump;
as any such action is likely to make the corruption worse.
</para>
@@ -79,8 +78,8 @@ PostgreSQL documentation
be set manually. These are only needed when
<command>pg_resetxlog</command> is unable to determine appropriate values
by reading <filename>pg_control</>. A safe value for the
next transaction ID may be determined by looking for the largest
file name in <envar>$PGDATA</><filename>/pg_clog</>, adding one,
next transaction ID may be determined by looking for the numerically largest
file name in the directory <filename>pg_clog</> under the data directory, adding one,
and then multiplying by 1048576. Note that the file names are in
hexadecimal. It is usually easiest to specify the switch value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
@@ -88,7 +87,7 @@ PostgreSQL documentation
zeroes provide the proper multiplier).
The WAL starting address should be
larger than any file number currently existing in
<envar>$PGDATA</><filename>/pg_xlog</>. These also are in hex, and
the directory <filename>pg_xlog</> under the data directory. The addresses are also in hexadecimal and
have two parts. For example, if <filename>000000FF0000003A</> is the
largest entry in <filename>pg_xlog</>, <literal>-l 0xFF,0x3B</> will work.
There is no comparably easy way to determine a next OID that's beyond
@@ -109,14 +108,14 @@ PostgreSQL documentation
<title>Notes</title>
<para>
This command must not be used when the <application>postmaster</> is
This command must not be used when the server is
running. <command>pg_resetxlog</command> will refuse to start up if
it finds a postmaster lock file in the <literal>datadir</>. If the
<application>postmaster</> crashed then a lock file may have been left
it finds a server lock file in the data directory. If the
server crashed then a lock file may have been left
behind; in that case you can remove the lock file to allow
<command>pg_resetxlog</command> to run. But before you do
so, make doubly certain that there
is no postmaster nor any backend server process still alive.
is no <command>postmaster</command> nor any backend server process still alive.
</para>
</refsect1>