@@ -52,21 +52,33 @@ PostgreSQL documentation
52
52
</para>
53
53
54
54
<para>
55
- After running this command, it should be possible to start the server,
55
+ Some options, such as <option>--wal-segsize</option> (see below), can also
56
+ be used to modify certain global settings of a database cluster without the
57
+ need to rerun <command>initdb</command>. This can be done safely on an
58
+ otherwise sound database cluster, if none of the dangerous modes mentioned
59
+ below are used.
60
+ </para>
61
+
62
+ <para>
63
+ If <command>pg_resetwal</command> is used on a data directory where the
64
+ server has been cleanly shut down and the control file is sound, then it
65
+ will have no effect on the contents of the database system, except that no
66
+ longer used WAL files are cleared away. Any other use is potentially
67
+ dangerous and must be done with great care. <command>pg_resetwal</command>
68
+ will require the <option>-f</option> (force) option to be specified before
69
+ working on a data directory in an unclean shutdown state or with a
70
+ corrupted control file.
71
+ </para>
72
+
73
+ <para>
74
+ After running this command on a data directory with corrupted WAL or a
75
+ corrupted control file, it should be possible to start the server,
56
76
but bear in mind that the database might contain inconsistent data due to
57
77
partially-committed transactions. You should immediately dump your data,
58
78
run <command>initdb</command>, and restore. After restore, check for
59
79
inconsistencies and repair as needed.
60
80
</para>
61
81
62
- <para>
63
- This utility can only be run by the user who installed the server, because
64
- it requires read/write access to the data directory.
65
- For safety reasons, you must specify the data directory on the command line.
66
- <command>pg_resetwal</command> does not use the environment variable
67
- <envar>PGDATA</envar>.
68
- </para>
69
-
70
82
<para>
71
83
If <command>pg_resetwal</command> complains that it cannot determine
72
84
valid data for <filename>pg_control</filename>, you can force it to proceed anyway
@@ -82,19 +94,41 @@ PostgreSQL documentation
82
94
execute any data-modifying operations in the database before you dump,
83
95
as any such action is likely to make the corruption worse.
84
96
</para>
97
+
98
+ <para>
99
+ This utility can only be run by the user who installed the server, because
100
+ it requires read/write access to the data directory.
101
+ </para>
85
102
</refsect1>
86
103
87
104
<refsect1>
88
105
<title>Options</title>
89
106
90
107
<variablelist>
108
+ <varlistentry>
109
+ <term><replaceable class="parameter">datadir</replaceable></term>
110
+ <term><option>-D <replaceable class="parameter">datadir</replaceable></option></term>
111
+ <term><option>--pgdata=<replaceable class="parameter">datadir</replaceable></option></term>
112
+ <listitem>
113
+ <para>
114
+ Specifies the location of the database directory.
115
+ For safety reasons, you must specify the data directory on the command
116
+ line. <command>pg_resetwal</command> does not use the environment
117
+ variable <envar>PGDATA</envar>.
118
+ </para>
119
+ </listitem>
120
+ </varlistentry>
121
+
91
122
<varlistentry>
92
123
<term><option>-f</option></term>
93
124
<term><option>--force</option></term>
94
125
<listitem>
95
126
<para>
96
- Force <command>pg_resetwal</command> to proceed even if it cannot determine
97
- valid data for <filename>pg_control</filename>, as explained above.
127
+ Force <command>pg_resetwal</command> to proceed even in situations where
128
+ it could be dangerous, as explained above. Specifically, this option is
129
+ required to proceed if the server had not been cleanly shut down or if
130
+ <command>pg_resetwal</command> cannot determine valid data for
131
+ <filename>pg_control</filename>.
98
132
</para>
99
133
</listitem>
100
134
</varlistentry>
@@ -284,6 +318,12 @@ PostgreSQL documentation
284
318
linkend="app-initdb"/> for more information.
285
319
</para>
286
320
321
+ <para>
322
+ This option can also be used to change the WAL segment size of an
323
+ existing database cluster, avoiding the need to
324
+ re-<command>initdb</command>.
325
+ </para>
326
+
287
327
<note>
288
328
<para>
289
329
While <command>pg_resetwal</command> will set the WAL starting address
0 commit comments