-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pgresetxlog.html
More file actions
197 lines (194 loc) · 23.1 KB
/
Copy pathapp-pgresetxlog.html
File metadata and controls
197 lines (194 loc) · 23.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_resetxlog</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets V1.78.1" /><link rel="home" href="index.html" title="PostgreSQL 9.5.4文書" /><link rel="up" href="reference-server.html" title="PostgreSQLサーバアプリケーション" /><link rel="prev" href="app-pg-ctl.html" title="pg_ctl" /><link rel="next" href="app-pgrewind.html" title="pg_rewind" /><link rel="copyright" href="legalnotice.html" title="法的告知" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><td width="20%" align="left" colspan="2"></td><th width="60%" align="center"><a accesskey="h" href="index.html">PostgreSQL 9.5.4文書</a></th><td width="20%" align="right"><div class="actions"><a class="issue" href="https://github.com/pgsql-jp/jpug-doc/issues/new?title=version 9.5.4 app-pgresetxlog.html">誤訳等の報告</a></div></td></tr><tr><td width="10%" align="left" valign="top"><a accesskey="p" href="app-pg-ctl.html">前へ</a> </td><td width="10%" align="left" valign="top"><a accesskey="u" href="reference-server.html">上へ</a></td><td width="60%" align="center"><span class="application">pg_resetxlog</span></td><td width="20%" align="right" valign="top"> <a accesskey="n" href="app-pgrewind.html">次へ</a></td></tr></table><hr /></div><div class="refentry" id="app-pgresetxlog"><div class="titlepage"></div><a id="idp110390752" class="indexterm"></a><div class="refnamediv"><h2>名前</h2><p>pg_resetxlog<span class="original">
<refpurpose>reset the write-ahead log and other control information of a <productname>PostgreSQL</productname> database cluster</refpurpose>
</span> — <span class="productname">PostgreSQL</span>データベースクラスタの先行書き込みログやその他の制御情報を初期化する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="idp110395264"><code class="command">pg_resetxlog</code> [<code class="option">-c</code> <em class="replaceable"><code>xid</code></em>,<em class="replaceable"><code>xid</code></em>] [<code class="option">-f</code>] [<code class="option">-n</code>] [<code class="option">-o</code> <em class="replaceable"><code>oid</code></em>] [<code class="option">-x</code> <em class="replaceable"><code>xid</code></em>] [<code class="option">-e</code> <em class="replaceable"><code>xid_epoch</code></em>] [<code class="option">-m</code> <em class="replaceable"><code>mxid</code></em>,<em class="replaceable"><code>mxid</code></em>] [<code class="option">-O</code> <em class="replaceable"><code>mxoff</code></em>] [<code class="option">-l</code> <em class="replaceable"><code>xlogfile</code></em>] {[<code class="option">-D</code>] <em class="replaceable"><code>datadir</code></em>}</p></div></div><div class="refsect1" id="r1-app-pgresetxlog-1"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p><span class="original">
<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.
</span><code class="command">pg_resetxlog</code>は、先行書き込みログ(WAL)を消去し、さらにオプションで<code class="filename">pg_control</code>ファイル内に保存された制御情報の一部を初期化します。
この機能は、これらのファイルが破損した場合に必要になることがあります。
このような破損などが原因でサーバを起動できない場合の最後の手段としてのみ、この機能を使用してください。
</p><p><span class="original">
After running this command, it should be possible to start the server,
but bear in mind that the database might contain inconsistent data due to
partially-committed transactions. You should immediately dump your data,
run <command>initdb</>, and reload. After reload, check for
inconsistencies and repair as needed.
</span>このコマンドを実行すると、サーバが開始できるようになるはずです。
ただし、不完全にコミットされたトランザクションが原因でデータベースのデータに矛盾が起こる可能性があることに注意してください。
コマンドの実行後は、ただちにデータをダンプし、<code class="command">initdb</code>を実行し、リロードすべきです。
リロード後、矛盾がないか検査し、必要に応じて修復を行ってください。
</p><p><span class="original">
This utility can only be run by the user who installed the server, because
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</>.
</span>このユーティリティの実行にはデータディレクトリへの読み込み/書き込みアクセス権限が必要となるため、サーバをインストールしたユーザのみが実行できます。
安全のため、データディレクトリをコマンドラインで指定する必要があります。
<code class="command">pg_resetxlog</code>は、環境変数<code class="envar">PGDATA</code>を使用しません。
</p><p><span class="original">
If <command>pg_resetxlog</command> complains that it cannot determine
valid data for <filename>pg_control</>, you can force it to proceed anyway
by specifying the <option>-f</> (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 address 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</> 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,
as any such action is likely to make the corruption worse.
</span><code class="command">pg_resetxlog</code>が<code class="filename">pg_control</code>に対する有効なデータを判別できない場合、<code class="option">-f</code>(force,強制)オプションを指定すれば強制的に処理を進めることができます。
その場合、欠落したデータは無難な値で代用されます。
ほとんどフィールドでは適切な値が使用されますが、次のOID、次のトランザクションIDとエポック時間、マルチトランザクションIDとそのオフセット、WAL開始アドレスの値については、手動の操作が必要な場合があります。
これらの値は下記で説明するオプションを使用して設定することができます。
すべてに対して正しい値を決定できない場合でも<code class="option">-f</code>を使用することができますが、この場合は回復したデータベースを通常よりさらに注意深く検査する必要があります。
必ず、ただちにダンプおよびリロードを行ってください。
決して、ダンプを行う前にデータ変更などの操作を行っては<span class="emphasis"><em>なりません</em></span>。
そのような操作は、破損状態をさらに悪化させます。
</p><p><span class="original">
The <option>-o</>, <option>-x</>, <option>-e</>,
<option>-m</>, <option>-O</>,
<option>-c</>
and <option>-l</>
options allow the next OID, next transaction ID, next transaction ID's
epoch, next and oldest multitransaction ID, next multitransaction offset,
oldest and newest transaction IDs for which the commit time can be retrieved,
and WAL
starting address values to be set manually. These are only needed when
<command>pg_resetxlog</command> is unable to determine appropriate values
by reading <filename>pg_control</>. Safe values can be determined as
follows:
</span><code class="option">-o</code>、<code class="option">-x</code>、<code class="option">-e</code>、<code class="option">-m</code>、<code class="option">-O</code>、<code class="option">-l</code>の各オプションを使用すると、次のOID、次のトランザクションID、次のトランザクションIDのエポック時間、次および最古のマルチトランザクションID、次のマルチトランザクションのオフセット、コミット時刻が取り出せる最古および最新のトランザクションID、WAL開始アドレスの値を手動で設定することができます。
この操作は、<code class="command">pg_resetxlog</code>が<code class="filename">pg_control</code>の読み込みによって適切な値を判別できない場合にのみ必要です。
安全な値を得るには、以下のようにします。
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p><span class="original">
A safe value for the next transaction ID (<option>-x</>)
can 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 option value in
hexadecimal too. For example, if <filename>0011</> is the largest entry
in <filename>pg_clog</>, <literal>-x 0x1200000</> will work (five
trailing zeroes provide the proper multiplier).
</span>次のトランザクションID(<code class="option">-x</code>)用の安全な値は、データディレクトリ以下の<code class="filename">pg_clog</code>ディレクトリ内で最も大きな数字を持つファイル名を探し、その値に1を加え、1048576で乗算することで決定できます。
ファイル名は16進数ですので、通常、オプションの値も16進数で指定した方が簡単です。
例えば、<code class="filename">0011</code>が<code class="filename">pg_clog</code>で最も大きなエントリであれば、<code class="literal">-x 0x1200000</code>となります(後ろにゼロを5つ付けると、正しく乗算したことになります)。
</p></li><li class="listitem"><p><span class="original">
A safe value for the next multitransaction ID (first part of <option>-m</>)
can be determined by looking for the numerically largest
file name in the directory <filename>pg_multixact/offsets</> under the
data directory, adding one, and then multiplying by 65536.
Conversely, a safe value for the oldest multitransaction ID (second part of
<option>-m</>)
can be determined by looking for the numerically smallest
file name in the same directory and multiplying by 65536.
As above, the file names are in hexadecimal, so the easiest way to do
this is to specify the option value in hexadecimal and append four zeroes.
</span>次のマルチトランザクションID(<code class="option">-m</code>の最初の部分)用の安全な値は、データディレクトリ以下の<code class="filename">pg_multixact/offsets</code>ディレクトリ内で最も大きな数字を持つファイル名を探し、その値に1を加え、65536で乗算することで決定できます。
反対に最古のマルチトランザクションID(<code class="option">-m</code>の第二部分)は、同じディレクトリの中で数値的に最小のファイル名を見つけ、65536で乗算することで決定できます。
上と同様、ファイル名は16進数ですので、通常、オプションの値も16進数で指定した方が簡単です。
ここでは、4個のゼロを付けてください。
</p></li><li class="listitem"><p><span class="original">
A safe value for the next multitransaction offset (<option>-O</>)
can be determined by looking for the numerically largest
file name in the directory <filename>pg_multixact/members</> under the
data directory, adding one, and then multiplying by 52352. As above,
the file names are in hexadecimal. There is no simple recipe such as
the ones above of appending zeroes.
</span>次のマルチトランザクションオフセット(<code class="option">-O</code>)用の安全な値は、データディレクトリ以下の<code class="filename">pg_multixact/members</code>ディレクトリ内で最も大きな数字を持つファイル名を探し、その値に1を加え、52352で乗算することで決定できます。
上と同様、ファイル名は16進数ですので、通常、オプションの値も16進数で指定した方が簡単ですが、上のような0をつけるだけの簡単な計算はありません。
</p></li><li class="listitem"><p><span class="original">
A safe value for the oldest transaction ID for which the commit time can
be retrieved (first part of <option>-c</>) can be determined by looking
for the numerically smallest file name in the directory
<filename>pg_commit_ts</> under the data directory. Conversely, a safe
value for the newest transaction ID for which the commit time can be
retrieved (second part of <option>-c</>) can be determined by looking for
the numerically greatest file name in the same directory. As above, the
file names are in hexadecimal.
</span>コミット時刻が取り出せる最古のトランザクションIDとして安全な値(<code class="option">-c</code>の1番目の部分)はデータディレクトリの下の<code class="filename">pg_commit_ts</code>ディレクトリの中で、数値的に最小のファイル名を探すことで決定できます。
逆に、コミット時刻が取り出せる最新のトランザクションIDとして安全な値(<code class="option">-c</code>の2番目の部分)は同じディレクトリの中で、数値的に最大のファイル名を探すことで決定できます。
上と同じく、ファイル名は16進数になっています。
</p></li><li class="listitem"><p><span class="original">
The WAL starting address (<option>-l</>) should be
larger than any WAL segment file name currently existing in
the directory <filename>pg_xlog</> under the data directory.
These names are also in hexadecimal and have three parts. The first
part is the <quote>timeline ID</> and should usually be kept the same.
For example, if <filename>00000001000000320000004A</> is the
largest entry in <filename>pg_xlog</>, use <literal>-l 00000001000000320000004B</> or higher.
</span>WAL開始アドレス(<code class="option">-l</code>)は、データディレクトリ以下の<code class="filename">pg_xlog</code>に現在存在するWALセグメントファイル名のどの番号よりも大きくならなければなりません。
この名前も16進数で、3つの部分に分かれています。
最初の部分は<span class="quote">「<span class="quote">時系列ID</span>」</span>で、通常、この値は変更すべきではありません。
例えば、<code class="filename">pg_xlog</code>内で最大のエントリが<code class="filename">00000001000000320000004A</code>である場合は、<code class="literal">-l 00000001000000320000004B</code>以上を使用してください。
</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">注記</h3><p><span class="original">
<command>pg_resetxlog</command> itself looks at the files in
<filename>pg_xlog</> and chooses a default <option>-l</> setting
beyond the last existing file name. Therefore, manual adjustment of
<option>-l</> should only be needed if you are aware of WAL segment
files that are not currently present in <filename>pg_xlog</>, such as
entries in an offline archive; or if the contents of
<filename>pg_xlog</> have been lost entirely.
</span><code class="command">pg_resetxlog</code>自体は<code class="filename">pg_xlog</code>内のファイルを参照し、既存のファイル名の最後を超えた値をデフォルトの<code class="option">-l</code>設定として選択します。
したがって、手作業による<code class="option">-l</code>の調整は、オフラインアーカイブ内の項目など<code class="filename">pg_xlog</code>に現存しないWALセグメントファイルに注意する場合、または、<code class="filename">pg_xlog</code>の内容が完全に失われている場合にのみ必要とされます。
</p></div></li><li class="listitem"><p><span class="original">
There is no comparably easy way to determine a next OID that's beyond
the largest one in the database, but fortunately it is not critical to
get the next-OID setting right.
</span>データベース内のOIDの最大値よりも大きな次のOIDを決定するには、上記のような簡単な方法はありません。
しかし、幸いにも、次のOIDの設定をが正しく取得することは、それほど重要ではありません。
</p></li><li class="listitem"><p><span class="original">
The transaction ID epoch is not actually stored anywhere in the database
except in the field that is set by <command>pg_resetxlog</command>,
so any value will work so far as the database itself is concerned.
You might need to adjust this value to ensure that replication
systems such as <application>Slony-I</> and
<application>Skytools</> work correctly &mdash;
if so, an appropriate value should be obtainable from the state of
the downstream replicated database.
</span><code class="command">pg_resetxlog</code>で設定されるフィールドを除き、トランザクションIDのエポック時間は実際にはデータベース内に格納されません。
そのため、データベース自身が問題としない限り、任意の値で動作するでしょう。
<span class="application">Slony-I</span>や<span class="application">Skytools</span>などのレプリケーションシステムが確実に正しく動作するように、この値を調整しなければならない可能性があります。
その場合、適切な値はレプリケーションシステムの下流で複製されたデータベースの状態から得られるはずです。
</p></li></ul></div><p>
</p><p><span class="original">
The <option>-n</> (no operation) option instructs
<command>pg_resetxlog</command> to print the values reconstructed from
<filename>pg_control</> 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_resetxlog</command>
to proceed for real.
</span><code class="option">-n</code>(no operation,操作なし)オプションを指定すると、<code class="command">pg_resetxlog</code>は<code class="filename">pg_control</code>から再構築した値、および変更される値を出力して、何も変更せずに終了します。
これは主にデバッグと目的としたツールですが、<code class="command">pg_resetxlog</code>を実際に進める前の検査としても有用な場合があります。
</p><p><span class="original">
The <option>-V</> and <option>&#045;-version</> options print
the <application>pg_resetxlog</application> version and exit. The
options <option>-?</> and <option>&#045;-help</> show supported arguments,
and exit.
</span><code class="option">-V</code>および<code class="option">--version</code>オプションは<span class="application">pg_resetxlog</span>のバージョンを表示し、終了します。
<code class="option">-?</code>および<code class="option">--help</code>オプションはサポートする引数を表示し、終了します。
</p></div><div class="refsect1" id="idp110469488"><h2>注釈</h2><span class="original">
<title>Notes</title>
</span><p><span class="original">
This command must not be used when the server is
running. <command>pg_resetxlog</command> will refuse to start up if
it finds a server lock file in the data directory. If the
server crashed then a lock file might 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 server process still alive.
</span>このコマンドは、サーバの稼動中に使用してはいけません。
<code class="command">pg_resetxlog</code>は、データディレクトリにサーバのロックファイルがあると、実行されません。
サーバがクラッシュした場合、ロックファイルがそのまま残される場合があります。
その場合は、ロックファイルを削除すれば<code class="command">pg_resetxlog</code>を実行することができます。
ただし、このコマンドを実行する時は、起動中のサーバプロセスが一切ないことを慎重に確認してください。
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pg-ctl.html">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-server.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pgrewind.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_ctl</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_rewind</span></td></tr></table></div></body></html>