Skip to content

Commit bf1c866

Browse files
committed
upgrade docs: highlight pg_upgrade, warn about globals preservation
Also, remove OID preservation mention, mention non-text dump formats Backpatch through 9.4
1 parent 3adba73 commit bf1c866

File tree

2 files changed

+44
-30
lines changed

2 files changed

+44
-30
lines changed

doc/src/sgml/backup.sgml

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<title><acronym>SQL</> Dump</title>
2929

3030
<para>
31-
The idea behind this dump method is to generate a text file with SQL
31+
The idea behind this dump method is to generate a file with SQL
3232
commands that, when fed back to the server, will recreate the
3333
database in the same state as it was at the time of the dump.
3434
<productname>PostgreSQL</> provides the utility program
@@ -39,6 +39,9 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
3939
</synopsis>
4040
As you see, <application>pg_dump</> writes its result to the
4141
standard output. We will see below how this can be useful.
42+
While the above command creates a text file, <application>pg_dump</>
43+
can create files in other formats that allow for parallism and more
44+
fine-grained control of object restoration.
4245
</para>
4346

4447
<para>
@@ -98,20 +101,11 @@ pg_dump <replaceable class="parameter">dbname</replaceable> &gt; <replaceable cl
98101
exclusive lock, such as most forms of <command>ALTER TABLE</command>.)
99102
</para>
100103

101-
<important>
102-
<para>
103-
If your database schema relies on OIDs (for instance, as foreign
104-
keys) you must instruct <application>pg_dump</> to dump the OIDs
105-
as well. To do this, use the <option>-o</option> command-line
106-
option.
107-
</para>
108-
</important>
109-
110104
<sect2 id="backup-dump-restore">
111105
<title>Restoring the Dump</title>
112106

113107
<para>
114-
The text files created by <application>pg_dump</> are intended to
108+
Text files created by <application>pg_dump</> are intended to
115109
be read in by the <application>psql</application> program. The
116110
general command form to restore a dump is
117111
<synopsis>
@@ -127,6 +121,8 @@ psql <replaceable class="parameter">dbname</replaceable> &lt; <replaceable class
127121
supports options similar to <application>pg_dump</> for specifying
128122
the database server to connect to and the user name to use. See
129123
the <xref linkend="app-psql"> reference page for more information.
124+
Non-text file dumps are restored using the <xref
125+
linkend="app-pgrestore"> utility.
130126
</para>
131127

132128
<para>
@@ -225,7 +221,14 @@ psql -f <replaceable class="parameter">infile</replaceable> postgres
225221
roles, tablespaces, and empty databases, then invoking
226222
<application>pg_dump</> for each database. This means that while
227223
each database will be internally consistent, the snapshots of
228-
different databases might not be exactly in-sync.
224+
different databases are not sychronized.
225+
</para>
226+
227+
<para>
228+
Cluster-wide data can be dumped alone using the
229+
<application>pg_dumpall</> <option>--globals-only</> option.
230+
This is necessary to fully backup the cluster if running the
231+
<application>pg_dump</> command on individual databases.
229232
</para>
230233
</sect2>
231234

doc/src/sgml/runtime.sgml

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1517,8 +1517,9 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
15171517
For <emphasis>major</> releases of <productname>PostgreSQL</>, the
15181518
internal data storage format is subject to change, thus complicating
15191519
upgrades. The traditional method for moving data to a new major version
1520-
is to dump and reload the database. Other methods are available,
1521-
as discussed below.
1520+
is to dump and reload the database, though this can be slow. A
1521+
faster method is <xref linkend="pgupgrade">. Replication methods are
1522+
also available, as discussed below.
15221523
</para>
15231524

15241525
<para>
@@ -1593,12 +1594,14 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
15931594

15941595
</variablelist>
15951596

1596-
<sect2 id="upgrade-methods-pgdump">
1597-
<title>Upgrading Data via <application>pg_dump</></title>
1597+
<sect2 id="upgrading-via-pgdumpall">
1598+
<title>Upgrading Data via <application>pg_dumpall</></title>
15981599

