]> granicus.if.org Git - postgresql/blob - doc/src/sgml/ref/pg_dumpall.sgml
Make pg_dump dump ACL's by default, print warning on use of -z, and add
[postgresql] / doc / src / sgml / ref / pg_dumpall.sgml
1 <REFENTRY ID="APP-PG-DUMPALL">
2 <REFMETA>
3 <REFENTRYTITLE>
4 <application>pg_dumpall</application>
5 </REFENTRYTITLE>
6 <REFMISCINFO>Application</REFMISCINFO>
7 </REFMETA>
8 <REFNAMEDIV>
9 <REFNAME>
10 <application>pg_dumpall</application>
11 </REFNAME>
12 <REFPURPOSE>
13 Extract all <productname>Postgres</productname> databases into a script file
14 </REFPURPOSE>
15   </refnamediv>
16 <REFSYNOPSISDIV>
17 <REFSYNOPSISDIVINFO>
18 <DATE>1998-10-04</DATE>
19 </REFSYNOPSISDIVINFO>
20 <SYNOPSIS>
21 pg_dumpall
22 pg_dumpall [ -h <replaceable class="parameter">host</replaceable> ] [ -p <replaceable class="parameter">port</replaceable> ]
23     [ -a ] [ -d ] [ -D ] [ -o ] [ -s ] [ -u ] [ -v ] [ -x ]
24 </SYNOPSIS>
25
26     <REFSECT2 ID="R2-APP-PG-DUMPALL-1">
27       <REFSECT2INFO>
28         <DATE>1998-10-04</DATE>
29       </REFSECT2INFO>
30       <TITLE>
31         Inputs
32       </TITLE>
33       <PARA>
34         <application>pg_dumpall</application> accepts the following command line arguments:
35         
36         <variablelist>
37           <varlistentry>
38             <term>
39               -a
40             </term>
41             <listitem>
42               <para>
43                 Dump out only the data, no schema (definitions).
44               </para>
45             </listitem>
46           </varlistentry>
47           <varlistentry>
48             <term>
49               -d
50             </term>
51             <listitem>
52               <para>
53                 Dump data as proper insert strings.
54               </para>
55             </listitem>
56           </varlistentry>
57           
58           <varlistentry>
59             <term>
60               -D
61             </term>
62             <listitem>
63               <para>
64                 Dump data as inserts with attribute names
65               </para>
66             </listitem>
67           </varlistentry>
68           
69           <varlistentry>
70             <term>
71               -n
72             </term>
73             <listitem>
74               <para>
75                 Suppress double quotes around identifiers unless absolutely necessary.
76                 This may cause trouble loading this dumped data if there are reserved words
77                 used for identifiers.
78               </para>
79             </listitem>
80           </varlistentry>
81           
82           <varlistentry>
83             <term>
84               -o
85             </term>
86             <listitem>
87               <para>
88                 Dump object identifiers (<acronym>OID</acronym>s) for every table.
89               </para>
90             </listitem>
91           </varlistentry>
92           
93           <varlistentry>
94             <term>
95               -s
96             </term>
97             <listitem>
98               <para>
99                 Dump out only the schema (definitions), no data.
100               </para>
101             </listitem>
102           </varlistentry>
103
104           <varlistentry>
105             <term>
106               -u
107             </term>
108             <listitem>
109               <para>
110                 Use password authentication. Prompts for username and password.
111               </para>
112             </listitem>
113           </varlistentry>
114           
115           <varlistentry>
116             <term>
117               -v
118             </term>
119             <listitem>
120               <para>
121                 Specifies verbose mode
122               </para>
123             </listitem>
124           </varlistentry>
125           
126           <varlistentry>
127             <term>
128               -x
129             </term>
130             <listitem>
131               <para>
132                 Prevent dumping ACLs (grant/revoke commands) and table ownership information.
133               </para>
134             </listitem>
135           </varlistentry>
136           
137         </variablelist>
138       </para>
139       <para>
140         <application>pg_dumpall</application> also accepts 
141         the following command line arguments for connection parameters:
142         
143         <variablelist>
144           <varlistentry>
145             <term>
146               -h <replaceable class="parameter">host</replaceable>
147             </term>
148             <listitem>
149               <para>
150                 Specifies the hostname of the machine on which the 
151                 <application>postmaster</application>
152                 is running.  Defaults to using a local Unix domain socket
153                 rather than an IP connection..
154               </para>
155             </listitem>
156           </varlistentry>
157           
158           <varlistentry>
159             <term>
160               -p <replaceable class="parameter">port</replaceable>
161             </term>
162             <listitem>
163               <para>
164                 Specifies the Internet TCP/IP port or local Unix domain socket file 
165                 extension on which the <application>postmaster</application>
166                 is listening for connections.  The port number defaults to 5432,
167                 or the value of the <envar>PGPORT</envar>
168                 environment variable (if set).
169               </para>
170             </listitem>
171           </varlistentry>
172           
173           <varlistentry>
174             <term>
175               -u
176             </term>
177             <listitem>
178               <para>
179                 Use password authentication. 
180                 Prompts for
181                 <replaceable class="parameter">username</replaceable>
182                 and <replaceable class="parameter">password</replaceable>.
183               </para>
184             </listitem>
185           </varlistentry>
186         </variablelist>
187       </para>
188     </refsect2>
189
190     <REFSECT2 ID="R2-APP-PG-DUMPALL-2">
191       <REFSECT2INFO>
192         <DATE>1998-10-04</DATE>
193       </REFSECT2INFO>
194       <TITLE>
195         Outputs
196       </TITLE>
197       <PARA>
198         <application>pg_dumpall</application> will create a file or
199         write to <filename>stdout</filename>.
200         
201         <variablelist>
202           <varlistentry>
203             <term>
204               Connection to database 'template1' failed.
205               connectDB() failed: Is the postmaster running and accepting connections
206               at 'UNIX Socket' on port '<replaceable class="parameter">port</replaceable>'?
207             </term>
208             <listitem>
209               <para>
210                 <application>pg_dumpall</application> could not attach to the 
211                 <application>postmaster</application> 
212                 process on the specified host and port.  If you see this message,
213                 ensure that the <application>postmaster</application> 
214                 is running on the proper host and that you have specified the proper
215                 port.  If your site uses an authentication system, ensure that you
216                 have obtained the required authentication credentials.
217               </para>
218             </listitem>
219           </varlistentry>
220           
221           <varlistentry>
222             <term>
223               Connection to database '<replaceable class="parameter">dbname</replaceable>' failed.
224               FATAL 1:  SetUserId: user '<replaceable class="parameter">username</replaceable>' is not in 'pg_shadow'
225             </term>
226             <listitem>
227               <para>
228                 You do not have a valid entry in the relation <literal>pg_shadow</literal>
229                 and and will not be allowed to access <productname>Postgres</productname>. 
230                 Contact your <productname>Postgres</productname> administrator.
231               </para>
232             </listitem>
233           </varlistentry>
234
235           <varlistentry>
236             <term>
237               dumpSequence(<replaceable class="parameter">table</replaceable>): SELECT failed
238             </term>
239             <listitem>
240               <para>
241                 You do not have permission to read the database.
242                 Contact your <productname>Postgres</productname> site administrator.
243               </para>
244             </listitem>
245           </varlistentry>
246         </variablelist>
247       </para>
248
249       <note>
250         <para>
251           <application>pg_dumpall</application> internally executes
252           <command>SELECT</command> statements. If you have problems running
253           <application>pg_dumpall</application>,
254           make sure you are able to select information from the database using, for
255           example, <application>psql</application>.
256         </para>
257       </note>
258     </refsect2>
259   </refsynopsisdiv>
260   
261   <REFSECT1 ID="R1-APP-PG-DUMPALL-1">
262     <REFSECT1INFO>
263       <DATE>1998-10-04</DATE>
264     </REFSECT1INFO>
265     <TITLE>
266       Description
267     </TITLE>
268     <PARA>
269       <application>pg_dumpall</application>
270       is a utility for dumping out all Postgres databases into one file.
271       It also dumps the pg_shadow table, which is global to all databases.
272       <application>pg_dumpall</application> includes in this file the proper commands
273       to automatically create each dumped database before loading.
274     </para>
275     <para>
276       <application>pg_dumpall</application> takes all <application>pg_dump</application>
277       options, but <option>-f</option>, <option>-t</option> and 
278       <replaceable class="parameter">dbname</replaceable>
279       should be omitted.
280     </para>
281     <para>
282       Refer to 
283       <xref linkend="app-pg-dump" endterm="pg-dump">
284         for more information on this capability.
285     </para
286   </refsect1>
287
288   <REFSECT1 ID="R1-APP-PG-DUMPALL-2">
289     <REFSECT1INFO>
290       <DATE>1998-10-04</DATE>
291     </REFSECT1INFO>
292     <TITLE>
293       Usage
294     </TITLE>
295     <PARA>
296       To dump all databases:
297
298       <programlisting>
299         % pg_dumpall -o > db.out
300       </programlisting>
301
302       <tip>
303         <para>
304           You can use most <application>pg_dump</application> options
305           for <application>pg_dumpall</application>.
306         </para>
307       </tip>
308     </para>
309     <para>
310       To reload this database:
311       
312       <programlisting>
313         psql -e template1 < db.out
314       </programlisting>
315     </para>
316     <tip>
317       <para>
318         You can use most <application>psql</application> options
319         when reloading.
320       </para>
321     </tip>
322   </refsect1>
323 </REFENTRY>