- 2000-12-25
+ 2001-03-06
- id="app-pgdump-title">
+
+ pg_dump
1
Application
+
-
-
+ pg_dump
+
Extract a
Postgres database into a script file or other archive file
+
-
- 2000-11-22
-
-
-pg_dump [ dbname ]
-pg_dump [ -h host ]
- [ -p port ]
- [ -t table ]
- [ -a ] [ -b ] [ -c ] [-C] [ -d ] [ -D ]
- [-f file]
- [-F format]
- [ -i ] [ -n ] [ -N ] [ -o ] [ -O ] [-R]
- [ -s ] [ -S ] [ -u ] [ -v ] [ -x ] [ -Z 0..9 ]
- [ dbname ]
-
-
-
-
- 2000-11-22
-
-
- Inputs
-
+
+ pg_dump
+
+
+
+
+
+
+
+
+
+ Description
+
+
+ pg_dump is a utility for dumping out a
+
Postgres database into a script or archive
+ file containing query commands. The script files are in text format
+ and can be used to reconstruct the database, even on other machines
+ and other architectures.
+ The archive files, new with version 7.1, contain enough information for
+ to rebuild the database, but also
+ allow pg_restore to be selective about what is restored, or even to
+ reorder the items prior to being restored. The archive files are
+ also designed to be portable across architectures.
+
+
+ pg_dump
+ will produce the queries necessary to re-generate all
+ user-defined types, functions, tables, indices, aggregates, and
+ operators. In addition, all the data is copied out in text format so
+ that it can be readily copied in again, as well as imported into tools
+ for editing.
+
+
+ pg_dump
+ is useful for dumping out the contents of a database to move from one
+
Postgres installation to another. After running
+ pg_dump,
+ one should examine the output for any warnings, especially
+ in light of the limitations listed below.
+
+
+ When used with one of the alternate file formats and combined with
+ pg_restore, it provides a flexible archival
+ and transfer mechanism. pg_dump can be used
+ to backup an entire database, then pg_restore
+ can be used to examine the archive and/or select which parts of the
+ database are to be restored.
+ See the documentation for details.
+
+
+
+
Options
+
- <application>pg_dump> accepts the following command
- line arguments:
+ <command>pg_dump> accepts the following command
+ line arguments. (Long option forms are only available on some platforms.)
Specifies the name of the database to be extracted.
- dbname
- defaults to the value of the
- USER
- environment variable.
-a
+ --data-only
- Dump out only the data, no schema (definitions).
+ Dump only the data, not the schema (definitions).
-b
+ --blobs
- Dump data and BLOB data.
+ Dump data and
BLOB data.
-c
+ --clean
- Clean (drop) schema prior to create.
+ Dump commands to clean (drop) the schema prior to (the
+ commands for) creating it.
-C
+ --create
- For plain text (script) output, include SQL to create the database itself.
+ For plain text (script) output, include commands to create the database itself.
-d
+ --inserts
- Dump data as proper insert strings. This is not recommended for large databases
- for performance reasons.
+ Dump data as proper INSERT commands (not
+ COPY). This will make restoration very
+ slow.
-D
+ --attribute-inserts
- Dump data as inserts with attribute names. This is not recommended for large databases
- for performance reasons.
+ Dump data as INSERT commands with explicit
+ column names. This will make restoration very slow.
-f file
+ --file=file
Send output to the specified file.
-F format
+ --format=format
Format can be one of the following:
-
-
p
- output a plain text SQL script file (default)
+
output a plain text SQL script file (default)
t
- output a TAR archive suitable for input into
- <APPLICATION>pg_restore>. Using this archive format
+ output a tar archive suitable for input into
+ <command>pg_restore>. Using this archive format
allows reordering and/or exclusion of schema elements
at the time the database is restored. It is also possible to limit
which data is reloaded at restore time.
output a custom archive suitable for input into
- <APPLICATION>pg_restore>. This is the most flexible
+ <command>pg_restore>. This is the most flexible
format in that it allows reordering of data load as well
as schema elements. This format is also compressed by default.
+
-i
+ --ignore-version
- Ignore version mismatch between <application>pg_dump>
- and the database server. Since <application>pg_dump>
+ Ignore version mismatch between <command>pg_dump>
+ and the database server. Since <command>pg_dump>
knows a great deal about system catalogs, any given version of
- <application>pg_dump> is only intended to work with
+ <command>pg_dump> is only intended to work with
the corresponding release of the database server. Use this option
if you need to override the version check (and if
- <application>pg_dump> then fails, don't
+ <command>pg_dump> then fails, don't
say you weren't warned).
-n
+ --no-quotes
Suppress double quotes around identifiers unless absolutely necessary.
This may cause trouble loading this dumped data if there are reserved words
used for identifiers.
This was the default behavior for
- <application>pg_dump prior to v6.4.
+ <command>pg_dump prior to version 6.4.
-N
+ --quotes
Include double quotes around identifiers.
-o
+ --oids
Dump object identifiers (
OIDs) for every table.
-O
+ --no-owner
- In plain text output mode, don't set object ownership to match the
- original database. Typically,
pg_dump
- issues
\connect statments to set
- ownership of schema elements.
+ In plain text output mode, do not set object ownership to
+ match the original database. Typically,
+ pg_dump issues
+ (psql-specific) \connect
+ statements to set ownership of schema elements.
-R
+ --no-reconnect
- In plain text output mode, prohibit <APPLICATION>pg_dump>
-
from issuing any \connect> statements.
+ In plain text output mode, prohibit <command>pg_dump>
+ from issuing any \connect> statements.
-s
+ --schema-only
- Dump out only the schema (definitions), no data.
+ Dump only the schema (definitions), no data.
-S username
+ --superuser=username
- Specify the superuser username to use when disabling triggers and/or
+ Specify the superuser user name to use when disabling triggers and/or
setting ownership of schema elements.
-t table
+ --table=table
Dump data for table only.
-
- -u
-
- Use password authentication. Prompts for username and password.
-
-
-
-
-v
+ --verbose
Specifies verbose mode.
-x
+ --no-acl
Prevent dumping of ACLs (grant/revoke commands) and table ownership information.
-Z 0..9
+ --compress=0..9
Specify the compression level to use in archive formats that support
- <application>pg_dump> also accepts
+ <command>pg_dump> also accepts
the following command line arguments for connection parameters:
-h host
+ --host=host
- Specifies the hostname of the machine on which the
- <application>postmaster>
+ Specifies the host name of the machine on which the
+ <command>postmaster>
is running. If host begins with a slash, it is used
- as the directory for the unix domain socket.
+ as the directory for the Unix domain socket.
-p port
+ --port=port
Specifies the Internet TCP/IP port or local Unix domain socket file
- extension on which the <application>postmaster>
+ extension on which the <command>postmaster>
is listening for connections. The port number defaults to 5432,
or the value of the PGPORT
environment variable (if set).
-
-
- 1998-11-05
-
-
- Outputs
-
-
pg_dump will create a file or
- write to stdout.
+
-
-
-
+
+
+
Diagnostics
+
+
+
+
+
+
+
Connection to database 'template1' failed.
connectDBStart() -- connect() failed: No such file or directory
Is the postmaster running locally
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
-
-
+
+
+
+
+
+
- <application>pg_dump> could not attach to the
- <application>postmaster>
+ <command>pg_dump> could not attach to the
+ <command>postmaster>
process on the specified host and port. If you see this message,
- ensure that the <application>postmaster>
+ ensure that the <command>postmaster>
is running on the proper host and that you have specified the proper
- port. If your site uses an authentication system, ensure that you
- have obtained the required authentication credentials.
-
-
-
-
-
-
-Connection to database 'dbname' failed.
-FATAL 1: SetUserId: user 'username' is not in 'pg_shadow'
-
-
- You do not have a valid entry in the relation pg_shadow
- and and will not be allowed to access
Postgres.
- Contact your
Postgres administrator.
+ port.
-
-
-
-
-
+
+
+
+
+
+
+
+
dumpSequence(table): SELECT failed
-
-
+
+
+
+
+
+
You do not have permission to read the database.
Contact your
Postgres site administrator.
-
-
-
-
+
+
+
- <application>pg_dump> internally executes
+ <command>pg_dump> internally executes
SELECT statements. If you have problems running
- <application>pg_dump>,
+ <command>pg_dump>,
make sure you are able to select information from the database using, for
- example, <application>psql>.
+ example, <xref linkend="app-psql">.
-
-
-
-
-
- 2000-
-
-
- Description
-
-
pg_dump is a utility for dumping out a
-
Postgres database into a script or archive
- file containing query commands. The script files are in text format
- and can be used to reconstruct the database, even on other machines
- and other architectures.
-
- The archive files, new with version 7.1, contain enough information for
-
pg_restore to rebuild the database, but also
- allow pg_restore to be selective about what is restored, or even to
- reorder the items prior to being restored. The archive files should
- also be portable across architectures.
-
- will produce the queries necessary to re-generate all
- user-defined types, functions, tables, indices, aggregates, and
- operators. In addition, all the data is copied out in text format so
- that it can be readily copied in again, as well as imported into tools
- for editing.
-
-
- is useful for dumping out the contents of a database to move from one
-
Postgres installation to another. After running
- one should examine the output for any warnings, especially
- in light of the limitations listed below.
-
-
- When used with one of the alternate file formats and combined with
-
pg_restore, it provides a flexible archival
- and trasfer mechanism.
pg_dump can be used
- to backup an entire database, then
pg_restore
- can be used to examine the archive and/or select which parts of the
- database are to be restored.
-
-
- See the
pg_restore documentation for details.
-
-
-
-
- 2000-11-21
-
-
- Notes
-
+
+
+
Notes
- <application>pg_dump> has a few limitations.
+ <command>pg_dump> has a few limitations.
The limitations mostly stem from
difficulty in extracting certain meta-information from the system
catalogs.
- does not understand partial indices. The reason is
- the same as above; partial index predicates are stored as plans.
-
-
-
-
- When dumping a single table or as plain text,
pg_dump
+ When dumping a single table or as plain text, pg_dump
does not handle large objects. Large objects must be dumped in their
- entirity using one of the binary archive formats.
+ entirety using one of the binary archive formats.
- When doing a data only dump, <application>pg_dump> emits queries
+ When doing a data only dump, <command>pg_dump> emits queries
to disable triggers on user tables before inserting the data and queries to
re-enable them after the data has been inserted. If the restore is stopped
in the middle, the system catalogs may be left in the wrong state.
-
-
- 2000-11-21
-
-
- Usage
-
- To dump a database of the same name as the user:
+
+
Examples
-$ pg_dump > db.out
-
+ To dump a database:
+
+
To reload this database:
-
-$ psql -e database < db.out
-
+
+
$ psql -d database -f db.out
+
- To dump a database called mydb that contains BLOBs to a TAR file:
+ To dump a database called mydb that contains
-$ pg_dump -Ft --blobs mydb > db.tar
- >
+>
+
$ pg_dump -Ft -b mydb > db.tar
+>
- To reload this database (with BLOBs) to an existing db called newdb:
+ To reload this database (with
BLOBs) to an
+ existing database called newdb:
-$ pg_restore db.tar --dbname=newdb
- >
+>
+
$ pg_restore -d newdb db.tar
+>
+
+
+
See Also
+
+
+
+
+
+ PostgreSQL Administrator's Guide
+
+
+
+
+
+ 2001-03-06
+
+
- id="app-pgrestore-title">
+
+ pg_restore
1
Application
+
-
-
+ pg_restore
+
Restore a
Postgres database from an archive file created by
-<APPLICATION>pg_dump>
+<command>pg_dump>
+
-
- 2000-10-11
-
-
-pg_restore [ archive-file ]
- [ -h host ]
- [ -p port ]
- [ -t table ]
- [ -a ] [ -c ] [-C] [-d name]
- [ -f archive-file]
- [ -F format]
- [ -i index ]
- [ -l ] [ -L contents-file ]
- [ -N ] [ -o ] [ -O ]
- [ -P function-name ] [ -r ] [ -R ]
- [ -s ] [ -S ] { -T trigger ] [ -u ]
- [ -v ] [ -x ]
-
-
-
-
- 2000-10-11
-
+
+ pg_restore
+
+
+
+
+
+
+
+
+
+ Description
+
+
+ pg_restore is a utility for restoring a
+
Postgres database dumped by
+ in one of the non-plain-text formats.
+
+
+ The archive files, new with the 7.1 release, contain enough information for
+ pg_restore to rebuild the database, but also allow
+ pg_restore to be selective about what is restored,
+ or even to reorder the items prior to being restored. The archive files are designed
+ to be portable across architectures. pg_dump will
+ produce the queries necessary to re-generate all user-defined types, functions,
+ tables, indices, aggregates, and operators. In addition, all the data is copied
+ out (in text format for scripts) so that it can be readily copied in again.
+
+
+ pg_restore reads the archive file and outputs the appropriate
+ SQL in the required order based on the command parameters. Obviously, it can not restore
+ information that is not present in the dump file; so if the dump is made using the
+ dump data as INSERTs
option, pg_restore will not be able to
+ load the data using COPY statements.
+
+
+ The most flexible output file format is the custom
format (). It allows for
+ selection and reordering of all archived items, and is compressed by default. The tar
+ format () is not compressed and it is not possible to reorder
+ data when loading, but it is otherwise quite flexible.
+
+
+ To reorder the items, it is first necessary to dump the contents of the archive:
+
+
$ pg_restore archive.file -l > archive.list
+
+ This file consists of a header and one line for each item, e.g.,
+;
+; Archive created at Fri Jul 28 22:28:36 2000
+; dbname: birds
+; TOC Entries: 74
+; Compression: 0
+; Dump Version: 1.4-0
+; Format: CUSTOM
+;
+;
+; Selected TOC Entries:
+;
+2; 145344 TABLE species postgres
+3; 145344 ACL species
+4; 145359 TABLE nt_header postgres
+5; 145359 ACL nt_header
+6; 145402 TABLE species_records postgres
+7; 145402 ACL species_records
+8; 145416 TABLE ss_old postgres
+9; 145416 ACL ss_old
+10; 145433 TABLE map_resolutions postgres
+11; 145433 ACL map_resolutions
+12; 145443 TABLE hs_old postgres
+13; 145443 ACL hs_old
+
+ Semi-colons are comment delimiters, and the numbers at the start of lines refer to the
+ internal archive ID assigned to each item.
+
+
+ Lines in the file can be commented out, deleted, and reordered. For example,
+10; 145433 TABLE map_resolutions postgres
+;2; 145344 TABLE species postgres
+;4; 145359 TABLE nt_header postgres
+6; 145402 TABLE species_records postgres
+;8; 145416 TABLE ss_old postgres
+
+ could be used as input to pg_restore and would only restore
+ items 10 and 6, in that order.
+
+
$ pg_restore archive.file -L archive.list
+
+
+
+
- Inputs
+ Options
+
- <application>pg_restore> accepts the following command
- line arguments:
+ <command>pg_restore> accepts the following command
+ line arguments. (Long option forms are only available on some platforms.)
Specifies the location of the archive file to be restored.
- If not specified, and no '-f' option is specified, then STDIN is used.
+ If not specified, and no option is specified, then the standard input is used.
-a
+ --data-only
Restore only the data, no schema (definitions).
-c
+ --clean
Clean (drop) schema prior to create.
-C
+ --create
Include SQL to create the schema.
-d dbname
+ --dbname=dbname
Connect to database dbname and restore
- -f
+ -f filename
+ --file=filename
- Specify output file for generated script. Default is STDOUT.
+ Specify output file for generated script. (Use with the
+ option.) Default is the standard output.
-F format
+ --format=format
Specify format of the archive.
- It is not necessary to specify the format, since <APPLICATION>pg_restore> will
+ It is not necessary to specify the format, since <COMMAND>pg_restore> will
determine the format automatically. If specified, it can be one of the following:
t
- archive is a TAR archive. Using this archive format allows reordering and/or
+ Archive is a tar archive. Using this archive format allows reordering and/or
exclusion of schema elements at the time the database is restored. It is also possible to limit which
data is reloaded at restore time.
c
- archive is in the custom format from pg_dump. This is the most flexible format
+ Archive is in the custom format of pg_dump. This is the most flexible format
in that it allows reordering of data load as well as schema elements.
This format is also compressed by default.
-i index
+ --index=index
Restore definition for named index only.
-l
+ --list
- List the contents of the archive. The output of this command can be used with the '-U, --use-list' option
+ List the contents of the archive. The output of this command can be used with the option
to restrict and reorder the items that are restored.
-L list-file
+ --use-list=list-file
- Restore elements in list-file only, and in the
- order they appear in the file. Lines can be moved and may also be commented out by placing
- a ';' at the start of the line.
+ Restore elements in list-file only, and in the
+ order they appear in the file. Lines can be moved and may also be commented out by placing a ';' at the
+ start of the line.
-N
+ --orig-order
- Restore items in the original dump order. By default pg_dump will dump items in an order convenient
- to pg_dump, then save the archive in a modified OID order. This option overrides the OID ordering.
+ Restore items in the original dump order. By default pg_dump will dump items in an order convenient
+ to pg_dump, then save the archive in a modified OID order. This option overrides the OID ordering.
-o
+ --oid-order
- Restore items in the OID order. By default pg_dump will dump items in an order convenient
- to pg_dump, then save the archive in a modified OID order. This option enforces strict OID ordering.
+ Restore items in the OID order. By default pg_dump will dump items in an order convenient
+ to pg_dump, then save the archive in a modified OID order. This option enforces strict OID ordering.
-O
+ --no-owner
- Prevent any attempt to restore original object ownership. Objects will be owned by the username used
+ Prevent any attempt to restore original object ownership. Objects will be owned by the user name used
to attach to the database.
- -P procedure-name
+ -P function-name
+ --function=function-name
Specify a procedure or function to be restored.
-r
+ --rearrange
- Restore items in modified OID order. By default pg_dump will dump items in an order convenient
- to pg_dump, then save the archive in a modified OID order. Most objects
- will be restored in OID order, but some things (eg. RULES & INDEXES) will be restored at the end of
+ Restore items in modified OID order. By default pg_dump will dump items in an order convenient
+ to pg_dump, then save the archive in a modified OID order. Most objects
+ will be restored in OID order, but some things (e.g., rules and indices) will be restored at the end of
the process irrespective of their OIDs. This option is the default.
-R
+ --no-reconnect
- Prohibit <
APPLICATION>pg_restore> from issuing any \connect
+ Prohibit <
COMMAND>pg_restore> from issuing any \connect
statements or reconnecting to the database if directly connected.
-s
+ --schema-only
Restore the schema (definitions), no data. Sequence values will be reset.
-S username
+ --superuser=username
- Specify the superuser username to use when disabling triggers and/or setting ownership of schema elements.
- By default, <APPLICATION>pg_restore will use the current username if it is a superuser.
+ Specify the superuser user name to use when disabling triggers and/or setting ownership of schema elements.
+ By default, <COMMAND>pg_restore will use the current user name if it is a superuser.
-t table
+ --table=table
Restore schema/data for table only.
-T trigger
+ --trigger=trigger
Restore definition of trigger only.
-
- -u
-
- Use password authentication. Prompts for username and password.
-
-
-
-
-v
+ --verbose
Specifies verbose mode.
-x
+ --no-acl
Prevent restoration of ACLs (grant/revoke commands).
+
- <application>pg_restore> also accepts
+ <command>pg_restore> also accepts
the following command line arguments for connection parameters:
-h host
+ --host=host
- Specifies the hostname of the machine on which the
- <application>postmaster>
+ Specifies the host name of the machine on which the
+ <command>postmaster>
is running. If host begins with a slash, it is used
- as the directory for the unix domain socket.
+ as the directory for the Unix domain socket.
-p port
+ --port=port
Specifies the Internet TCP/IP port or local Unix domain socket file
- extension on which the <application>postmaster>
+ extension on which the <command>postmaster>
is listening for connections. The port number defaults to 5432,
or the value of the PGPORT
environment variable (if set).
+
+ -u
+
+ Use password authentication. Prompts for user name and password.
+
+
+
-
-
- 2000-10-11
-
-
- Outputs
-
-
pg_restore will create a script file,
- write to stdout, or restore a database directly.
+
-
-
-
+
+
+
Diagnostics
+
+
+
+
+
+
+
Connection to database 'template1' failed.
connectDBStart() -- connect() failed: No such file or directory
Is the postmaster running locally
and accepting connections on Unix socket '/tmp/.s.PGSQL.5432'?
-
-
+
+
+
+
+
+
- <application>pg_restore> could not attach to the
- <application>postmaster>
+ <command>pg_restore> could not attach to the
+ <command>postmaster>
process on the specified host and port. If you see this message,
- ensure that the <application>postmaster>
+ ensure that the <command>postmaster>
is running on the proper host and that you have specified the proper
port. If your site uses an authentication system, ensure that you
have obtained the required authentication credentials.
-
-
-
-
-
-Connection to database 'dbname' failed.
-FATAL 1: SetUserId: user 'username' is not in 'pg_shadow'
-
-
- You do not have a valid entry in the relation pg_shadow
- and and will not be allowed to access
Postgres.
- Contact your
Postgres administrator.
-
-
-
-
-
-
+
+
+
- When a direct database connection is specified using the -d option, <application>pg_restore>
+ When a direct database connection is specified using the -d option, <command>pg_restore>
internally executes SQL statements. If you have problems running
- <application>pg_restore>,
+ <command>pg_restore>,
make sure you are able to select information from the database using, for
- example, <application>psql>.
+ example, <command>psql>.
-
-
-
-
-
- 2000-10-11
-
-
- Description
-
-
pg_restore is a utility for restoring a
-
Postgres database dumped by
pg_dump
- from any one of the non-plain-text output formats.
-
-
- The archive files, new with this relase, contain enough information for
-
pg_restore to rebuild the database, but also allow
-
pg_restore to be selective about what is restored,
- or even to reorder the items prior to being restored. The archive files should
- also be portable across architectures.
pg_dump will
- produce the queries necessary to re-generate all user-defined types, functions,
- tables, indices, aggregates, and operators. In addition, all the data is copied
- out (in text format for scripts) so that it can be readily copied in again.
-
-
-
pg_restore reads the archive file and outputs the appropriate
- SQL in the required order based on the command parameters. Obviously, it can not restore
- information that is not present in the dump file; so if the dump is made using the
- 'dump data as inserts' option,
pg_restore will not be able to
- load the data using COPY statements.
-
-
- The most flexible output file format is the new 'custom' format (-Fc). It allows for
- selection and reordering of all archived items, and is compressed by default. The TAR
- format (-Ft) is not compressed and it is not possible to reorder
- data when loading, but it is otherwise quite flexible.
-
-
- To reorder the items, it is first necessary to dump the contents of the archive:
- $ pg_restore archive.file --list > archive.lis
-
- This file consists of a header and one line for each item, eg.
-;
-; Archive created at Fri Jul 28 22:28:36 2000
-; dbname: birds
-; TOC Entries: 74
-; Compression: 0
-; Dump Version: 1.4-0
-; Format: CUSTOM
-;
-;
-; Selected TOC Entries:
-;
-2; 145344 TABLE species postgres
-3; 145344 ACL species
-4; 145359 TABLE nt_header postgres
-5; 145359 ACL nt_header
-6; 145402 TABLE species_records postgres
-7; 145402 ACL species_records
-8; 145416 TABLE ss_old postgres
-9; 145416 ACL ss_old
-10; 145433 TABLE map_resolutions postgres
-11; 145433 ACL map_resolutions
-12; 145443 TABLE hs_old postgres
-13; 145443 ACL hs_old
-
-
- Where semi-colons are comment delimiters, and the numbers at the start of lines refer to the
- internal archive ID assigned to each item. Lines in the file can be commented out, deleted,
- and/or reordered. For example,
-10; 145433 TABLE map_resolutions postgres
-;2; 145344 TABLE species postgres
-;4; 145359 TABLE nt_header postgres
-6; 145402 TABLE species_records postgres
-;8; 145416 TABLE ss_old postgres
-
-
- Could be used as input to
pg_restore and would only restore
- items 10 and 6, in that order.
- $ pg_restore acrhive.file --use=archive.lis
-
-
-
-
-
- 2000-10-11
-
+
+
Notes
+
- See the
pg_dump section for details on limitation of
-
- The limitations of pg_restore are detailed below.
+ The limitations of pg_restore are detailed below.
- When restoring data to a table, <application>pg_restore> emits queries
+ When restoring data to a table, <command>pg_restore> emits queries
to disable triggers on user tables before inserting the data then emits queries to
re-enable them after the data has been inserted. If the restore is stopped in the
middle, the system catalogs may be left in the wrong state.
- <application>pg_restore> will not restore BLOBs for a single table. If
+ <command>pg_restore> will not restore BLOBs for a single table. If
an archive contains BLOBs, then all BLOBs will be restored.
+
+ See the documentation for details on
+ limitation of pg_dump.
+
-
-
- 2000-10-11
-
+
+
- Usage
+ Examples
- To create a custom archive for a database of the same name as the user:
-$ pg_dump -Fc > db.out
-
+ To dump a database:
+
+
To reload this database:
-
-$ pg_restore db.out | psql -e database
-
+
+
$ psql -d database -f db.out
+
- To dump a database called mydb that contains BLOBs to a TAR file:
+ To dump a database called mydb that contains
-$ pg_dump -Ft mydb --blobs > db.tar
- >
+>
+
$ pg_dump -Ft -b mydb > db.tar
+>
- To reload this database (with BLOBs) to an existing db called newdb:
+ To reload this database (with
BLOBs) to an
+ existing database called newdb:
-$ pg_restore db.tar --db=newdb
- >
+>
+
$ pg_restore -d newdb db.tar
+>
+
+
+
+
+
See Also
+
+
+
+
+ PostgreSQL Administrator's Guide
+