15991600
<para>
1600-
To dump data from one major version of <productname>PostgreSQL</> and
1601-
reload it in another, you must use <application>pg_dump</>; file system
1601+
One upgrade method is to dump data from one major version of
1602+
<productname>PostgreSQL</> and reload it in another &mdash; to do
1603+
this, you must use a <emphasis>logical</> backup tool like
1604+
<application>pg_dumpall</>; file system
16021605
level backup methods will not work. (There are checks in place that prevent
16031606
you from using a data directory with an incompatible version of
16041607
<productname>PostgreSQL</productname>, so no great harm can be done by
@@ -1607,7 +1610,8 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
16071610

16081611
<para>
16091612
It is recommended that you use the <application>pg_dump</> and
1610-
<application>pg_dumpall</> programs from the newer version of
1613+
<application>pg_dumpall</> programs from the <emphasis>newer</>
1614+
version of
16111615
<productname>PostgreSQL</>, to take advantage of enhancements
16121616
that might have been made in these programs. Current releases of the
16131617
dump programs can read data from any server version back to 7.0.
@@ -1642,14 +1646,12 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
16421646
<screen>
16431647
<userinput>pg_dumpall &gt; <replaceable>outputfile</></userinput>
16441648
</screen>
1645-
If you need to preserve OIDs (such as when using them as
1646-
foreign keys), then use the <option>-o</option> option when running
1647-
<application>pg_dumpall</>.
16481649
</para>
16491650

16501651
<para>
16511652
To make the backup, you can use the <application>pg_dumpall</application>
1652-
command from the version you are currently running. For best
1653+
command from the version you are currently running; see <xref
1654+
linkend="backup-dump-all"> for more details. For best
16531655
results, however, try to use the <application>pg_dumpall</application>
16541656
command from <productname>PostgreSQL</productname> &version;,
16551657
since this version contains bug fixes and improvements over older
@@ -1683,7 +1685,8 @@ $ <userinput>kill -INT `head -1 /usr/local/pgsql/data/postmaster.pid`</userinput
16831685
<step>
16841686
<para>
16851687
If restoring from backup, rename or delete the old installation
1686-
directory. It is a good idea to rename the directory, rather than
1688+
directory if it is not version-specific. It is a good idea to
1689+
rename the directory, rather than
16871690
delete it, in case you have trouble and need to revert to it. Keep
16881691
in mind the directory might consume significant disk space. To rename
16891692
the directory, use a command like this:
@@ -1755,16 +1758,24 @@ pg_dumpall -p 5432 | psql -d postgres -p 5433
17551758

17561759
</sect2>
17571760

1758-
<sect2 id="upgrading-methods-other">
1759-
<title>Non-Dump Upgrade Methods</title>
1761+
<sect2 id="upgrading-via-pg-upgrade">
1762+
<title>Upgrading Data via <application>pg_upgrade</></title>
17601763

17611764
<para>
1762-
The <link linkend="pgupgrade">pg_upgrade</link> module allows an
1763-
installation to be migrated in-place from one major
1764-
<productname>PostgreSQL</> version to the next. Upgrades can be
1765-
performed in minutes.
1765+
The <xref linkend="pgupgrade"> module allows an installation to
1766+
be migrated in-place from one major <productname>PostgreSQL</>
1767+
version to another. Upgrades can be performed in minutes,
1768+
particularly with <option>--link</> mode. It requires steps similar to
1769+
<application>pg_dumpall</> above, e.g. starting/stopping the server,
1770+
running <application>initdb</>. The <application>pg_upgrade</> <link
1771+
linkend="pgupgrade">documentation</> outlines the necessary steps.
17661772
</para>
17671773

1774+
</sect2>
1775+
1776+
<sect2 id="upgrading-via-replication">
1777+
<title>Upgrading Data via Replication</title>
1778+
17681779
<para>
17691780
It is also possible to use certain replication methods, such as
17701781
<productname>Slony</>, to create a standby server with the updated version of

0 commit comments

Comments
 (0)