]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/pg_dumpall.sgml
Rename --accounts-only to --globals-only, polish documentation.
[postgresql] / doc / src / sgml / ref / pg_dumpall.sgml
1 <!--
2 $Header: /cvsroot/pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.17 2000/12/19 22:12:46 petere Exp $
3 Postgres documentation
4 -->
5
6 <refentry id="APP-PG-DUMPALL">
7  <docinfo>
8   <date>2000-12-19</date>
9  </docinfo>
10
11  <refmeta>
12   <refentrytitle id="APP-PG-DUMPALL-TITLE"><application>pg_dumpall</application></refentrytitle>
13   <manvolnum>1</manvolnum>
14   <refmiscinfo>Application</refmiscinfo>
15  </refmeta>
16
17  <refnamediv>
18   <refname>pg_dumpall</refname>
19   <refpurpose>Extract all databases into a script file</refpurpose>
20  </refnamediv>
21
22  <refsynopsisdiv>
23   <cmdsynopsis>
24    <command>pg_dumpall</command>
25    <group><arg>-c</arg><arg>--clean</arg></group>
26    <arg>-h <replaceable>host</replaceable></arg>
27    <arg>-p <replaceable>port</replaceable></arg>
28    <arg>--globals-only</arg>
29   </cmdsynopsis>
30  </refsynopsisdiv>
31
32  <refsect1 id="app-pg-dumpall-description">
33   <title>Description</title>
34
35   <para>
36    <application>pg_dumpall</application> is a utility for writing out
37    (<quote>dumping</quote>) all Postgres databases of a cluster into
38    one script file.  The script file contains SQL commands that can be
39    used as input to <xref linkend="app-psql" endterm="app-psql-title">
40    to restore the databases.  It does this by calling <xref
41    linkend="app-pgdump" endterm="app-pgdump-title"> for each database
42    in a cluster.  <application>pg_dumpall</application> also dumps
43    global objects that are common to all databases.
44    (<application>pg_dump</application> does not save these objects.)
45    This currently includes the information about database users and
46    groups.
47   </para>
48
49   <para>
50    Thus, <application>pg_dumpall</application> is an integrated
51    solution for backing up your databases.
52   </para>
53
54   <para>
55    Since <application>pg_dumpall</application> reads tables from all
56    databases you will most likely have to connect as a database
57    superuser in order to produce a complete dump.  Also you will need
58    superuser priviledges to execute the saves script in order to be
59    allowed to add users and groups, and to create databases.
60   </para>
61
62   <para>
63    The SQL script will be written to the standard ouput.  Shell
64    operators should be used to redirect it into a file.
65   </para>
66
67   <refsect2>
68    <title>Options</title>
69
70    <para>
71     <application>pg_dumpall</application> accepts the following
72     command line arguments:
73
74     <variablelist>
75      <varlistentry>
76       <term>-h <replaceable>host</replaceable></term>
77       <listitem>
78        <para>
79         Specifies the hostname of the machine on which the database
80         server is running.  If host begins with a slash, it is used as
81         the directory for the Unix domain socket.  The default is
82         taken from the <envar>PGHOST</envar> environment variable, if
83         set, else a Unix domain socket connection is attempted.
84        </para>
85       </listitem>
86      </varlistentry>
87
88      <varlistentry>
89       <term>-p <replaceable>port</replaceable></term>
90       <listitem>
91        <para>
92         The port number on which the server is listening.  Defaults to
93         the <envar>PGPORT</envar> environment variable, if set, or a
94         compiled-in default.
95        </para>
96       </listitem>
97      </varlistentry>
98
99      <varlistentry>
100       <term>--globals-only</term>
101       <listitem>
102        <para>
103         Only dump global objects (users and groups), no databases.
104        </para>
105       </listitem>
106      </varlistentry>
107
108     </variablelist>
109    </para>
110
111    <para>
112     Any other command line parameters are passed to the underlying
113     <xref endterm="app-pgdump-title" linkend="app-pgdump-title">
114     calls.  This is useful to control some aspects of the output
115     format, but some options such as <option>-f</option>,
116     <option>-t</option>, and <replaceable
117     class="parameter">dbname</replaceable> should be avoided.
118    </para>
119   </refsect2>
120  </refsect1>
121
122  <refsect1 id="app-pg-dumpall-usage">
123   <title>Usage</title>
124   <para>
125    To dump all databases:
126
127 <screen>
128 <prompt>$</prompt> <userinput>pg_dumpall &gt; db.out</userinput>
129 </screen>
130   </para>
131
132   <para>
133    To reload this database use, for example:
134 <screen>
135 <prompt>$</prompt> <userinput>psql -f db.out template1</userinput>
136 </screen>
137    (It is not important to which database you connect here since the
138    script file created by <application>pg_dumpall</application> will
139    contain the appropriate commands to create and connect to the saved
140    databases.
141   </para>
142  </refsect1>
143
144  <refsect1>
145   <title>See Also</title>
146
147   <para>
148     <xref linkend="app-pgdump" endterm="app-pgdump-title">, <xref
149     linkend="app-psql" endterm="app-psql-title">.  Check there for
150     details on possible error conditions.
151   </para>
152  </refsect1>   
153
154 </refentry>
155
156 <!-- Keep this comment at the end of the file
157 Local variables:
158 mode: sgml
159 sgml-omittag:nil
160 sgml-shorttag:t
161 sgml-minimize-attributes:nil
162 sgml-always-quote-attributes:t
163 sgml-indent-step:1
164 sgml-indent-data:t
165 sgml-parent-document:nil
166 sgml-default-dtd-file:"../reference.ced"
167 sgml-exposed-tags:nil
168 sgml-local-catalogs:"/usr/lib/sgml/catalog"
169 sgml-local-ecat-files:nil
170 End:
171 -->