-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pg-dumpall.html
More file actions
397 lines (394 loc) · 42.6 KB
/
Copy pathapp-pg-dumpall.html
File metadata and controls
397 lines (394 loc) · 42.6 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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
<?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_dumpall</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-client.html" title="PostgreSQLクライアントアプリケーション" /><link rel="prev" href="app-pgdump.html" title="pg_dump" /><link rel="next" href="app-pg-isready.html" title="pg_isready" /><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-pg-dumpall.html">誤訳等の報告</a></div></td></tr><tr><td width="10%" align="left" valign="top"><a accesskey="p" href="app-pgdump.html">前へ</a> </td><td width="10%" align="left" valign="top"><a accesskey="u" href="reference-client.html">上へ</a></td><td width="60%" align="center"><span class="application">pg_dumpall</span></td><td width="20%" align="right" valign="top"> <a accesskey="n" href="app-pg-isready.html">次へ</a></td></tr></table><hr /></div><div class="refentry" id="app-pg-dumpall"><div class="titlepage"></div><a id="idp107758144" class="indexterm"></a><div class="refnamediv"><h2>名前</h2><p>pg_dumpall<span class="original">
<refpurpose>extract a <productname>PostgreSQL</productname> database cluster into a script file</refpurpose>
</span> — <span class="productname">PostgreSQL</span>のデータベースクラスタをスクリプトファイルへ抽出する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="idp107762432"><code class="command">pg_dumpall</code> [<em class="replaceable"><code>connection-option</code></em>...] [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="app-pg-dumpall-description"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p><span class="original">
<application>pg_dumpall</application> is a utility for writing out
(<quote>dumping</quote>) all <productname>PostgreSQL</> databases
of a cluster into one script file. The script file contains
<acronym>SQL</acronym> commands that can be used as input to <xref
linkend="app-psql"> to restore the databases. It does this by
calling <xref linkend="app-pgdump"> for each database in a cluster.
<application>pg_dumpall</application> also dumps global objects
that are common to all databases.
(<application>pg_dump</application> does not save these objects.)
This currently includes information about database users and
groups, tablespaces, and properties such as access permissions
that apply to databases as a whole.
</span><span class="application">pg_dumpall</span>はクラスタの全ての<span class="productname">PostgreSQL</span>データベースを、1つのスクリプトファイルに書き出す(<span class="quote">「<span class="quote">ダンプする</span>」</span>)ためのユーティリティです。
スクリプトファイルには、データベースのリストアのために<a class="xref" href="app-psql.html" title="psql"><span class="refentrytitle"><span class="application">psql</span></span></a>への入力として使うことのできる<acronym class="acronym">SQL</acronym>コマンドが含まれています。
これはクラスタ内の各データベースに対して<a class="xref" href="app-pgdump.html" title="pg_dump"><span class="refentrytitle">pg_dump</span></a>を呼び出すことで行われます。
さらに、<span class="application">pg_dumpall</span>は、全てのデータベースに共通するグローバルオブジェクトもダンプします
(<span class="application">pg_dump</span>はこれらのオブジェクトを保存しません)。
現時点では、これにはデータベースユーザとグループ、テーブル空間、データベース全体に適用するアクセス制限などの属性に関する情報が含まれています。
</p><p><span class="original">
Since <application>pg_dumpall</application> reads tables from all
databases you will most likely have to connect as a database
superuser in order to produce a complete dump. Also you will need
superuser privileges to execute the saved script in order to be
allowed to add users and groups, and to create databases.
</span><span class="application">pg_dumpall</span>は全てのデータベースからテーブルを読み込むため、完全なダンプを作成するには、おそらくデータベーススーパーユーザとして接続する必要がある可能性が高いでしょう。
さらに、保存されたスクリプトを実行する時には、ユーザとグループを追加したり、データベースを作成したりするので、スーパーユーザ権限が必要になるでしょう。
</p><p><span class="original">
The SQL script will be written to the standard output. Use the
[-f|file] option or shell operators to redirect it into a file.
</span>SQLスクリプトは標準出力に書き込まれます。
それをファイルにリダイレクトするためには、[-f|file]オプションまたはシェルの演算子を使用して下さい。
</p><p><span class="original">
<application>pg_dumpall</application> needs to connect several
times to the <productname>PostgreSQL</productname> server (once per
database). If you use password authentication it will ask for
a password each time. It is convenient to have a
<filename>~/.pgpass</> file in such cases. See <xref
linkend="libpq-pgpass"> for more information.
</span><span class="application">pg_dumpall</span>は、<span class="productname">PostgreSQL</span>サーバに何度か接続しなければなりません(データベースごとに接続することになります)。
パスワード認証を使用している場合、その度にパスワード入力が促されます。
そのような場合は<code class="filename">~/.pgpass</code>ファイルを用意しておくと便利です。
詳細は<a class="xref" href="libpq-pgpass.html" title="31.15. パスワードファイル">31.15. パスワードファイル</a>を参照してください。
</p></div><div class="refsect1" id="idp107779984"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p><span class="original">
The following command-line options control the content and
format of the output.
</span>以下のコマンドラインオプションは出力内容や形式を制御します。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-a</code><br /></span><span class="term"><code class="option">--data-only</code></span></dt><dd><p><span class="original">
Dump only the data, not the schema (data definitions).
</span>データのみをダンプし、スキーマ(データ定義)をダンプしません。
</p></dd><dt><span class="term"><code class="option">-c</code><br /></span><span class="term"><code class="option">--clean</code></span></dt><dd><p><span class="original">
Include SQL commands to clean (drop) databases before
recreating them. <command>DROP</> commands for roles and
tablespaces are added as well.
</span>データベースを再作成するコマンドの前に、データベースのクリーンアップ(削除)するコマンドを書き出します。
ロールおよびテーブル空間用の<code class="command">DROP</code>コマンドも同様に追加されます。
</p></dd><dt><span class="term"><code class="option">-f <em class="replaceable"><code>filename</code></em></code><br /></span><span class="term"><code class="option">--file=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p><span class="original">
Send output to the specified file. If this is omitted, the
standard output is used.
</span>出力を指定したファイルに送ります。
これが省略されると標準出力が使用されます。
</p></dd><dt><span class="term"><code class="option">-g</code><br /></span><span class="term"><code class="option">--globals-only</code></span></dt><dd><p><span class="original">
Dump only global objects (roles and tablespaces), no databases.
</span>グローバルオブジェクト(ロールとテーブル空間)のみをダンプし、データベースのダンプを行いません。
</p></dd><dt><span class="term"><code class="option">-o</code><br /></span><span class="term"><code class="option">--oids</code></span></dt><dd><p><span class="original">
Dump object identifiers (<acronym>OID</acronym>s) as part of the
data for every table. Use this option if your application references
the <acronym>OID</>
columns in some way (e.g., in a foreign key constraint).
Otherwise, this option should not be used.
</span>各テーブルのオブジェクト識別子(<acronym class="acronym">OID</acronym>)をデータの一部としてダンプします。
アプリケーションで<acronym class="acronym">OID</acronym>列を(外部キー制約など)何らかの形で使用している場合は、このオプションを使用してください。
そうでなければ、このオプションは使用しないでください。
</p></dd><dt><span class="term"><code class="option">-O</code><br /></span><span class="term"><code class="option">--no-owner</code></span></dt><dd><p><span class="original">
Do not output commands to set
ownership of objects to match the original database.
By default, <application>pg_dumpall</application> issues
<command>ALTER OWNER</> or
<command>SET SESSION AUTHORIZATION</command>
statements to set ownership of created schema elements.
These statements
will fail when the script is run unless it is started by a superuser
(or the same user that owns all of the objects in the script).
To make a script that can be restored by any user, but will give
that user ownership of all the objects, specify <option>-O</>.
</span>オブジェクトの所有権を元のデータベースに一致させるためのコマンドを出力しません。
デフォルトでは、<span class="application">pg_dumpall</span>は<code class="command">ALTER OWNER</code>文または<code class="command">SET SESSION AUTHORIZATION</code>文を発行して作成したスキーマ要素の所有権を設定します。
スーパーユーザ(もしくは、スクリプト内の全てのオブジェクトを所有するユーザ)以外のユーザがスクリプトを実行した場合、これらの文は失敗します。
任意のユーザがリストアできるスクリプトを作成するには、<code class="option">-O</code>を指定してください。ただし、この場合は、全てのオブジェクトの所有者がリストアしたユーザとなってしまいます。
</p></dd><dt><span class="term"><code class="option">-r</code><br /></span><span class="term"><code class="option">--roles-only</code></span></dt><dd><p><span class="original">
Dump only roles, no databases or tablespaces.
</span>ロールのみをダンプし、データベースやテーブル空間のダンプを行いません。
</p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--schema-only</code></span></dt><dd><p><span class="original">
Dump only the object definitions (schema), not data.
</span>オブジェクト定義(スキーマ)のみをダンプし、データをダンプしません。
</p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--superuser=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p><span class="original">
Specify the superuser user name to use when disabling triggers.
This is relevant only if <option>&#045;-disable-triggers</> is used.
(Usually, it's better to leave this out, and instead start the
resulting script as superuser.)
</span>トリガを無効にする際に使用するスーパーユーザのユーザ名を指定します。
これは<code class="option">--disable-triggers</code>を使用する場合にのみ使用されます
(通常はこのオプションを使うよりも、出力されたスクリプトをスーパーユーザ権限で実行する方が良いでしょう)。
</p></dd><dt><span class="term"><code class="option">-t</code><br /></span><span class="term"><code class="option">--tablespaces-only</code></span></dt><dd><p><span class="original">
Dump only tablespaces, no databases or roles.
</span>テーブル空間のみをダンプし、データベースやロールのダンプを行いません。
</p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p><span class="original">
Specifies verbose mode. This will cause
<application>pg_dumpall</application> to output start/stop
times to the dump file, and progress messages to standard error.
It will also enable verbose output in <application>pg_dump</>.
</span>冗長モードを指定します。
これを指定すると、<span class="application">pg_dumpall</span>は開始時刻と終了時刻をダンプファイルに、進行メッセージを標準エラーに出力するようになります。
また、これにより<span class="application">pg_dump</span>の冗長出力が有効になります。
</p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p><span class="original">
Print the <application>pg_dumpall</application> version and exit.
</span><span class="application">pg_dumpall</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">-x</code><br /></span><span class="term"><code class="option">--no-privileges</code><br /></span><span class="term"><code class="option">--no-acl</code></span></dt><dd><p><span class="original">
Prevent dumping of access privileges (grant/revoke commands).
</span>アクセス権限のダンプ(grant/revokeコマンド)を行いません。
</p></dd><dt><span class="term"><code class="option">--binary-upgrade</code></span></dt><dd><p><span class="original">
This option is for use by in-place upgrade utilities. Its use
for other purposes is not recommended or supported. The
behavior of the option may change in future releases without
notice.
</span>このオプションは現位置でのアップグレード用のユーティリティにより使用されるものです。
他の目的での使用は推奨されませんし、サポートもされません。
このオプションの動作は、将来通知することなく変更される可能性があります。
</p></dd><dt><span class="term"><code class="option">--column-inserts</code><br /></span><span class="term"><code class="option">--attribute-inserts</code></span></dt><dd><p><span class="original">
Dump data as <command>INSERT</command> commands with explicit
column names (<literal>INSERT INTO
<replaceable>table</replaceable>
(<replaceable>column</replaceable>, ...) VALUES
...</literal>). This will make restoration very slow; it is mainly
useful for making dumps that can be loaded into
non-<productname>PostgreSQL</productname> databases.
</span>明示的に列名を付けた<code class="command">INSERT</code>コマンド(<code class="literal">INSERT INTO <em class="replaceable"><code>table</code></em> (<em class="replaceable"><code>column</code></em>, ...) VALUES...</code>)としてダンプします。
これによりリストアは非常に遅くなります。
主に、<span class="productname">PostgreSQL</span>以外のデータベースにロード可能なダンプを作成する時に有用です。
</p></dd><dt><span class="term"><code class="option">--disable-dollar-quoting</code></span></dt><dd><p><span class="original">
This option disables the use of dollar quoting for function bodies,
and forces them to be quoted using SQL standard string syntax.
</span>このオプションは、関数本体用のドル引用符の使用を無効にし、強制的に標準SQLの文字列構文を使用した引用符付けを行います。
</p></dd><dt><span class="term"><code class="option">--disable-triggers</code></span></dt><dd><p><span class="original">
This option is relevant only when creating a data-only dump.
It instructs <application>pg_dumpall</application> to include commands
to temporarily disable triggers on the target tables while
the data is reloaded. Use this if you have referential
integrity checks or other triggers on the tables that you
do not want to invoke during data reload.
</span>このオプションは、データのみのダンプを作成する場合だけに使用します。
データのリロード中に、対象とするテーブル上のトリガを一時的に使用不可にするためのコマンドを出力するよう<span class="application">pg_dumpall</span>に指示します。
このオプションは、データのリロード中には呼び出したくない参照整合性検査やその他のトリガがテーブル上にある場合に使用します。
</p><p><span class="original">
Presently, the commands emitted for <option>&#055;&#055;disable-triggers</>
must be done as superuser. So, you should also specify
a superuser name with <option>-S</>, or preferably be careful to
start the resulting script as a superuser.
</span>現在のところ、<code class="option">--disable-triggers</code>を指定してコマンドを実行するのは、スーパーユーザでなければなりません。
そのため、<code class="option">-S</code>でスーパーユーザの名前を指定するか、あるいは、可能であれば、スーパーユーザ権限でスクリプトを開始するよう注意する必要があります。
</p></dd><dt><span class="term"><code class="option">--if-exists</code></span></dt><dd><p><span class="original">
Use conditional commands (i.e. add an <literal>IF EXISTS</literal>
clause) to clean databases and other objects. This option is not valid
unless <option>&#045;-clean</> is also specified.
</span>データベースおよび他のオブジェクトを初期化するときに、条件コマンドを追加します(つまり<code class="literal">IF EXISTS</code>句を追加します)。
このオプションは、<code class="option">--clean</code>も指定されているのでなければ、有効にはなりません。
</p></dd><dt><span class="term"><code class="option">--inserts</code></span></dt><dd><p><span class="original">
Dump data as <command>INSERT</command> commands (rather
than <command>COPY</command>). This will make restoration very slow;
it is mainly useful for making dumps that can be loaded into
non-<productname>PostgreSQL</productname> databases. Note that
the restore might fail altogether if you have rearranged column order.
The <option>&#045;-column-inserts</option> option is safer, though even
slower.
</span>データを(<code class="command">COPY</code>ではなく)<code class="command">INSERT</code>コマンドとしてダンプします。
これを行うとリストアが非常に遅くなります。
主に<span class="productname">PostgreSQL</span>以外のデータベースにロード可能なダンプを作成する時に有用です。
列の順序を変更した場合はリストアが失敗する可能性があることに注意してください。
さらに低速になりますが、<code class="option">--column-inserts</code>オプションの方が安全です。
</p></dd><dt><span class="term"><code class="option">--lock-wait-timeout=<em class="replaceable"><code>timeout</code></em></code></span></dt><dd><p><span class="original">
Do not wait forever to acquire shared table locks at the beginning of
the dump. Instead, fail if unable to lock a table within the specified
<replaceable class="parameter">timeout</>. The timeout may be
specified in any of the formats accepted by <command>SET
statement_timeout</>. Allowed values vary depending on the server
version you are dumping from, but an integer number of milliseconds
is accepted by all versions since 7.3. This option is ignored when
dumping from a pre-7.3 server.
</span>ダンプ開始時に共有テーブルロックの獲得のために永遠に待機しません。
指定した<em class="replaceable"><code>timeout</code></em>の間にテーブルをロックすることができない場合は失敗します。
タイムアウトは<code class="command">SET statement_timeout</code>で受け付けられる任意の書式で指定することができます。
許される値はダンプ元のサーババージョンに依存して変わります。
しかし、7.3以降のすべてのバージョンでミリ秒単位の整数値は受け付けられます。
このオプションは7.3より前のサーバからダンプされた場合、無視されます。
</p></dd><dt><span class="term"><code class="option">--no-security-labels</code></span></dt><dd><p><span class="original">
Do not dump security labels.
</span>セキュリティラベルをダンプしません。
</p></dd><dt><span class="term"><code class="option">--no-tablespaces</code></span></dt><dd><p><span class="original">
Do not output commands to create tablespaces nor select tablespaces
for objects.
With this option, all objects will be created in whichever
tablespace is the default during restore.
</span>オブジェクト用にテーブル空間を作成または選択するコマンドを出力しません。
このオプションを付けると、すべてのオブジェクトはリストア時のデフォルトのテーブル空間内に作成されます。
</p></dd><dt><span class="term"><code class="option">--no-unlogged-table-data</code></span></dt><dd><p><span class="original">
Do not dump the contents of unlogged tables. This option has no
effect on whether or not the table definitions (schema) are dumped;
it only suppresses dumping the table data.
</span>ログを取らないテーブルの内容をダンプしません。
このオプションはテーブル定義(スキーマ)をダンプするかどうかには影響しません。
そのテーブルデータのダンプを抑制するだけです。
</p></dd><dt><span class="term"><code class="option">--quote-all-identifiers</code></span></dt><dd><p><span class="original">
Force quoting of all identifiers. This option is recommended when
dumping a database from a server whose <productname>PostgreSQL</>
major version is different from <application>pg_dumpall</>'s, or when
the output is intended to be loaded into a server of a different
major version. By default, <application>pg_dumpall</> quotes only
identifiers that are reserved words in its own major version.
This sometimes results in compatibility issues when dealing with
servers of other versions that may have slightly different sets
of reserved words. Using <option>&#045;-quote-all-identifiers</> prevents
such issues, at the price of a harder-to-read dump script.
</span>強制的にすべての識別子に引用符を付与します。
このオプションは、<span class="application">pg_dumpall</span>のメジャーバージョンとは異なるメジャーバージョンの<span class="productname">PostgreSQL</span>のサーバーからデータベースをダンプするとき、あるいは出力を異なるメジャーバージョンのサーバにロードする予定であるときに推奨されます。
デフォルトでは、<span class="application">pg_dumpall</span>は、それ自身のメジャーバージョンにおける予約語である識別子に対してのみ引用符を付与します。
これは、他のバージョンのサーバを処理するときに互換性の問題を引き起こす場合があります。
他のバージョンのサーバでは予約語の集合が多少、異なる場合があるからです。
<code class="option">--quote-all-identifiers</code>を使用することで、ダンプのスクリプトが読みにくくなりますが、このような問題を防ぐことができます。
</p></dd><dt><span class="term"><code class="option">--use-set-session-authorization</code></span></dt><dd><p><span class="original">
Output SQL-standard <command>SET SESSION AUTHORIZATION</> commands
instead of <command>ALTER OWNER</> commands to determine object
ownership. This makes the dump more standards compatible, but
depending on the history of the objects in the dump, might not restore
properly.
</span><code class="command">ALTER OWNER</code>コマンドの代わりに標準SQLの<code class="command">SET SESSION AUTHORIZATION</code>コマンドを出力します。
これにより、ダンプの標準への互換性が高まりますが、ダンプ内のオブジェクトの履歴によっては正しくリストアされない可能性があります。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p><span class="original">
Show help about <application>pg_dumpall</application> command line
arguments, and exit.
</span><span class="application">pg_dumpall</span>コマンドライン引数の使用方法を表示し、終了します。
</p></dd></dl></div><p>
</p><p><span class="original">
The following command-line options control the database connection parameters.
</span>以下のコマンドラインオプションは、データベース接続パラメータを制御します。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>connstr</code></em></code><br /></span><span class="term"><code class="option">--dbname=<em class="replaceable"><code>connstr</code></em></code></span></dt><dd><p><span class="original">
Specifies parameters used to connect to the server, as a connection
string. See <xref linkend="libpq-connstring"> for more information.
</span>サーバに接続するために使用されるパラメータを接続文字列として指定します。
詳しくは<a class="xref" href="libpq-connect.html#libpq-connstring" title="31.1.1. 接続文字列">31.1.1. 接続文字列</a>を参照してください。
</p><p><span class="original">
The option is called <literal>&#045;-dbname</> for consistency with other
client applications, but because <application>pg_dumpall</application>
needs to connect to many databases, database name in the connection
string will be ignored. Use <literal>-l</literal> option to specify
the name of the database used to dump global objects and to discover
what other databases should be dumped.
</span>このオプションは、他のクライアントアプリケーションとの一貫性のために<code class="literal">--dbname</code>と呼ばれます。
しかし<span class="application">pg_dumpall</span>は多くのデータベースに接続しなければなりませんので、接続文字列内のデータベース名は無視されます。
グローバルオブジェクトをダンプするために使用されるデータベースの名前を指定するため、または他のどのデータベースをダンプしなければならないかを見つけるためには<code class="literal">-l</code>を使用してください。
</p></dd><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p><span class="original">
Specifies the host name of the machine on which the database
server is running. If the value begins with a slash, it is
used as the directory for the Unix domain socket. The default
is taken from the <envar>PGHOST</envar> environment variable,
if set, else a Unix domain socket connection is attempted.
</span>データベースサーバが稼働しているマシンのホスト名を指定します。
この値がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。
デフォルトは、設定されていれば環境変数<code class="envar">PGHOST</code>から取得されます。設定されていなければ、Unixドメインソケット接続とみなされます。
</p></dd><dt><span class="term"><code class="option">-l <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">--database=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p><span class="original">
Specifies the name of the database to connect to for dumping global
objects and discovering what other databases should be dumped. If
not specified, the <literal>postgres</literal> database will be used,
and if that does not exist, <literal>template1</literal> will be used.
</span>グローバルオブジェクトをダンプし、他のどのデータベースをダンプすべきかを見つけるために接続するデータベースの名前を指定します。
指定されなかった場合、<code class="literal">postgres</code>が使用されます。
もしこれも存在しない場合は<code class="literal">template1</code>が使用されます。
</p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p><span class="original">
Specifies the TCP port or local Unix domain socket file
extension on which the server is listening for connections.
Defaults to the <envar>PGPORT</envar> environment variable, if
set, or a compiled-in default.
</span>サーバが接続を監視するTCPポートもしくはローカルUnixドメインソケットファイルの拡張子を指定します。
デフォルトは、設定されている場合、環境変数<code class="envar">PGPORT</code>の値になります。設定されていなければ、コンパイル時のデフォルト値となります。
</p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p><span class="original">
User name to connect as.
</span>接続ユーザ名です。
</p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p><span class="original">
Never issue a password prompt. If the server requires
password authentication and a password is not available by
other means such as a <filename>.pgpass</filename> file, the
connection attempt will fail. This option can be useful in
batch jobs and scripts where no user is present to enter a
password.
</span>パスワードの入力を促しません。
サーバがパスワード認証を必要とし、かつ、<code class="filename">.pgpass</code>ファイルなどの他の方法が利用できない場合、接続試行は失敗します。
バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。
</p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p><span class="original">
Force <application>pg_dumpall</application> to prompt for a
password before connecting to a database.
</span>データベースに接続する前に、<span class="application">pg_dumpall</span>は強制的にパスワード入力を促します。
</p><p><span class="original">
This option is never essential, since
<application>pg_dumpall</application> will automatically prompt
for a password if the server demands password authentication.
However, <application>pg_dumpall</application> will waste a
connection attempt finding out that the server wants a password.
In some cases it is worth typing <option>-W</> to avoid the extra
connection attempt.
</span>サーバがパスワード認証を要求する場合<span class="application">pg_dumpall</span>は自動的にパスワード入力を促しますので、これが重要になることはありません。
しかし、<span class="application">pg_dumpall</span>は、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。
こうした余計な接続試行を防ぐために<code class="option">-W</code>の入力が有意となる場合もあります。
</p><p><span class="original">
Note that the password prompt will occur again for each database
to be dumped. Usually, it's better to set up a
<filename>~/.pgpass</> file than to rely on manual password entry.
</span>パスワードの入力はダンプするデータベース毎に繰り返し促されます。
通常は、手作業のパスワード入力に依存するよりも<code class="filename">~/.pgpass</code>を設定する方が良いでしょう。
</p></dd><dt><span class="term"><code class="option">--role=<em class="replaceable"><code>rolename</code></em></code></span></dt><dd><p><span class="original">
Specifies a role name to be used to create the dump.
This option causes <application>pg_dumpall</> to issue a
<command>SET ROLE</> <replaceable class="parameter">rolename</>
command after connecting to the database. It is useful when the
authenticated user (specified by <option>-U</>) lacks privileges
needed by <application>pg_dumpall</>, but can switch to a role with
the required rights. Some installations have a policy against
logging in directly as a superuser, and use of this option allows
dumps to be made without violating the policy.
</span>ダンプを作成する際に使用するロール名を指定します。
このオプションにより<span class="application">pg_dumpall</span>はデータベースに接続した後に<code class="command">SET ROLE</code> <em class="replaceable"><code>rolename</code></em>コマンドを発行するようになります。
認証に使用したユーザ(<code class="option">-U</code>で指定されたユーザ)が<span class="application">pg_dumpall</span>で必要とされる権限を持たないが、必要な権限を持つロールに切り替えることができる場合に有用です。
一部のインストレーションではスーパーユーザとして直接ログインさせないポリシーを取ることがありますが、このオプションを使用することでポリシーに反することなくダンプを作成することができます。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="idp107892560"><h2>環境</h2><span class="original">
<title>Environment</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGHOST</code><br /></span><span class="term"><code class="envar">PGOPTIONS</code><br /></span><span class="term"><code class="envar">PGPORT</code><br /></span><span class="term"><code class="envar">PGUSER</code></span></dt><dd><p><span class="original">
Default connection parameters
</span> デフォルトの接続パラメータです。
</p></dd></dl></div><p><span class="original">
This utility, like most other <productname>PostgreSQL</> utilities,
also uses the environment variables supported by <application>libpq</>
(see <xref linkend="libpq-envars">).
</span>また、このユーティリティは、他のほとんどの<span class="productname">PostgreSQL</span>ユーティリティと同様、<span class="application">libpq</span>でサポートされる環境変数を使用します(<a class="xref" href="libpq-envars.html" title="31.14. 環境変数">31.14. 環境変数</a>を参照してください)。
</p></div><div class="refsect1" id="idp107898688"><h2>注釈</h2><span class="original">
<title>Notes</title>
</span><p><span class="original">
Since <application>pg_dumpall</application> calls
<application>pg_dump</application> internally, some diagnostic
messages will refer to <application>pg_dump</application>.
</span><span class="application">pg_dumpall</span>は、内部で<span class="application">pg_dump</span>を呼び出すので、診断メッセージの一部では<span class="application">pg_dump</span>を参照しています。
</p><p><span class="original">
Once restored, it is wise to run <command>ANALYZE</> on each
database so the optimizer has useful statistics. You
can also run <command>vacuumdb -a -z</> to analyze all
databases.
</span>オプティマイザが正確な統計情報を使用できるように、リストア後は、リストアしたテーブルそれぞれに対して<code class="command">ANALYZE</code>を実行することを勧めます。
また、<code class="command">vacuumdb -a -z</code>を実行すると、全てのデータベースを解析することができます。
</p><p><span class="original">
<application>pg_dumpall</application> requires all needed
tablespace directories to exist before the restore; otherwise,
database creation will fail for databases in non-default
locations.
</span><span class="application">pg_dumpall</span>では、必要なテーブル空間用のディレクトリがリストア前に存在していることを要求します。
存在しないと、デフォルト以外の場所にあるデータベースに関して、そのデータベース生成が失敗します。
</p></div><div class="refsect1" id="app-pg-dumpall-ex"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p><span class="original">
To dump all databases:
</span>全てのデータベースを書き出す場合、以下のようにします。
</p><pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>pg_dumpall > db.out</code></strong></pre><p>
</p><p><span class="original">
To reload database(s) from this file, you can use:
</span>上記のファイルからデータベースを読み込む場合、以下のようにします。
</p><pre class="screen"><code class="prompt">$</code> <strong class="userinput"><code>psql -f db.out postgres</code></strong></pre><p><span class="original">
(It is not important to which database you connect here since the
script file created by <application>pg_dumpall</application> will
contain the appropriate commands to create and connect to the saved
databases.)
</span>
(ここではどのデータベースに接続するかということは重要ではありません。
なぜなら<span class="application">pg_dumpall</span>が作成するスクリプトファイルには、保存されたデータベースの作成および接続のためのコマンドが含まれているからです。)
</p></div><div class="refsect1" id="idp107912976"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><p><span class="original">
Check <xref linkend="app-pgdump"> for details on possible
error conditions.
</span>発生し得るエラーの原因については、<a class="xref" href="app-pgdump.html" title="pg_dump"><span class="refentrytitle">pg_dump</span></a>を参照してください。
</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pgdump.html">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pg-isready.html">次へ</a></td></tr><tr><td width="40%" align="left" valign="top">pg_dump </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_isready</span></td></tr></table></div></body></html>