@@ -5,29 +5,29 @@ pg_upgrade \- upgrading from a previous release without reloading
5
5
.SH SYNOPSIS
6
6
pg_upgrade [-D \fI data_dir \fP ] -1 | -2
7
7
.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.
16
15
In both phases, the same newly installed \fB pg_upgrade \fP script must be
17
16
used.
18
17
.SH Upgrading PostgreSQL with pg_upgrade
19
18
.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
21
21
.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.
24
24
.LP
25
25
3) Run phase one of \fB pg_upgrade: \fP
26
26
.LP
27
27
.B $ pg_upgrade -1
28
28
.sp
29
29
to 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
31
31
the environment variable \fI PGDATA. \fP
32
32
.LP
33
33
4) Do:
@@ -51,9 +51,9 @@ to install the \fIpg_resetxlog\fP utility, which is needed during phase
51
51
tables for the new release. Make sure you use settings similar to those
52
52
used in your previous version.
53
53
.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.)
57
57
.LP
58
58
8) Run phase two of \fB pg_upgrade: \fP
59
59
.LP
@@ -69,15 +69,30 @@ subdirectories.
69
69
needed to allow user logins.
70
70
.sp
71
71
.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
73
73
detect 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.
76
76
.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.
79
80
.SH NOTES
80
81
While \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.
82
97
.SH SEE ALSO
83
98
initdb(1), postmaster(1), pg_dump(1), pg_dumpall(1), vacuumdb(1)
0 commit comments