.\\" auto-generated by docbook2man-spec $Revision: 1.25 $ .TH "PG_DUMPALL" "1" "2002-11-22" "Application" "PostgreSQL Client Applications" .SH NAME pg_dumpall \- extract a PostgreSQL database cluster into a script file .SH SYNOPSIS .sp \fBpg_dumpall\fR\fR [ \fR\fB\fIoptions\fB\fR...\fB \fR\fR]\fR .SH "DESCRIPTION" .PP \fBpg_dumpall\fR is a utility for writing out (``dumping'') all PostgreSQL databases of a cluster into one script file. The script file contains SQL commands that can be used as input to \fBpsql\fR(1) to restore the databases. It does this by calling \fBpg_dump\fR(1) for each database in a cluster. \fBpg_dumpall\fR also dumps global objects that are common to all databases. (\fBpg_dump\fR does not save these objects.) This currently includes the information about database users and groups. .PP Thus, \fBpg_dumpall\fR is an integrated solution for backing up your databases. But note a limitation: it cannot dump ``large objects'', since \fBpg_dump\fR cannot dump such objects into text files. If you have databases containing large objects, they should be dumped using one of \fBpg_dump\fR's non-text output modes. .PP Since \fBpg_dumpall\fR 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 users and groups, and to create databases. .PP The SQL script will be written to the standard output. Shell operators should be used to redirect it into a file. .PP \fBpg_dumpall\fR might need to connect several times to the PostgreSQL server, asking for a password each time. It is convenient to have a \fI$HOME/.pgpass\fR file in such cases. .SH "OPTIONS" .PP The following command-line options are used to control the output format. .TP \fB-c\fR .TP \fB--clean\fR Include SQL commands to clean (drop) the databases before recreating them. .TP \fB-d\fR .TP \fB--inserts\fR Dump data as \fBINSERT\fR commands (rather than \fBCOPY\fR). This will make restoration very slow, but it makes the output more portable to other RDBMS packages. .TP \fB-D\fR .TP \fB--column-inserts\fR .TP \fB--attribute-inserts\fR Dump data as \fBINSERT\fR commands with explicit column names (INSERT INTO \fItable\fR (\fIcolumn\fR, ...) VALUES \&...). This will make restoration very slow, but it is necessary if you desire to rearrange column ordering. .TP \fB-g\fR .TP \fB--globals-only\fR Dump only global objects (users and groups), no databases. .TP \fB-i\fR .TP \fB--ignore-version\fR Ignore version mismatch between \fBpg_dumpall\fR and the database server. \fBpg_dumpall\fR can handle databases from previous releases of PostgreSQL, but very old versions are not supported anymore (currently prior to 7.0). Use this option if you need to override the version check (and if \fBpg_dumpall\fR then fails, don't say you weren't warned). .TP \fB-o\fR .TP \fB--oids\fR Dump object identifiers (OIDs) for every table. Use this option if your application references the OID columns in some way (e.g., in a foreign key constraint). Otherwise, this option should not be used. .TP \fB-v\fR .TP \fB--verbose\fR Specifies verbose mode. This will cause \fBpg_dumpall\fR to print progress messages to standard error. .PP .PP The following command-line options control the database connection parameters. .TP \fB-h \fIhost\fB\fR Specifies the host name of the machine on which the database server is running. If host begins with a slash, it is used as the directory for the Unix domain socket. The default is taken from the \fBPGHOST\fR environment variable, if set, else a Unix domain socket connection is attempted. .TP \fB-p \fIport\fB\fR The port number on which the server is listening. Defaults to the \fBPGPORT\fR environment variable, if set, or a compiled-in default. .TP \fB-U \fIusername\fB\fR Connect as the given user. .TP \fB-W\fR Force a password prompt. This should happen automatically if the server requires password authentication. .PP .PP Long options are only available on some platforms. .SH "ENVIRONMENT" .TP \fBPGHOST\fR .TP \fBPGPORT\fR .TP \fBPGUSER\fR Default connection parameters. .SH "NOTES" .PP Since \fBpg_dumpall\fR calls \fBpg_dump\fR internally, some diagnostic messages will refer to \fBpg_dump\fR. .PP \fBpg_dumpall\fR will need to connect several times to the PostgreSQL server. If password authentication is configured, it will ask for a password each time. In that case it would be convenient to set up a password file. [Comment: But where is that password file documented?] .SH "EXAMPLES" .PP To dump all databases: .sp .nf $ \fBpg_dumpall > db.out\fR .sp .fi .PP To reload this database use, for example: .sp .nf $ \fBpsql -f db.out template1\fR .sp .fi (It is not important to which database you connect here since the script file created by \fBpg_dumpall\fR will contain the appropriate commands to create and connect to the saved databases.) .SH "SEE ALSO" .PP \fBpg_dump\fR(1), \fBpsql\fR(1). Check there for details on possible error conditions.