1999-07-22 17:09:15 +02:00
|
|
|
<!--
|
2008-08-29 19:28:43 +02:00
|
|
|
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.73 2008/08/29 17:28:43 alvherre Exp $
|
2001-12-08 04:24:40 +01:00
|
|
|
PostgreSQL documentation
|
1999-07-22 17:09:15 +02:00
|
|
|
-->
|
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<refentry id="APP-PG-DUMPALL">
|
1999-07-06 19:16:42 +02:00
|
|
|
<refmeta>
|
2000-12-19 23:12:47 +01:00
|
|
|
<refentrytitle id="APP-PG-DUMPALL-TITLE"><application>pg_dumpall</application></refentrytitle>
|
|
|
|
<manvolnum>1</manvolnum>
|
1999-07-06 19:16:42 +02:00
|
|
|
<refmiscinfo>Application</refmiscinfo>
|
|
|
|
</refmeta>
|
2000-12-19 23:12:47 +01:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<refnamediv>
|
2000-12-19 23:12:47 +01:00
|
|
|
<refname>pg_dumpall</refname>
|
2002-08-27 20:57:26 +02:00
|
|
|
<refpurpose>extract a <productname>PostgreSQL</productname> database cluster into a script file</refpurpose>
|
1999-07-06 19:16:42 +02:00
|
|
|
</refnamediv>
|
|
|
|
|
2003-08-31 19:32:24 +02:00
|
|
|
<indexterm zone="app-pg-dumpall">
|
|
|
|
<primary>pg_dumpall</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<refsynopsisdiv>
|
|
|
|
<cmdsynopsis>
|
|
|
|
<command>pg_dumpall</command>
|
2003-03-24 15:32:51 +01:00
|
|
|
<arg rep="repeat"><replaceable>option</replaceable></arg>
|
2000-12-19 23:12:47 +01:00
|
|
|
</cmdsynopsis>
|
|
|
|
</refsynopsisdiv>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<refsect1 id="app-pg-dumpall-description">
|
|
|
|
<title>Description</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<para>
|
|
|
|
<application>pg_dumpall</application> is a utility for writing out
|
2002-11-15 04:11:18 +01:00
|
|
|
(<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.
|
2000-12-19 23:12:47 +01:00
|
|
|
(<application>pg_dump</application> does not save these objects.)
|
2003-05-31 01:55:10 +02:00
|
|
|
This currently includes information about database users and
|
2008-03-20 18:36:58 +01:00
|
|
|
groups, tablespaces, and properties such as access permissions
|
|
|
|
that apply to databases as a whole.
|
2000-12-19 23:12:47 +01:00
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<para>
|
|
|
|
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
|
2001-03-05 19:42:57 +01:00
|
|
|
superuser privileges to execute the saved script in order to be
|
2000-12-19 23:12:47 +01:00
|
|
|
allowed to add users and groups, and to create databases.
|
|
|
|
</para>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<para>
|
2001-10-05 17:50:11 +02:00
|
|
|
The SQL script will be written to the standard output. Shell
|
2000-12-19 23:12:47 +01:00
|
|
|
operators should be used to redirect it into a file.
|
|
|
|
</para>
|
2002-09-06 00:05:50 +02:00
|
|
|
|
|
|
|
<para>
|
2003-03-24 15:32:51 +01:00
|
|
|
<application>pg_dumpall</application> needs to connect several
|
2005-01-04 04:58:16 +01:00
|
|
|
times to the <productname>PostgreSQL</productname> server (once per
|
2007-12-11 20:57:32 +01:00
|
|
|
database). If you use password authentication it will ask for
|
2002-09-06 00:05:50 +02:00
|
|
|
a password each time. It is convenient to have a
|
2005-01-06 19:29:11 +01:00
|
|
|
<filename>~/.pgpass</> file in such cases. See <xref
|
|
|
|
linkend="libpq-pgpass"> for more information.
|
2002-09-06 00:05:50 +02:00
|
|
|
</para>
|
|
|
|
|
2002-08-27 05:55:17 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Options</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
The following command-line options control the content and
|
2003-05-31 01:55:10 +02:00
|
|
|
format of the output.
|
2002-08-27 05:55:17 +02:00
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
<variablelist>
|
2003-05-31 01:55:10 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-a</></term>
|
|
|
|
<term><option>--data-only</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
Dump only the data, not the schema (data definitions).
|
2003-05-31 01:55:10 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
<varlistentry>
|
2002-09-07 18:14:33 +02:00
|
|
|
<term><option>-c</option></term>
|
|
|
|
<term><option>--clean</option></term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-10-11 00:29:48 +02:00
|
|
|
Include SQL commands to clean (drop) databases before
|
|
|
|
recreating them. <command>DROP</> commands for roles and
|
|
|
|
tablespaces are added as well.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-d</option></term>
|
|
|
|
<term><option>--inserts</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
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
|
Update reference documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:
may - permission, "You may borrow my rake."
can - ability, "I can lift that log."
might - possibility, "It might rain today."
Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice. Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 00:26:05 +01:00
|
|
|
the restore might fail altogether if you have rearranged column order.
|
2005-01-04 04:58:16 +01:00
|
|
|
The <option>-D</option> option is safer, though even slower.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-D</option></term>
|
|
|
|
<term><option>--column-inserts</option></term>
|
|
|
|
<term><option>--attribute-inserts</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
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.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2007-02-22 00:21:12 +01:00
|
|
|
|
2007-01-25 04:30:43 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-f <replaceable class="parameter">filename</replaceable></option></term>
|
|
|
|
<term><option>--file=<replaceable class="parameter">filename</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-01-25 16:08:06 +01:00
|
|
|
Send output to the specified file. If this is omitted, the
|
|
|
|
standard output is used.
|
2007-01-25 04:30:43 +01:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-08-27 20:57:26 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
2002-09-07 18:14:33 +02:00
|
|
|
<term><option>-g</option></term>
|
|
|
|
<term><option>--globals-only</option></term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-01-15 18:22:46 +01:00
|
|
|
Dump only global objects (roles and tablespaces), no databases.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-i</></term>
|
|
|
|
<term><option>--ignore-version</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2008-04-13 05:49:22 +02:00
|
|
|
A deprecated option that is now ignored.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-o</></term>
|
|
|
|
<term><option>--oids</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
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.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2004-07-12 16:35:45 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-O</></term>
|
|
|
|
<term><option>--no-owner</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Do not output commands to set
|
2005-01-04 04:58:16 +01:00
|
|
|
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</>.
|
2004-07-12 16:35:45 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2008-08-29 19:28:43 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>--lock-wait-timeout=<replaceable class="parameter">timeout</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
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.)
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2008-03-20 18:36:58 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>--no-tablespaces</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2007-01-25 03:30:32 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-r</option></term>
|
|
|
|
<term><option>--roles-only</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Dump only roles, no databases or tablespaces.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2003-05-31 01:55:10 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-s</option></term>
|
|
|
|
<term><option>--schema-only</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
Dump only the object definitions (schema), not data.
|
2003-05-31 01:55:10 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2004-07-12 16:35:45 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-S <replaceable class="parameter">username</replaceable></option></term>
|
|
|
|
<term><option>--superuser=<replaceable class="parameter">username</replaceable></option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specify the superuser user name to use when disabling triggers.
|
2005-01-04 04:58:16 +01:00
|
|
|
This is only relevant if <option>--disable-triggers</> is used.
|
|
|
|
(Usually, it's better to leave this out, and instead start the
|
|
|
|
resulting script as superuser.)
|
2004-07-12 16:35:45 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2007-01-25 03:30:32 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-t</option></term>
|
|
|
|
<term><option>--tablespaces-only</option></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Dump only tablespaces, no databases or roles.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
<varlistentry>
|
|
|
|
<term><option>-v</></term>
|
|
|
|
<term><option>--verbose</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
Specifies verbose mode. This will cause
|
|
|
|
<application>pg_dumpall</application> to output start/stop
|
2004-06-07 22:35:57 +02:00
|
|
|
times to the dump file, and progress messages to standard error.
|
|
|
|
It will also enable verbose output in <application>pg_dump</>.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2003-05-31 01:55:10 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>-x</></term>
|
|
|
|
<term><option>--no-privileges</></term>
|
|
|
|
<term><option>--no-acl</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
Prevent dumping of access privileges (grant/revoke commands).
|
2003-05-31 01:55:10 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2004-07-12 16:35:45 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>--disable-dollar-quoting</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
This option disables the use of dollar quoting for function bodies,
|
|
|
|
and forces them to be quoted using SQL standard string syntax.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>--disable-triggers</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
This option is only relevant 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.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Presently, the commands emitted for <option>--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.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term><option>--use-set-session-authorization</></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-11-01 22:09:51 +01:00
|
|
|
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
|
Update reference documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:
may - permission, "You may borrow my rake."
can - ability, "I can lift that log."
might - possibility, "It might rain today."
Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice. Similarly, "It may crash" is better stated, "It might crash".
2007-02-01 00:26:05 +01:00
|
|
|
depending on the history of the objects in the dump, might not restore
|
2005-11-01 22:09:51 +01:00
|
|
|
properly.
|
2004-07-12 16:35:45 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2004-07-19 23:39:48 +02:00
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
The following command-line options control the database connection parameters.
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term>-h <replaceable>host</replaceable></term>
|
2007-01-25 03:46:33 +01:00
|
|
|
<term>--host=<replaceable>host</replaceable></term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
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.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2007-02-22 00:21:12 +01:00
|
|
|
|
2007-01-25 03:46:33 +01:00
|
|
|
<varlistentry>
|
|
|
|
<term>-l <replaceable>dbname</replaceable></term>
|
|
|
|
<term>--database=<replaceable>dbname</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
Specifies the name of the database to connect to to dump global
|
|
|
|
objects and discover what other databases should be dumped. If
|
|
|
|
not specified, the <quote>postgres</quote> database will be used,
|
|
|
|
and if that does not exist, <quote>template1</quote> will be used.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-08-27 20:57:26 +02:00
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>-p <replaceable>port</replaceable></term>
|
2007-01-25 03:46:33 +01:00
|
|
|
<term>--port=<replaceable>port</replaceable></term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2005-01-04 04:58:16 +01:00
|
|
|
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.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>-U <replaceable>username</replaceable></term>
|
2007-01-25 03:46:33 +01:00
|
|
|
<term>--username=<replaceable>username</replaceable></term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-12-11 20:57:32 +01:00
|
|
|
User name to connect as.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
|
|
|
<term>-W</term>
|
2007-02-01 05:39:33 +01:00
|
|
|
<term>--password</term>
|
2002-08-27 20:57:26 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2007-12-11 20:57:32 +01:00
|
|
|
Force <application>pg_dumpall</application> to prompt for a
|
|
|
|
password before connecting to a database.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
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.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
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.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
2002-08-27 05:55:17 +02:00
|
|
|
</variablelist>
|
|
|
|
</para>
|
2000-12-19 23:12:47 +01:00
|
|
|
</refsect1>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Environment</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><envar>PGHOST</envar></term>
|
|
|
|
<term><envar>PGPORT</envar></term>
|
|
|
|
<term><envar>PGUSER</envar></term>
|
|
|
|
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2003-03-24 15:32:51 +01:00
|
|
|
Default connection parameters
|
2002-07-28 17:22:21 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
2007-02-20 19:10:59 +01:00
|
|
|
|
|
|
|
<para>
|
|
|
|
This utility, like most other <productname>PostgreSQL</> utilities,
|
2007-03-26 19:23:37 +02:00
|
|
|
also uses the environment variables supported by <application>libpq</>
|
|
|
|
(see <xref linkend="libpq-envars">).
|
2007-02-20 19:10:59 +01:00
|
|
|
</para>
|
|
|
|
|
2002-07-28 17:22:21 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
Since <application>pg_dumpall</application> calls
|
|
|
|
<application>pg_dump</application> internally, some diagnostic
|
|
|
|
messages will refer to <application>pg_dump</application>.
|
|
|
|
</para>
|
|
|
|
|
2003-03-18 01:02:11 +01:00
|
|
|
<para>
|
|
|
|
Once restored, it is wise to run <command>ANALYZE</> on each
|
|
|
|
database so the optimizer has useful statistics. You
|
2003-03-24 15:32:51 +01:00
|
|
|
can also run <command>vacuumdb -a -z</> to analyze all
|
2003-03-18 01:02:11 +01:00
|
|
|
databases.
|
2002-08-27 20:57:26 +02:00
|
|
|
</para>
|
|
|
|
|
2006-06-17 00:01:17 +02:00
|
|
|
<para>
|
|
|
|
<application>pg_dumpall</application> requires all needed
|
|
|
|
tablespace directories to exist before the restore or
|
|
|
|
database creation will fail for databases in non-default
|
|
|
|
locations.
|
|
|
|
</para>
|
|
|
|
|
2002-08-27 20:57:26 +02:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
|
2001-05-17 23:12:49 +02:00
|
|
|
<refsect1 id="app-pg-dumpall-ex">
|
|
|
|
<title>Examples</title>
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
2000-12-19 23:12:47 +01:00
|
|
|
To dump all databases:
|
|
|
|
|
|
|
|
<screen>
|
|
|
|
<prompt>$</prompt> <userinput>pg_dumpall > db.out</userinput>
|
|
|
|
</screen>
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
2000-12-19 23:12:47 +01:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
2000-12-19 23:12:47 +01:00
|
|
|
To reload this database use, for example:
|
|
|
|
<screen>
|
2005-06-21 06:02:34 +02:00
|
|
|
<prompt>$</prompt> <userinput>psql -f db.out postgres</userinput>
|
2000-12-19 23:12:47 +01:00
|
|
|
</screen>
|
|
|
|
(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
|
2001-03-05 19:42:57 +01:00
|
|
|
databases.)
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
2000-12-19 23:12:47 +01:00
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
1998-12-29 03:24:47 +01:00
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
<para>
|
2007-02-20 19:10:59 +01:00
|
|
|
Check <xref linkend="app-pgdump"> for details on possible
|
|
|
|
error conditions.
|
1999-07-06 19:16:42 +02:00
|
|
|
</para>
|
2000-12-19 23:12:47 +01:00
|
|
|
</refsect1>
|
|
|
|
|
1999-07-06 19:16:42 +02:00
|
|
|
</refentry>
|