@@ -5,29 +5,29 @@ pg_upgrade \- upgrading from a previous release without reloading
55.SH SYNOPSIS
66pg_upgrade [-D \fI data_dir \fP ] -1 | -2
77.SH DESCRIPTION
8- \fB pg_upgrade \fP is a utility for upgrading from a previous PostgreSQL release
9- without reloading all the data. Not all PostgreSQL releases can use
10- this utility. Check the release notes for details about your
11- version.
12- .LP
13- \fB pg_upgrade \fP must be run in two stages. In phase one you must run
14- \fB pg_upgrade \fP with your old database installation in place. In phase two,
15- \fB pg_upgrade \fP must be run on a freshly \fB initdb \fP 'ed server.
8+ \fB pg_upgrade \fP is a utility for upgrading from a previous PostgreSQL
9+ release without reloading all the data. It can also be used as a data
10+ recovery tool.
11+ .LP
12+ \fB pg_upgrade \fP must be run in two stages. In phase one you must run
13+ \fB pg_upgrade \fP with your old database installation in place. In phase
14+ two, \fB pg_upgrade \fP must be run on a freshly \fB initdb \fP 'ed server.
1615In both phases, the same newly installed \fB pg_upgrade \fP script must be
1716used.
1817.SH Upgrading PostgreSQL with pg_upgrade
1918.LP
20- 1) Back up your existing data directory, preferably using \fB pg_dumpall. \fP
19+ 1) Back up your existing data directory, preferably using
20+ \fB pg_dumpall. \fP
2121.LP
22- 2) Copy the program \fI pgsql/contrib/pg_upgrade/pg_upgrade \fP from the current
23- PostgreSQL distribution somewhere into your path.
22+ 2) Copy the program \fI pgsql/contrib/pg_upgrade/pg_upgrade \fP from the
23+ current PostgreSQL distribution somewhere into your path.
2424.LP
25253) Run phase one of \fB pg_upgrade: \fP
2626.LP
2727.B $ pg_upgrade -1
2828.sp
2929to collect information about the old database needed for the upgrade.
30- You may use \fI -D \fP to specify the data directory. By default it uses
30+ You may use \fI -D \fP to specify the data directory. By default it uses
3131the environment variable \fI PGDATA. \fP
3232.LP
33334) Do:
@@ -51,9 +51,9 @@ to install the \fIpg_resetxlog\fP utility, which is needed during phase
5151tables for the new release. Make sure you use settings similar to those
5252used in your previous version.
5353.LP
54- 7) Start the new \fI postmaster. \fP (Note: it is critical that no users connect
55- to the server until the upgrade is complete. You may wish to start the
56- postmaster without -i or alter pg_hba.conf temporarily.)
54+ 7) Start the new \fI postmaster. \fP (Note: it is critical that no users
55+ connect to the server until the upgrade is complete. You may wish to
56+ start the postmaster without -i or alter pg_hba.conf temporarily.)
5757.LP
58588) Run phase two of \fB pg_upgrade: \fP
5959.LP
@@ -69,15 +69,30 @@ subdirectories.
6969needed to allow user logins.
7070.sp
7171.LP
72- 10) Carefully examine the contents of the upgraded databases. If you
72+ 10) Carefully examine the contents of the upgraded databases. If you
7373detect problems, you'll need to recover by restoring from your full
74- \fB pg_dumpall \fP backup. You can delete the \fI pg_upgrade_info/ \fP directory when you
75- are satisfied.
74+ \fB pg_dumpall \fP backup. You can delete the \fI pg_upgrade_info/ \fP
75+ directory when you are satisfied.
7676.LP
77- The upgraded databases will be in an un-vacuumed state. You will
78- probably want to run a \fI VACUUM ANALYZE \fP before beginning production work.
77+ The upgraded databases will be in an un-vacuumed state. You will
78+ probably want to run a \fI VACUUM ANALYZE \fP before beginning production
79+ work.
7980.SH NOTES
8081While \fB pg_upgrade \fP is primarly an upgrade tool, it can also be used
81- as a data recovery tool.
82+ for data recovery. During phase 1, \fB pg_upgrade \fP creates database
83+ name / oid and database name / table name / oid mapping files in
84+ \fI pg_upgrade_info/. \fP These files are tab-delimited. If your system is
85+ too damaged, you may need to manually pull this information out of
86+ \fB pg_database \fP and \fB pg_class \fP and create the files manually.
87+ (Keep in mind most tables have \fB pg_toast_OID \fP and
88+ \fB pg_toast_OID_idx \fP files that store very long values. These must be
89+ recorded as well.) It also creates a schema-only \fB pg_dumpall. \fP In a
90+ damaged installation, you may be able to make one of these from a recent
91+ full \fB pg_dumpall. \fP
92+ .LP
93+ Phase 2 rebuilds each database with the schema from the old
94+ installation. It then moves the physical data files from the old
95+ installation and makes some modifications so the old data files work
96+ properly in the new installation.
8297.SH SEE ALSO
8398initdb(1), postmaster(1), pg_dump(1), pg_dumpall(1), vacuumdb(1)
0 commit comments