From: Peter Eisentraut Date: Tue, 6 Mar 2001 18:55:57 +0000 (+0000) Subject: Some editing, enhance markup, move description section before options list. X-Git-Tag: REL7_1~246 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0dcd17702a8e8d0514f20151a792105a0e025a8f;p=postgresql Some editing, enhance markup, move description section before options list. --- diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 111f607f53..1fa64e3836 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,55 +1,112 @@ - 2000-12-25 + 2001-03-06 - - pg_dump + + pg_dump 1 Application + - - pg_dump - + 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 + -a -s + -b + -c + -C + -d -D + -f file + -F format + -i + + -n -N + -o + -O + -R + -S + -t table + -v + -x + -Z 0...9 + + -h host + -p port + -u + + dbname + + + + + + + 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 + - pg_dump accepts the following command - line arguments: + pg_dump accepts the following command + line arguments. (Long option forms are only available on some platforms.) @@ -57,72 +114,77 @@ pg_dump [ -h host ] 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. @@ -132,18 +194,17 @@ pg_dump [ -h host ] -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) @@ -152,8 +213,8 @@ pg_dump [ -h host ] t - output a TAR archive suitable for input into - pg_restore. Using this archive format + output a tar archive suitable for input into + 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. @@ -166,7 +227,7 @@ pg_dump [ -h host ] output a custom archive suitable for input into - pg_restore. This is the most flexible + 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. @@ -174,21 +235,23 @@ pg_dump [ -h host ] + -i + --ignore-version - Ignore version mismatch between pg_dump - and the database server. Since pg_dump + Ignore version mismatch between pg_dump + and the database server. Since pg_dump knows a great deal about system catalogs, any given version of - pg_dump is only intended to work with + 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 - pg_dump then fails, don't + pg_dump then fails, don't say you weren't warned). @@ -196,19 +259,21 @@ pg_dump [ -h host ] -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 - pg_dump prior to v6.4. + pg_dump prior to version 6.4. -N + --quotes Include double quotes around identifiers. @@ -219,6 +284,7 @@ pg_dump [ -h host ] -o + --oids Dump object identifiers (OIDs) for every table. @@ -228,40 +294,45 @@ pg_dump [ -h host ] -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 pg_dump - from issuing any \connect statements. + In plain text output mode, prohibit 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. @@ -269,6 +340,7 @@ pg_dump [ -h host ] -t table + --table=table Dump data for table only. @@ -276,17 +348,9 @@ pg_dump [ -h host ] - - -u - - - Use password authentication. Prompts for username and password. - - - - -v + --verbose Specifies verbose mode. @@ -296,6 +360,7 @@ pg_dump [ -h host ] -x + --no-acl Prevent dumping of ACLs (grant/revoke commands) and table ownership information. @@ -305,6 +370,7 @@ pg_dump [ -h host ] -Z 0..9 + --compress=0..9 Specify the compression level to use in archive formats that support @@ -317,28 +383,30 @@ pg_dump [ -h host ] - pg_dump also accepts + 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 - postmaster + Specifies the host name of the machine on which the + 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 postmaster + extension on which the postmaster is listening for connections. The port number defaults to 5432, or the value of the PGPORT environment variable (if set). @@ -361,141 +429,75 @@ pg_dump [ -h host ] - - - 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'? - - + + + + + + - pg_dump could not attach to the - postmaster + pg_dump could not attach to the + postmaster process on the specified host and port. If you see this message, - ensure that the postmaster + ensure that the 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. - - - - + + + - pg_dump internally executes + pg_dump internally executes SELECT statements. If you have problems running - pg_dump, + pg_dump, make sure you are able to select information from the database using, for - example, psql. + example, . - - - - - - 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. - - - 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 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 - pg_dump has a few limitations. + pg_dump has a few limitations. The limitations mostly stem from difficulty in extracting certain meta-information from the system catalogs. @@ -503,23 +505,15 @@ dumpSequence(table): SELECT failed - pg_dump - 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, pg_dump emits queries + When doing a data only dump, 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. @@ -530,46 +524,54 @@ dumpSequence(table): SELECT failed - - - 2000-11-21 - - - Usage - - - To dump a database of the same name as the user: + + Examples - -$ pg_dump > db.out - + + To dump a database: + +$ pg_dump mydb > db.out + 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 + BLOBs to a tar file: - -$ 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 + + - - pg_restore + + pg_restore 1 Application + - - pg_restore - + pg_restore + Restore a Postgres database from an archive file created by -pg_dump +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 + -a + -c + -C + -d dbname + -f archive-file + -F format + -i index + + -l + -L contents-file + -N -o -r + -O + -P function-name + -R + -s + -S + -t table + -T trigger + -v + -x + + -h host + -p port + -u + + archive-file + + + + + + + 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 + - pg_restore accepts the following command - line arguments: + pg_restore accepts the following command + line arguments. (Long option forms are only available on some platforms.) @@ -52,13 +158,14 @@ pg_restore [ archive-file ] 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). @@ -68,6 +175,7 @@ pg_restore [ archive-file ] -c + --clean Clean (drop) schema prior to create. @@ -77,6 +185,7 @@ pg_restore [ archive-file ] -C + --create Include SQL to create the schema. @@ -86,6 +195,7 @@ pg_restore [ archive-file ] -d dbname + --dbname=dbname Connect to database dbname and restore @@ -95,20 +205,23 @@ pg_restore [ archive-file ] - -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 pg_restore will + It is not necessary to specify the format, since pg_restore will determine the format automatically. If specified, it can be one of the following: @@ -118,7 +231,7 @@ pg_restore [ archive-file ] 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. @@ -129,7 +242,7 @@ pg_restore [ archive-file ] 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. @@ -143,6 +256,7 @@ pg_restore [ archive-file ] -i index + --index=index Restore definition for named index only. @@ -152,9 +266,10 @@ pg_restore [ archive-file ] -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. @@ -162,47 +277,52 @@ pg_restore [ archive-file ] -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. @@ -212,11 +332,12 @@ pg_restore [ archive-file ] -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. @@ -224,9 +345,10 @@ pg_restore [ archive-file ] -R + --no-reconnect - Prohibit pg_restore from issuing any \connect + Prohibit pg_restore from issuing any \connect statements or reconnecting to the database if directly connected. @@ -234,6 +356,7 @@ pg_restore [ archive-file ] -s + --schema-only Restore the schema (definitions), no data. Sequence values will be reset. @@ -243,16 +366,18 @@ pg_restore [ archive-file ] -S username + --superuser=username - Specify the superuser username to use when disabling triggers and/or setting ownership of schema elements. - By default, 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, pg_restore will use the current user name if it is a superuser. -t table + --table=table Restore schema/data for table only. @@ -262,6 +387,7 @@ pg_restore [ archive-file ] -T trigger + --trigger=trigger Restore definition of trigger only. @@ -269,17 +395,9 @@ pg_restore [ archive-file ] - - -u - - - Use password authentication. Prompts for username and password. - - - - -v + --verbose Specifies verbose mode. @@ -289,6 +407,7 @@ pg_restore [ archive-file ] -x + --no-acl Prevent restoration of ACLs (grant/revoke commands). @@ -298,29 +417,32 @@ pg_restore [ archive-file ] + - pg_restore also accepts + 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 - postmaster + Specifies the host name of the machine on which the + 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 postmaster + extension on which the postmaster is listening for connections. The port number defaults to 5432, or the value of the PGPORT environment variable (if set). @@ -328,181 +450,77 @@ pg_restore [ archive-file ] + + -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'? - - + + + + + + - pg_restore could not attach to the - postmaster + pg_restore could not attach to the + postmaster process on the specified host and port. If you see this message, - ensure that the postmaster + ensure that the 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, pg_restore + When a direct database connection is specified using the -d option, pg_restore internally executes SQL statements. If you have problems running - pg_restore, + pg_restore, make sure you are able to select information from the database using, for - example, psql. + example, 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 - pg_dump. - - - The limitations of pg_restore are detailed below. + The limitations of pg_restore are detailed below. - When restoring data to a table, pg_restore emits queries + When restoring data to a table, 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. @@ -511,55 +529,70 @@ FATAL 1: SetUserId: user 'username - pg_restore will not restore BLOBs for a single table. If + 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: + +$ pg_dump mydb > db.out + 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 + BLOBs to a tar file: - -$ 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 +