mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pg_dump can now dump large objects even in plain-text output mode, by
using the recently added lo_create() function. The restore logic in pg_restore is greatly simplified as well, since there's no need anymore to try to adjust database references to match a new set of blob OIDs.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.67 2005/06/21 04:02:29 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/backup.sgml,v 2.68 2005/06/21 20:45:43 tgl Exp $
|
||||
-->
|
||||
<chapter id="backup">
|
||||
<title>Backup and Restore</title>
|
||||
@ -88,9 +88,7 @@ pg_dump <replaceable class="parameter">dbname</replaceable> > <replaceable cl
|
||||
When your database schema relies on OIDs (for instance as foreign
|
||||
keys) you must instruct <application>pg_dump</> to dump the OIDs
|
||||
as well. To do this, use the <option>-o</option> command line
|
||||
option. <quote>Large objects</> are not dumped by default,
|
||||
either. See <xref linkend="app-pgdump">'s reference page if you
|
||||
use large objects.
|
||||
option.
|
||||
</para>
|
||||
</important>
|
||||
|
||||
@ -267,28 +265,6 @@ pg_dump -Fc <replaceable class="parameter">dbname</replaceable> > <replaceabl
|
||||
</formalpara>
|
||||
|
||||
</sect2>
|
||||
|
||||
<sect2 id="backup-dump-caveats">
|
||||
<title>Caveats</title>
|
||||
|
||||
<para>
|
||||
For reasons of backward compatibility, <application>pg_dump</>
|
||||
does not dump large objects by default.<indexterm><primary>large
|
||||
object</primary><secondary>backup</secondary></indexterm> To dump
|
||||
large objects you must use either the custom or the tar output
|
||||
format, and use the <option>-b</> option in
|
||||
<application>pg_dump</>. See the <xref linkend="app-pgdump"> reference
|
||||
page for details. The
|
||||
directory <filename>contrib/pg_dumplo</> of the
|
||||
<productname>PostgreSQL</> source tree also contains a program
|
||||
that can dump large objects.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Please familiarize yourself with the <xref linkend="app-pgdump">
|
||||
reference page.
|
||||
</para>
|
||||
</sect2>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="backup-file">
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.236 2005/06/21 04:02:29 tgl Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.237 2005/06/21 20:45:43 tgl Exp $ -->
|
||||
|
||||
<chapter id="installation">
|
||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||
@ -389,14 +389,6 @@ su - postgres
|
||||
<application>pg_dumpall</>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<application>pg_dumpall</application> does not
|
||||
save large objects. Check
|
||||
<![%standalone-include[the documentation]]>
|
||||
<![%standalone-ignore[<xref linkend="backup-dump-caveats">]]>
|
||||
if you need to do this.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To make the backup, you can use the <application>pg_dumpall</application>
|
||||
command from the version you are currently running. For best
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.77 2005/05/29 03:32:18 momjian Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.78 2005/06/21 20:45:43 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -60,9 +60,8 @@ PostgreSQL documentation
|
||||
<xref linkend="app-pgrestore"> to rebuild the database. They
|
||||
allow <application>pg_restore</application> to be selective about
|
||||
what is restored, or even to reorder the items prior to being
|
||||
restored. The archive formats also allow saving and restoring
|
||||
<quote>large objects</>, which is not possible in a script dump.
|
||||
The archive files are also designed to be portable across
|
||||
restored.
|
||||
The archive file formats are designed to be portable across
|
||||
architectures.
|
||||
</para>
|
||||
|
||||
@ -127,17 +126,6 @@ PostgreSQL documentation
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-b</></term>
|
||||
<term><option>--blobs</></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Include large objects in the dump. A non-text output format
|
||||
must be selected.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>-c</option></term>
|
||||
<term><option>--clean</option></term>
|
||||
@ -600,14 +588,6 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
<application>pg_dump</application> has a few limitations:
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
When dumping a single table or as plain text, <application>pg_dump</application>
|
||||
does not handle large objects. Large objects must be dumped with the
|
||||
entire database using one of the non-text archive formats.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
When a data-only dump is chosen and the option
|
||||
@ -660,17 +640,16 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To dump a database called <literal>mydb</> that contains
|
||||
large objects to a <filename>tar</filename> file:
|
||||
To dump a database called <literal>mydb</> to a <filename>tar</filename>
|
||||
file:
|
||||
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>pg_dump -Ft -b mydb > db.tar</userinput>
|
||||
<prompt>$</prompt> <userinput>pg_dump -Ft mydb > db.tar</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To reload this database (with large objects) to an
|
||||
existing database called <literal>newdb</>:
|
||||
To reload this dump into an existing database called <literal>newdb</>:
|
||||
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>pg_restore -d newdb db.tar</userinput>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<!--
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.50 2005/06/21 04:02:31 tgl Exp $
|
||||
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.51 2005/06/21 20:45:43 tgl Exp $
|
||||
PostgreSQL documentation
|
||||
-->
|
||||
|
||||
@ -43,16 +43,6 @@ PostgreSQL documentation
|
||||
groups, and access permissions that apply to databases as a whole.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Thus, <application>pg_dumpall</application> is an integrated
|
||||
solution for backing up your databases. But note a limitation:
|
||||
it cannot dump <quote>large objects</quote>, since
|
||||
<application>pg_dump</application> cannot dump such objects into
|
||||
text files. If you have databases containing large objects,
|
||||
they should be dumped using one of <application>pg_dump</application>'s
|
||||
non-text output modes.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Since <application>pg_dumpall</application> reads tables from all
|
||||
databases you will most likely have to connect as a database
|
||||
|
@ -1,4 +1,4 @@
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.52 2005/06/09 17:56:51 momjian Exp $ -->
|
||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.53 2005/06/21 20:45:43 tgl Exp $ -->
|
||||
|
||||
<refentry id="APP-PGRESTORE">
|
||||
<refmeta>
|
||||
@ -44,14 +44,13 @@
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<application>pg_restore</application> can operate in two modes: If
|
||||
a database name is specified, the archive is restored directly into
|
||||
the database. (Large objects can only be restored by using such a direct
|
||||
database connection.) Otherwise, a script containing the SQL
|
||||
commands necessary to rebuild the database is created (and written
|
||||
to a file or standard output), similar to the ones created by the
|
||||
<application>pg_dump</application> plain text format. Some of the
|
||||
options controlling the script output are therefore analogous to
|
||||
<application>pg_restore</application> can operate in two modes.
|
||||
If a database name is specified, the archive is restored directly into
|
||||
the database. Otherwise, a script containing the SQL
|
||||
commands necessary to rebuild the database is created and written
|
||||
to a file or standard output. The script output is equivalent to
|
||||
the plain text output format of <application>pg_dump</application>.
|
||||
Some of the options controlling the output are therefore analogous to
|
||||
<application>pg_dump</application> options.
|
||||
</para>
|
||||
|
||||
@ -541,16 +540,16 @@ CREATE DATABASE foo WITH TEMPLATE template0;
|
||||
<title>Examples</title>
|
||||
|
||||
<para>
|
||||
To dump a database called <literal>mydb</> that contains
|
||||
large objects to a <filename>tar</filename> file:
|
||||
To dump a database called <literal>mydb</> to a <filename>tar</filename>
|
||||
file:
|
||||
|
||||
<screen>
|
||||
<prompt>$</prompt> <userinput>pg_dump -Ft -b mydb > db.tar</userinput>
|
||||
<prompt>$</prompt> <userinput>pg_dump -Ft mydb > db.tar</userinput>
|
||||
</screen>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
To reload this database (with large objects) to an
|
||||
To reload this dump into an
|
||||
existing database called <literal>newdb</>:
|
||||
|
||||
<screen>
|
||||
|
Reference in New Issue
Block a user