-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pg-dumpall.html
More file actions
668 lines (665 loc) · 57.8 KB
/
app-pg-dumpall.html
File metadata and controls
668 lines (665 loc) · 57.8 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
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
<?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@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-pgdump.html" title="pg_dump" /><link rel="next" href="app-pg-isready.html" title="pg_isready" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 15.3文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-client.html" title="PostgreSQLクライアントアプリケーション">PostgreSQLクライアントアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 15.3 : app-pg-dumpall.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgdump.html" title="pg_dump">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">pg_dumpall</span></td><td width="20%" align="right"> <a accesskey="n" href="app-pg-isready.html" title="pg_isready">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-PG-DUMPALL"><div class="titlepage"></div><a id="id-1.9.4.14.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_dumpall</span></span></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="id-1.9.4.14.4.1"><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</productname> 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 the cluster.
<application>pg_dumpall</application> also dumps global objects
that are common to all databases, namely database roles, tablespaces,
and privilege grants for configuration parameters.
(<application>pg_dump</application> does not save these objects.)
</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"><span class="application">pg_dump</span></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 roles and 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
<option>-f</option>/<option>&#45;-file</option> option or shell operators to
redirect it into a file.
</span>
SQLスクリプトは標準出力に書き込まれます。
それをファイルにリダイレクトするためには、<code class="option">-f</code>/<code class="option">--file</code>オプションまたはシェルの演算子を使用して下さい。
</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</filename> 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="34.16. パスワードファイル">34.16</a>を参照してください。
</p></div><div class="refsect1" id="id-1.9.4.14.6"><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</command> commands for roles and
tablespaces are added as well.
</span>
データベースを再作成するコマンドの前に、データベースのクリーンアップ(削除)するコマンドを書き出します。
ロールおよびテーブル空間用の<code class="command">DROP</code>コマンドも同様に追加されます。
</p></dd><dt><span class="term"><code class="option">-E <em class="replaceable"><code>encoding</code></em></code><br /></span><span class="term"><code class="option">--encoding=<em class="replaceable"><code>encoding</code></em></code></span></dt><dd><p>
<span class="original">
Create the dump in the specified character set encoding. By default,
the dump is created in the database encoding. (Another way to get the
same result is to set the <envar>PGCLIENTENCODING</envar> environment
variable to the desired dump encoding.)
</span>
指定された文字エンコーディングでダンプを作ります。
デフォルトでは、ダンプはデータベースエンコーディングで作られます。
(同じ結果を得る他の方法は<code class="envar">PGCLIENTENCODING</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">--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</command> 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</option>.
</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>&#45;-disable-triggers</option> 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.
Repeating the option causes additional debug-level messages
to appear on standard error.
The option is also passed down to <application>pg_dump</application>.
</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 restored. Use this if you have referential
integrity checks or other triggers on the tables that you
do not want to invoke during data restore.
</span>
このオプションは、データのみのダンプを作成する場合だけに使用します。
データのリストア中に、対象とするテーブル上のトリガを一時的に使用不可にするためのコマンドを出力するよう<span class="application">pg_dumpall</span>に指示します。
このオプションは、データのリストア中には呼び出したくない参照整合性検査やその他のトリガがテーブル上にある場合に使用します。
</p><p>
<span class="original">
Presently, the commands emitted for <option>&#45;-disable-triggers</option>
must be done as superuser. So, you should also specify
a superuser name with <option>-S</option>, 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">--exclude-database=<em class="replaceable"><code>pattern</code></em></code></span></dt><dd><p>
<span class="original">
Do not dump databases whose name matches
<replaceable class="parameter">pattern</replaceable>.
Multiple patterns can be excluded by writing multiple
<option>&#45;-exclude-database</option> switches. The
<replaceable class="parameter">pattern</replaceable> parameter is
interpreted as a pattern according to the same rules used by
<application>psql</application>'s <literal>\d</literal>
commands (see <xref linkend="app-psql-patterns"/> below),
so multiple databases can also be excluded by writing wildcard
characters in the pattern. When using wildcards, be careful to
quote the pattern if needed to prevent shell wildcard expansion.
</span>
名前が<em class="replaceable"><code>pattern</code></em>にマッチするデータベースをダンプしません。
複数の<code class="option">--exclude-database</code>オプションを記述することで複数のパターンを除外できます。
<em class="replaceable"><code>pattern</code></em>パラメータは<span class="application">psql</span>の<code class="literal">\d</code>コマンドで使用される規則(以下の<a class="xref" href="app-psql.html#APP-PSQL-PATTERNS" title="パターン">パターン</a>参照)と同じ規則に従うパターンとして解釈されます。ですので、ワイルドカード文字をパターン内に記述することで、複数のデータベースを除外することもできます。
ワイルドカードを使用する時は、シェルによりそのワイルドカードを展開させないように、パターンを引用符で括ってください。
</p></dd><dt><span class="term"><code class="option">--extra-float-digits=<em class="replaceable"><code>ndigits</code></em></code></span></dt><dd><p>
<span class="original">
Use the specified value of extra_float_digits when dumping
floating-point data, instead of the maximum available precision.
Routine dumps made for backup purposes should not use this option.
</span>
浮動小数点データをダンプする時に、利用できる最大の精度の代わりに、extra_float_digitsで指定された値を使います。
バックアップ目的で作られたダンプルーチンは、このオプションを使うべきではありません。
</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 drop databases and other objects. This option is not valid
unless <option>&#45;-clean</option> 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>&#45;-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">--load-via-partition-root</code></span></dt><dd><p>
<span class="original">
When dumping data for a table partition, make
the <command>COPY</command> or <command>INSERT</command> statements
target the root of the partitioning hierarchy that contains it, rather
than the partition itself. This causes the appropriate partition to
be re-determined for each row when the data is loaded. This may be
useful when restoring data on a server where rows do not always fall
into the same partitions as they did on the original server. That
could happen, for example, if the partitioning column is of type text
and the two systems have different definitions of the collation used
to sort the partitioning column.
</span>
テーブルパーティションに対するデータをダンプするとき、<code class="command">COPY</code>や<code class="command">INSERT</code>文をパーティション自体ではなく、それを含むパーティション階層のルートに向けさせます。
これにより、データが読み込まれるときに各行に対して適切なパーティションが再判断されるようになります。
これは、行が必ずしも元のサーバと同じパーティションに落ちないようなサーバにデータをリストアするときに有用でしょう。
例えば、パーティション列がtext型で二つのシステムがパーティション列をソートするのに使われる照合順序の異なった定義を持っている場合に、これは起こりえることです。
</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</replaceable>. The timeout may be
specified in any of the formats accepted by <command>SET
statement_timeout</command>.
</span>
ダンプ開始時に共有テーブルロックの獲得のために永遠に待機しません。
指定した<em class="replaceable"><code>timeout</code></em>の間にテーブルをロックすることができない場合は失敗します。
タイムアウトは<code class="command">SET statement_timeout</code>で受け付けられる任意の書式で指定できます。
</p></dd><dt><span class="term"><code class="option">--no-comments</code></span></dt><dd><p>
<span class="original">
Do not dump comments.
</span>
コメントをダンプしません。
</p></dd><dt><span class="term"><code class="option">--no-publications</code></span></dt><dd><p>
<span class="original">
Do not dump publications.
</span>
パブリケーションをダンプしません。
</p></dd><dt><span class="term"><code class="option">--no-role-passwords</code></span></dt><dd><p>
<span class="original">
Do not dump passwords for roles. When restored, roles will have a
null password, and password authentication will always fail until the
password is set. Since password values aren't needed when this option
is specified, the role information is read from the catalog
view <structname>pg_roles</structname> instead
of <structname>pg_authid</structname>. Therefore, this option also
helps if access to <structname>pg_authid</structname> is restricted by
some security policy.
</span>
ロールのパスワードをダンプしません。
リストア時にロールのパスワードはNULLになるため、パスワードが設定されるまでは、パスワード認証は常に失敗します。
このオプションが指定された場合、パスワードの値が不要となるので、ロール情報は<code class="structname">pg_authid</code>ではなく、カタログビューの<code class="structname">pg_roles</code>から読み取られます。
従って、<code class="structname">pg_authid</code>へのアクセスが何らかのセキュリティーポリシーによって制限されている場合にも、このオプションは役立ちます。
</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-subscriptions</code></span></dt><dd><p>
<span class="original">
Do not dump subscriptions.
</span>
サブスクリプションをダンプしません。
</p></dd><dt><span class="term"><code class="option">--no-sync</code></span></dt><dd><p>
<span class="original">
By default, <command>pg_dumpall</command> will wait for all files
to be written safely to disk. This option causes
<command>pg_dumpall</command> to return without waiting, which is
faster, but means that a subsequent operating system crash can leave
the dump corrupt. Generally, this option is useful for testing
but should not be used when dumping data from production installation.
</span>
デフォルトでは、<code class="command">pg_dumpall</code>はすべてのファイルが確実にディスクに書き込まれるまで待機します。
このオプションを使うと<code class="command">pg_dumpall</code>は待機せずに戻るため、より高速になりますが、これは、その後にオペレーティングシステムがクラッシュすると、ダンプが破損する可能性があることを意味します。
一般的に言って、このオプションはテスト用には有用ですが、実運用の環境からデータをダンプするときには使用しないほうが良いでしょう。
</p></dd><dt><span class="term"><code class="option">--no-table-access-method</code></span></dt><dd><p>
<span class="original">
Do not output commands to select table access methods.
With this option, all objects will be created with whichever
table access method is the default during restore.
</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-toast-compression</code></span></dt><dd><p>
<span class="original">
Do not output commands to set <acronym>TOAST</acronym> compression
methods.
With this option, all columns will be restored with the default
compression setting.
</span>
<acronym class="acronym">TOAST</acronym>圧縮手法を設定するコマンドを出力しません。
このオプションにより、列はすべてデフォルトの圧縮の設定でリストアされます。
</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">--on-conflict-do-nothing</code></span></dt><dd><p>
<span class="original">
Add <literal>ON CONFLICT DO NOTHING</literal> to
<command>INSERT</command> commands.
This option is not valid unless <option>&#45;-inserts</option> or
<option>&#45;-column-inserts</option> is also specified.
</span>
<code class="command">INSERT</code>コマンドに<code class="literal">ON CONFLICT DO NOTHING</code>を追加します。
このオプションは、<code class="option">--inserts</code>または<code class="option">--column-inserts</code>が同時に指定されていなければ、有効ではありません。
</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</productname>
major version is different from <application>pg_dumpall</application>'s, or when
the output is intended to be loaded into a server of a different
major version. By default, <application>pg_dumpall</application> 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>&#45;-quote-all-identifiers</option> 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">--rows-per-insert=<em class="replaceable"><code>nrows</code></em></code></span></dt><dd><p>
<span class="original">
Dump data as <command>INSERT</command> commands (rather than
<command>COPY</command>). Controls the maximum number of rows per
<command>INSERT</command> command. The value specified must be a
number greater than zero. Any error during restoring will cause only
rows that are part of the problematic <command>INSERT</command> to be
lost, rather than the entire table contents.
</span>
(<code class="command">COPY</code>ではなく)<code class="command">INSERT</code>コマンドでデータをダンプします。
<code class="command">INSERT</code>コマンド1つあたりの最大行数を制御します。
指定する値は0より大きくなければなりません。
リストア中のエラーでは、テーブルの内容がまるごと失われることはなく、問題のある<code class="command">INSERT</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</command> commands
instead of <command>ALTER OWNER</command> 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 <link
linkend="libpq-connstring">connection string</link>; these
will override any conflicting command line options.
</span>
サーバに接続するために使用されるパラメータを<a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="34.1.1. 接続文字列">接続文字列</a>として指定します。これは衝突するコマンドラインオプションよりも優先します。
</p><p>
<span class="original">
The option is called <literal>&#45;-dbname</literal> for consistency with other
client applications, but because <application>pg_dumpall</application>
needs to connect to many databases, the database name in the
connection string will be ignored. Use the <literal>-l</literal>
option to specify the name of the database used for the initial
connection, which will dump global objects and 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</option> 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</filename> 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</application> to issue a
<command>SET ROLE</command> <replaceable class="parameter">rolename</replaceable>
command after connecting to the database. It is useful when the
authenticated user (specified by <option>-U</option>) lacks privileges
needed by <application>pg_dumpall</application>, 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="id-1.9.4.14.7"><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><dt><span class="term"><code class="envar">PG_COLOR</code></span></dt><dd><p>
<span class="original">
Specifies whether to use color in diagnostic messages. Possible values
are <literal>always</literal>, <literal>auto</literal> and
<literal>never</literal>.
</span>
診断メッセージで色を使うかどうかを指定します。
可能な値は<code class="literal">always</code>、<code class="literal">auto</code>、<code class="literal">never</code>です。
</p></dd></dl></div><p>
<span class="original">
This utility, like most other <productname>PostgreSQL</productname> utilities,
also uses the environment variables supported by <application>libpq</application>
(see <xref linkend="libpq-envars"/>).
</span>
また、このユーティリティは、他のほとんどの<span class="productname">PostgreSQL</span>ユーティリティと同様、<span class="application">libpq</span>でサポートされる環境変数を使用します(<a class="xref" href="libpq-envars.html" title="34.15. 環境変数">34.15</a>を参照してください)。
</p></div><div class="refsect1" id="id-1.9.4.14.8"><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">
The <option>&#45;-clean</option> option can be useful even when your
intention is to restore the dump script into a fresh cluster. Use of
<option>&#45;-clean</option> authorizes the script to drop and re-create the
built-in <literal>postgres</literal> and <literal>template1</literal>
databases, ensuring that those databases will retain the same properties
(for instance, locale and encoding) that they had in the source cluster.
Without the option, those databases will retain their existing
database-level properties, as well as any pre-existing contents.
</span>
<code class="option">--clean</code>オプションは、ダンプスクリプトを新しいクラスタにリストアする意図のときであっても、有用なことがあります。
<code class="option">--clean</code>の使用は、スクリプトに組み込みの<code class="literal">postgres</code>および<code class="literal">template1</code>データベースを削除して再作成する権限を与え、これらのデータベースが元のクラスタに持っていたものと同じ属性(例えばロケールやエンコーディング)を保つことを保証します。
このオプションが無いと、これらのデータベースは既存のデータベースレベルの属性を維持します。
</p><p>
<span class="original">
Once restored, it is wise to run <command>ANALYZE</command> on each
database so the optimizer has useful statistics. You
can also run <command>vacuumdb -a -z</command> to analyze all
databases.
</span>
オプティマイザが正確な統計情報を使用できるように、リストア後は、リストアしたテーブルそれぞれに対して<code class="command">ANALYZE</code>を実行することを勧めます。
また、<code class="command">vacuumdb -a -z</code>を実行すると、全てのデータベースを解析することができます。
</p><p>
<span class="original">
The dump script should not be expected to run completely without errors.
In particular, because the script will issue <command>CREATE ROLE</command>
for every role existing in the source cluster, it is certain to get a
<quote>role already exists</quote> error for the bootstrap superuser,
unless the destination cluster was initialized with a different bootstrap
superuser name. This error is harmless and should be ignored. Use of
the <option>&#45;-clean</option> option is likely to produce additional
harmless error messages about non-existent objects, although you can
minimize those by adding <option>&#45;-if-exists</option>.
</span>
ダンプスクリプトはエラー無しに完全に実行すると期待すべきではありません。
特にスクリプトは存在する全てのロールに対して<code class="command">CREATE ROLE</code>を発行するので、宛先のクラスタが異なるベースストラップスーパーユーザ名で初期化されていない限り、ブートストラップスーパーユーザについて<span class="quote">「<span class="quote">role already exists</span>」</span>エラーを受け取ることは確実です。
このエラーは無害であり、無視してください。
<code class="option">--clean</code>オプションの使用は、追加で無害な存在しないオブジェクトについてのエラーメッセージを発生させますが、<code class="option">--if-exists</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 restore 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. An exception is that if you specified <option>&#45;-clean</option>,
you must connect to the <literal>postgres</literal> database initially;
the script will attempt to drop other databases immediately, and that
will fail for the database you are connected to.
</span>
ここではどのデータベースに接続するかということは重要ではありません。なぜなら<span class="application">pg_dumpall</span>が作成するスクリプトファイルには、保存されたデータベースの作成および接続のための適切なコマンドが含まれているからです。
例外は<code class="option">--clean</code>を指定した場合で、最初に<code class="literal">postgres</code>データベースに接続しなければなりません。
このときのスクリプトは即座に他のデータベースを削除しようとし、接続中のデータベースに対しては失敗するでしょう。
</p></div><div class="refsect1" id="id-1.9.4.14.10"><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"><span class="application">pg_dump</span></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" title="pg_dump">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pg-isready.html" title="pg_isready">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_dump</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_isready</span></td></tr></table></div></body></html>