version 4, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
PG_DUMPALL |
|
|
2 |
!!!PG_DUMPALL |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
EXAMPLES |
|
|
7 |
SEE ALSO |
|
|
8 |
---- |
|
|
9 |
!!NAME |
|
|
10 |
|
|
|
11 |
|
|
|
12 |
pg_dumpall - extract all PostgreSQL databases into a script file |
|
|
13 |
!!SYNOPSIS |
|
|
14 |
|
|
|
15 |
|
|
|
16 |
__pg_dumpall__ [[ __-c__ | __--clean__ ] [[ __-g__ |
|
|
17 |
| __--globals-only__ ] [[ __-h__ ''host'' ] [[ |
|
|
18 |
__-p__ ''port'' ] [[ __-U__ ''username'' ] [[ |
|
|
19 |
__-W__ ] |
|
|
20 |
!!DESCRIPTION |
|
|
21 |
|
|
|
22 |
|
|
|
23 |
__pg_dumpall__ is a utility for writing out (``dumping'') |
|
|
24 |
all PostgreSQL databases of a cluster into one script file. |
|
|
25 |
The script file contains SQL commands that can be used as |
|
|
26 |
input to psql(1) to restore the databases. It does |
4 |
perry |
27 |
this by calling pg_dump(1) for each database in a |
1 |
perry |
28 |
cluster. __pg_dumpall__ also dumps global objects that |
|
|
29 |
are common to all databases. (__pg_dump__ does not save |
|
|
30 |
these objects.) This currently includes the information |
|
|
31 |
about database users and groups. |
|
|
32 |
|
|
|
33 |
|
|
|
34 |
Thus, __pg_dumpall__ is an integrated solution for |
|
|
35 |
backing up your databases. But note a limitation: it cannot |
|
|
36 |
dump ``large objects'', since __pg_dump__ cannot dump |
|
|
37 |
such objects into text files. If you have databases |
|
|
38 |
containing large objects, they should be dumped using one of |
|
|
39 |
__pg_dump__'s non-text output modes. |
|
|
40 |
|
|
|
41 |
|
|
|
42 |
Since __pg_dumpall__ reads tables from all databases you |
|
|
43 |
will most likely have to connect as a database superuser in |
|
|
44 |
order to produce a complete dump. Also you will need |
|
|
45 |
superuser privileges to execute the saved script in order to |
|
|
46 |
be allowed to add users and groups, and to create |
|
|
47 |
databases. |
|
|
48 |
|
|
|
49 |
|
|
|
50 |
The SQL script will be written to the standard output. Shell |
|
|
51 |
operators should be used to redirect it into a |
|
|
52 |
file. |
|
|
53 |
|
|
|
54 |
|
|
|
55 |
__OPTIONS__ |
|
|
56 |
|
|
|
57 |
|
|
|
58 |
__pg_dumpall__ accepts the following command line |
|
|
59 |
arguments: |
|
|
60 |
|
|
|
61 |
|
|
|
62 |
__-c, --clean__ |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
Include SQL commands to clean (drop) database objects before |
|
|
66 |
recreating them. (This option is fairly useless, since the |
|
|
67 |
output script expects to create the databases themselves; |
|
|
68 |
they would always be empty upon creation.) |
|
|
69 |
|
|
|
70 |
|
|
|
71 |
__-g, --globals-only__ |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
Only dump global objects (users and groups), no |
|
|
75 |
databases. |
|
|
76 |
|
|
|
77 |
|
|
|
78 |
__-h__ ''host'' |
|
|
79 |
|
|
|
80 |
|
|
|
81 |
Specifies the host name of the machine on which the database |
|
|
82 |
server is running. If host begins with a slash, it is used |
|
|
83 |
as the directory for the Unix domain socket. The default is |
|
|
84 |
taken from the __PGHOST__ environment variable, if set, |
|
|
85 |
else a Unix domain socket connection is |
|
|
86 |
attempted. |
|
|
87 |
|
|
|
88 |
|
|
|
89 |
__-p__ ''port'' |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
The port number on which the server is listening. Defaults |
|
|
93 |
to the __PGPORT__ environment variable, if set, or a |
|
|
94 |
compiled-in default. |
|
|
95 |
|
|
|
96 |
|
|
|
97 |
__-U__ ''username'' |
|
|
98 |
|
|
|
99 |
|
|
|
100 |
Connect as the given user. |
|
|
101 |
|
|
|
102 |
|
|
|
103 |
__-W__ |
|
|
104 |
|
|
|
105 |
|
|
|
106 |
Force a password prompt. This should happen automatically if |
|
|
107 |
the server requires password authentication. |
|
|
108 |
|
|
|
109 |
|
|
|
110 |
Any other command line parameters are passed to the |
4 |
perry |
111 |
underlying pg_dump(1) calls. This is useful to |
1 |
perry |
112 |
control some aspects of the output format, but some options |
|
|
113 |
such as __-f__, __-t__, and ''dbname'' should be |
|
|
114 |
avoided. |
|
|
115 |
!!EXAMPLES |
|
|
116 |
|
|
|
117 |
|
|
|
118 |
To dump all databases: |
|
|
119 |
|
|
|
120 |
|
|
|
121 |
$ __pg_dumpall |
|
|
122 |
__To reload this database use, for example: |
|
|
123 |
|
|
|
124 |
|
|
|
125 |
$ __psql -f db.out template1 |
|
|
126 |
__(It is not important to which database you connect here since the script file created by __pg_dumpall__ will contain the appropriate commands to create and connect to the saved databases.) |
|
|
127 |
!!SEE ALSO |
|
|
128 |
|
|
|
129 |
|
4 |
perry |
130 |
pg_dump(1), psql(1). Check there for details |
1 |
perry |
131 |
on possible error conditions. |
|
|
132 |
---- |